// this is call by TRoom destructor only bool TRoomDB::__removeRoom( int id ) { if( rooms.contains(id ) && id > 0 ) { TRoom * pR = getRoom( id ); if( !pR ) return false; QMapIterator<int, TRoom *> it( rooms ); while( it.hasNext() ) { it.next(); TRoom * r = it.value(); if( r->getNorth() == id ) r->setNorth(-1); if( r->getNortheast() == id ) r->setNortheast(-1); if( r->getNorthwest() == id ) r->setNorthwest(-1); if( r->getEast() == id ) r->setEast(-1); if( r->getWest() == id ) r->setWest(-1); if( r->getSouth() == id ) r->setSouth(-1); if( r->getSoutheast() == id ) r->setSoutheast(-1); if( r->getSouthwest() == id ) r->setSouthwest(-1); if( r->getUp() == id ) r->setUp(-1); if( r->getDown() == id ) r->setDown(-1); if( r->getIn() == id ) r->setIn(-1); if( r->getOut() == id ) r->setOut(-1); r->removeAllSpecialExitsToRoom( id ); } int _areaId = pR->getAreaId(); TArea * pA = getArea( _areaId ); if( !pA ) return false; pA->rooms.removeAll( id ); pA->exits.remove( id ); //note: this removes *all* keys=id mpMap->mMapGraphNeedsUpdate = true; } QList<QString> keyList = hashTable.keys(); QList<int> valueList = hashTable.values(); for( int i=0; i<valueList.size(); i++ ) { if( valueList[i] == id ) { hashTable.remove( keyList[i] ); } } return true; }
void TArea::determineAreaExits() { exits.clear(); QSetIterator<int> itRoom(rooms); while (itRoom.hasNext()) { int id = itRoom.next(); TRoom* pR = mpRoomDB->getRoom(id); if (!pR) { continue; } int exitId = pR->getNorth(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_NORTH); exits.insertMulti(id, p); } exitId = pR->getNortheast(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_NORTHEAST); exits.insertMulti(id, p); } exitId = pR->getEast(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_EAST); exits.insertMulti(id, p); } exitId = pR->getSoutheast(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_SOUTHEAST); exits.insertMulti(id, p); } exitId = pR->getSouth(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_SOUTH); exits.insertMulti(id, p); } exitId = pR->getSouthwest(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_SOUTHWEST); exits.insertMulti(id, p); } exitId = pR->getWest(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_WEST); exits.insertMulti(id, p); } exitId = pR->getNorthwest(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_NORTHWEST); exits.insertMulti(id, p); } exitId = pR->getUp(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_UP); exits.insertMulti(id, p); } exitId = pR->getDown(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_DOWN); exits.insertMulti(id, p); } exitId = pR->getIn(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_IN); exits.insertMulti(id, p); } exitId = pR->getOut(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_OUT); exits.insertMulti(id, p); } const QMap<int, QString> otherMap = pR->getOtherMap(); QMapIterator<int, QString> it(otherMap); while (it.hasNext()) { it.next(); int _exit = it.key(); TRoom* pO = mpRoomDB->getRoom(_exit); if (pO) { if (pO->getArea() != getAreaID()) { QPair<int, int> p = QPair<int, int>(pO->getId(), DIR_OTHER); exits.insertMulti(id, p); } } } } }
void TArea::determineAreaExitsOfRoom(int id) { if (!mpRoomDB) { return; } TRoom* pR = mpRoomDB->getRoom(id); if (!pR) { return; } exits.remove(id); int exitId = pR->getNorth(); // The second term in the ifs below looks for exit room id in TArea // instance's own list of rooms which will fail (with a -1 if it is NOT in // the list and hence the area. if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_NORTH); exits.insertMulti(id, p); } exitId = pR->getNortheast(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_NORTHEAST); exits.insertMulti(id, p); } exitId = pR->getEast(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_EAST); exits.insertMulti(id, p); } exitId = pR->getSoutheast(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_SOUTHEAST); exits.insertMulti(id, p); } exitId = pR->getSouth(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_SOUTH); exits.insertMulti(id, p); } exitId = pR->getSouthwest(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_SOUTHWEST); exits.insertMulti(id, p); } exitId = pR->getWest(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_WEST); exits.insertMulti(id, p); } exitId = pR->getNorthwest(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_NORTHWEST); exits.insertMulti(id, p); } exitId = pR->getUp(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_UP); exits.insertMulti(id, p); } exitId = pR->getDown(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_DOWN); exits.insertMulti(id, p); } exitId = pR->getIn(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_IN); exits.insertMulti(id, p); } exitId = pR->getOut(); if (exitId > 0 && !rooms.contains(exitId)) { QPair<int, int> p = QPair<int, int>(exitId, DIR_OUT); exits.insertMulti(id, p); } const QMap<int, QString> otherMap = pR->getOtherMap(); QMapIterator<int, QString> it(otherMap); while (it.hasNext()) { it.next(); int _exit = it.key(); TRoom* pO = mpRoomDB->getRoom(_exit); if (pO) { if (pO->getArea() != getAreaID()) { QPair<int, int> p = QPair<int, int>(pO->getId(), DIR_OTHER); exits.insertMulti(id, p); } } } }
bool TMap::serialize( QDataStream & ofs ) { version = CURRENT_MAP_VERSION; ofs << version; ofs << envColors; ofs << mpRoomDB->getAreaNamesMap(); ofs << customEnvColors; ofs << mpRoomDB->hashTable; ofs << mpRoomDB->getAreaMap().size(); // serialize area table QMapIterator<int, TArea *> itAreaList(mpRoomDB->getAreaMap()); while( itAreaList.hasNext() ) { itAreaList.next(); int areaId = itAreaList.key(); TArea * pA = itAreaList.value(); ofs << areaId; ofs << pA->rooms; ofs << pA->ebenen; ofs << pA->exits; ofs << pA->gridMode; ofs << pA->max_x; ofs << pA->max_y; ofs << pA->max_z; ofs << pA->min_x; ofs << pA->min_y; ofs << pA->min_z; ofs << pA->span; ofs << pA->xmaxEbene; ofs << pA->ymaxEbene; ofs << pA->zmaxEbene; ofs << pA->xminEbene; ofs << pA->yminEbene; ofs << pA->zminEbene; ofs << pA->pos; ofs << pA->isZone; ofs << pA->zoneAreaRef; } if (mRoomId) ofs << mRoomId; else{ mRoomId = 0; ofs << mRoomId; } ofs << mapLabels.size(); //anzahl der areas QMapIterator<int, QMap<int, TMapLabel> > itL1(mapLabels); while( itL1.hasNext() ) { itL1.next(); int i = itL1.key(); ofs << itL1.value().size();//anzahl der labels pro area ofs << itL1.key(); //area id QMapIterator<int, TMapLabel> itL2(mapLabels[i]); while( itL2.hasNext() ) { itL2.next(); // N/U: int ii = itL2.key(); ofs << itL2.key();//label ID TMapLabel label = itL2.value(); ofs << label.pos; ofs << label.pointer; ofs << label.size; ofs << label.text; ofs << label.fgColor; ofs << label.bgColor; ofs << label.pix; ofs << label.noScaling; ofs << label.showOnTop; } } QMapIterator<int, TRoom *> it( mpRoomDB->getRoomMap() ); while( it.hasNext() ) { it.next(); // N/U: int i = it.key(); TRoom * pR = it.value(); ofs << pR->getId(); ofs << pR->getAreaId(); ofs << pR->x; ofs << pR->y; ofs << pR->z; ofs << pR->getNorth(); ofs << pR->getNortheast(); ofs << pR->getEast(); ofs << pR->getSoutheast(); ofs << pR->getSouth(); ofs << pR->getSouthwest(); ofs << pR->getWest(); ofs << pR->getNorthwest(); ofs << pR->getUp(); ofs << pR->getDown(); ofs << pR->getIn(); ofs << pR->getOut(); ofs << pR->environment; ofs << pR->getWeight(); // ofs << rooms[i]->xRot; // ofs << rooms[i]->yRot; // ofs << rooms[i]->zRot; // ofs << rooms[i]->zoom; ofs << pR->name; ofs << pR->isLocked; ofs << pR->getOtherMap(); ofs << pR->c; ofs << pR->userData; ofs << pR->customLines; ofs << pR->customLinesArrow; ofs << pR->customLinesColor; ofs << pR->customLinesStyle; ofs << pR->exitLocks; ofs << pR->exitStubs; ofs << pR->getExitWeights(); ofs << pR->doors; } return true; }
bool TMap::findPath( int from, int to ) { if( mMapGraphNeedsUpdate ) { initGraph(); } //vertex start = from;//mRoomId; //vertex goal = to;//mTargetID; TRoom * pFrom = mpRoomDB->getRoom( from ); TRoom * pTo = mpRoomDB->getRoom( to ); if( !pFrom || !pTo ) { return false; } vertex start = roomidToIndex[from]; vertex goal = roomidToIndex[to]; vector<mygraph_t::vertex_descriptor> p(num_vertices(g)); vector<cost> d(num_vertices(g)); QTime t; t.start(); try { astar_search( g, start, distance_heuristic<mygraph_t, cost, std::vector<location> >(locations, goal), predecessor_map(&p[0]).distance_map(&d[0]). visitor(astar_goal_visitor<vertex>(goal)) ); } catch( found_goal fg ) { qDebug("TMap::findPath(%i,%i) time elapsed in astar:%imSec", from, to, t.elapsed() ); t.restart(); list<vertex> shortest_path; for(vertex v = goal; ; v = p[v]) { //cout << "assembling path: v="<<v<<endl; qDebug("TMap::findPath(...) assembling path: v=%i", v); int nextRoom = indexToRoomid[v]; if( ! mpRoomDB->getRoom( nextRoom ) ) { qDebug("TMap::findPath(%i,%i) ERROR path assembly: path room not in map!", from, to); return false; } shortest_path.push_front(nextRoom); if(p[v] == v) break; } TRoom * pRD1 = mpRoomDB->getRoom(from); TRoom * pRD2 = mpRoomDB->getRoom(to); if( !pRD1 || !pRD2 ) return false; qDebug("Shortest path from %i to %i:", pRD1->getId(), pRD2->getId()); list<vertex>::iterator spi = shortest_path.begin(); qDebug() << pRD1->getId(); mPathList.clear(); mDirList.clear(); int curRoom = from; for( ++spi; spi != shortest_path.end(); ++spi ) { TRoom * pRcurRoom = mpRoomDB->getRoom( curRoom ); TRoom * pRPath = mpRoomDB->getRoom( *spi ); if( !pRcurRoom || !pRPath ) { // cout << "ERROR: path not possible. curRoom not in map!" << endl; qDebug("TMap::findPath(%i,%i) ERROR path not possible. curRoom not in map!", from, to); mPathList.clear(); mDirList.clear(); return false; } // cout <<" spi:"<<*spi<<" curRoom:"<< curRoom << endl;//" -> "; qDebug(" spi:%i curRoom:%i", *spi, curRoom); mPathList.push_back( *spi ); if( pRcurRoom->getNorth() == pRPath->getId() ) { mDirList.push_back("n"); } else if( pRcurRoom->getNortheast() == pRPath->getId() ) { mDirList.push_back("ne"); } else if( pRcurRoom->getNorthwest() == pRPath->getId() ) { mDirList.push_back("nw"); } else if( pRcurRoom->getSoutheast() == pRPath->getId() ) { mDirList.push_back("se"); } else if( pRcurRoom->getSouthwest() == pRPath->getId() ) { mDirList.push_back("sw"); } else if( pRcurRoom->getSouth() == pRPath->getId() ) { mDirList.push_back("s"); } else if( pRcurRoom->getEast() == pRPath->getId() ) { mDirList.push_back("e"); } else if( pRcurRoom->getWest() == pRPath->getId() ) { mDirList.push_back("w"); } else if( pRcurRoom->getUp() == pRPath->getId() ) { mDirList.push_back("up"); } else if( pRcurRoom->getDown() == pRPath->getId() ) { mDirList.push_back("down"); } else if( pRcurRoom->getIn() == pRPath->getId() ) { mDirList.push_back("in"); } else if( pRcurRoom->getOut() == pRPath->getId() ) { mDirList.push_back("out"); } else if( pRcurRoom->getOtherMap().size() > 0 ) { QMapIterator<int, QString> it( pRcurRoom->getOtherMap() ); while( it.hasNext() ) { it.next(); if( it.key() == pRPath->getId() ) { QString _cmd = it.value(); if( _cmd.size() > 0 ) { if(_cmd.startsWith('0')) { _cmd = _cmd.mid(1); mDirList.push_back( _cmd ); qDebug(" adding special exit: roomID:%i OPEN special exit:%s", pRcurRoom->getId(), qPrintable(_cmd) ); } else if( _cmd.startsWith('1')) { _cmd = _cmd.mid(1); qDebug(" NOT adding roomID:%i LOCKED special exit:%s", pRcurRoom->getId(), qPrintable(_cmd)); } else { qWarning("ERROR adding roomID:%i UNPATCHED special exit found:%s", pRcurRoom->getId(), qPrintable(_cmd)); } } else qWarning("ERROR adding roomID:%i NULL command special exit found.", pRcurRoom->getId()); } } } qDebug(" added to DirList:%s", qPrintable( mDirList.back() ) ); curRoom = *spi; } qDebug("TMap::findPath(%i,%i) time elapsed building path:%imSec", from, to, t.elapsed() ); return true; } return false; }
void TMap::initGraph() { QTime _time; _time.start(); locations.clear(); roomidToIndex.clear(); g.clear(); g = mygraph_t(); weightmap = get(edge_weight, g); QList<TRoom*> roomList = mpRoomDB->getRoomPtrList(); int roomCount=0; int edgeCount=0; for( int _k=0; _k<roomList.size(); _k++ ) { TRoom * pR = roomList[_k]; int i = pR->getId(); if( pR->isLocked || i < 1 ) { continue; } roomCount++; // int roomExits = edgeCount; location l; l.x = pR->x; l.y = pR->y; l.z = pR->z; l.id = pR->getId(); l.area = pR->getAreaId(); locations.push_back( l ); } for(unsigned int i=0;i<locations.size();i++){ roomidToIndex[locations[i].id] = i; indexToRoomid[i] = locations[i].id; } for( int _k=0; _k<roomList.size(); _k++ ){ TRoom * pR = roomList[_k]; if( pR->isLocked || !roomidToIndex.contains(pR->getId()) ) { continue; } int roomIndex = roomidToIndex[pR->getId()]; TRoom * pN = mpRoomDB->getRoom( pR->getNorth() ); TRoom * pNW = mpRoomDB->getRoom( pR->getNorthwest() ); TRoom * pNE = mpRoomDB->getRoom( pR->getNortheast() ); TRoom * pS = mpRoomDB->getRoom( pR->getSouth() ); TRoom * pSW = mpRoomDB->getRoom( pR->getSouthwest() ); TRoom * pSE = mpRoomDB->getRoom( pR->getSoutheast() ); TRoom * pW = mpRoomDB->getRoom( pR->getWest() ); TRoom * pE = mpRoomDB->getRoom( pR->getEast() ); TRoom * pUP = mpRoomDB->getRoom( pR->getUp() ); TRoom * pDOWN = mpRoomDB->getRoom( pR->getDown() ); TRoom * pIN = mpRoomDB->getRoom( pR->getIn() ); TRoom * pOUT = mpRoomDB->getRoom( pR->getOut() ); QMap<QString, int> exitWeights = pR->getExitWeights(); if( pN && !pN->isLocked ) { if( !pR->hasExitLock( DIR_NORTH ) ) { //edgeCount++; edge_descriptor e; bool inserted; tie(e, inserted) = add_edge( roomIndex, roomidToIndex[pR->getNorth()], g ); if( exitWeights.contains("n")) weightmap[e] = pR->getExitWeight("n"); else weightmap[e] = pN->getWeight(); } } if( pS && !pS->isLocked ) { if( !pR->hasExitLock( DIR_SOUTH ) ) { //edgeCount++; edge_descriptor e; bool inserted; tie(e, inserted) = add_edge( roomIndex, roomidToIndex[pR->getSouth()], g ); if( exitWeights.contains("s")) weightmap[e] = pR->getExitWeight("s"); else weightmap[e] = pS->getWeight(); } } if( pNE && !pNE->isLocked ) { if( !pR->hasExitLock( DIR_NORTHEAST ) ) { // edgeCount++; edge_descriptor e; bool inserted; tie(e, inserted) = add_edge( roomIndex, roomidToIndex[pR->getNortheast()], g ); if( exitWeights.contains("ne")) weightmap[e] = pR->getExitWeight("ne"); else weightmap[e] = pNE->getWeight(); } } if( pE && !pE->isLocked ) { if( !pR->hasExitLock( DIR_EAST ) ) { //edgeCount++; edge_descriptor e; bool inserted; tie(e, inserted) = add_edge( roomIndex, roomidToIndex[pR->getEast()], g ); if( exitWeights.contains("e")) weightmap[e] = pR->getExitWeight("e"); else weightmap[e] = pE->getWeight(); } } if( pW && !pW->isLocked ) { if( !pR->hasExitLock( DIR_WEST ) ) { // edgeCount++; edge_descriptor e; bool inserted; tie(e, inserted) = add_edge( roomIndex, roomidToIndex[pR->getWest()], g ); if( exitWeights.contains("w")) weightmap[e] = pR->getExitWeight("w"); else weightmap[e] = pW->getWeight(); } } if( pSW && !pSW->isLocked ) { if( !pR->hasExitLock( DIR_SOUTHWEST ) ) { // edgeCount++; edge_descriptor e; bool inserted; tie(e, inserted) = add_edge( roomIndex, roomidToIndex[pR->getSouthwest()], g ); if( exitWeights.contains("sw")) weightmap[e] = pR->getExitWeight("sw"); else weightmap[e] = pSW->getWeight(); } } if( pSE && !pSE->isLocked ) { if( !pR->hasExitLock( DIR_SOUTHEAST ) ) { // edgeCount++; edge_descriptor e; bool inserted; tie(e, inserted) = add_edge( roomIndex, roomidToIndex[pR->getSoutheast()], g ); if( exitWeights.contains("se")) weightmap[e] = pR->getExitWeight("se"); else weightmap[e] = pSE->getWeight(); } } if( pNW && !pNW->isLocked ) { if( !pR->hasExitLock( DIR_NORTHWEST ) ) { // edgeCount++; edge_descriptor e; bool inserted; tie(e, inserted) = add_edge( roomIndex, roomidToIndex[pR->getNorthwest()], g ); if( exitWeights.contains("nw")) weightmap[e] = pR->getExitWeight("nw"); else weightmap[e] = pNW->getWeight(); } } if( pUP && !pUP->isLocked ) { if( !pR->hasExitLock( DIR_UP ) ) { // edgeCount++; edge_descriptor e; bool inserted; tie(e, inserted) = add_edge( roomIndex, roomidToIndex[pR->getUp()], g ); if( exitWeights.contains("up")) weightmap[e] = pR->getExitWeight("up"); else weightmap[e] = pUP->getWeight(); } } if( pDOWN && !pDOWN->isLocked ) { if( !pR->hasExitLock( DIR_DOWN ) ) { // edgeCount++; edge_descriptor e; bool inserted; tie(e, inserted) = add_edge( roomIndex, roomidToIndex[pR->getDown()], g ); if( exitWeights.contains("down")) weightmap[e] = pR->getExitWeight("down"); else weightmap[e] = pDOWN->getWeight(); } } if( pIN && !pIN->isLocked ) { if( !pR->hasExitLock( DIR_IN ) ) { // edgeCount++; edge_descriptor e; bool inserted; tie(e, inserted) = add_edge( roomIndex, roomidToIndex[pR->getIn()], g ); if( exitWeights.contains("in")) weightmap[e] = pR->getExitWeight("in"); else weightmap[e] = pIN->getWeight(); } } if( pOUT && !pOUT->isLocked ) { if( !pR->hasExitLock( DIR_OUT ) ) { // edgeCount++; edge_descriptor e; bool inserted; tie(e, inserted) = add_edge( roomIndex, roomidToIndex[pR->getOut()], g ); if( exitWeights.contains("out")) weightmap[e] = pR->getExitWeight("out"); else weightmap[e] = pOUT->getWeight(); } } if( pR->getOtherMap().size() > 0 ) { QMapIterator<int, QString> it( pR->getOtherMap() ); while( it.hasNext() ) { it.next(); int _id = it.key(); QString _cmd = it.value(); if( _cmd.size()>0 ) _cmd.remove(0,1);//strip special exit lock information TRoom * pSpecial = mpRoomDB->getRoom( _id ); if( !pSpecial || pR->hasSpecialExitLock( _id, _cmd ) || pSpecial->isLocked) continue; else { // edgeCount++; edge_descriptor e; bool inserted; tie(e, inserted) = add_edge( roomIndex, roomidToIndex[pSpecial->getId()], g ); if( exitWeights.contains(_cmd)) { weightmap[e] = pR->getExitWeight(_cmd); } else { weightmap[e] = pSpecial->getWeight(); } } } } // if( roomExits == edgeCount ) locations.pop_back(); } mMapGraphNeedsUpdate = false; qDebug("TMap::initGraph(): nodes/room Counts: %i / %i edges: %i run time: %imSec.", locations.size(), roomCount, edgeCount, _time.elapsed()); }
void dlgRoomExits::init( int id ) { TRoom * pR = mpHost->mpMap->mpRoomDB->getRoom( id ); if( !pR ) return; if( pR->hasExitLock(DIR_NORTH) ) { n->setDisabled(true); ln->setChecked(true); } else { n->setDisabled(false); ln->setChecked(false); } if( pR->hasExitLock(DIR_NORTHEAST) ) { ne->setDisabled(true); lne->setChecked(true); } else { ne->setDisabled(false); le->setChecked(false); } if( pR->hasExitLock(DIR_NORTHWEST) ) { nw->setDisabled(true); lnw->setChecked(true); } else { nw->setDisabled(false); lnw->setChecked(false); } if( pR->hasExitLock(DIR_SOUTH) ) { s->setDisabled(true); ls->setChecked(true); } else { s->setDisabled(false); ls->setChecked(false); } if( pR->hasExitLock(DIR_SOUTHEAST) ) { se->setDisabled(true); lse->setChecked(true); } else { se->setDisabled(false); lse->setChecked(false); } if( pR->hasExitLock(DIR_SOUTHWEST) ) { sw->setDisabled(true); lsw->setChecked(true); } else { sw->setDisabled(false); lsw->setChecked(false); } if( pR->hasExitLock(DIR_WEST) ) { w->setDisabled(true); lw->setChecked(true); } else { w->setDisabled(false); lw->setChecked(false); } if( pR->hasExitLock(DIR_EAST) ) { e->setDisabled(true); le->setChecked(true); } else { e->setDisabled(false); le->setChecked(false); } if( pR->hasExitLock(DIR_UP) ) { up->setDisabled(true); lup->setChecked(true); } else { up->setDisabled(false); lup->setChecked(false); } if( pR->hasExitLock(DIR_DOWN) ) { down->setDisabled(true); ldown->setChecked(true); } else { down->setDisabled(false); ldown->setChecked(false); } if( pR->hasExitLock(DIR_IN) ) { in->setDisabled(true); lin->setChecked(true); } else { in->setDisabled(false); lin->setChecked(false); } if( pR->hasExitLock(DIR_OUT) ) { out->setDisabled(true); lout->setChecked(true); } else { out->setDisabled(false); lout->setChecked(false); } if( pR->getNorth() > 0 ) n->setText(QString::number(pR->getNorth())); if( pR->getSouth() > 0 ) s->setText(QString::number(pR->getSouth())); if( pR->getWest() > 0 ) w->setText(QString::number(pR->getWest())); if( pR->getEast() > 0 ) e->setText(QString::number(pR->getEast())); if( pR->getNorthwest() > 0 ) nw->setText(QString::number(pR->getNorthwest())); if( pR->getNortheast() > 0 ) ne->setText(QString::number(pR->getNortheast())); if( pR->getSouthwest() > 0 ) sw->setText(QString::number(pR->getSouthwest())); if( pR->getSoutheast() > 0 ) se->setText(QString::number(pR->getSoutheast())); if( pR->getUp() > 0 ) up->setText(QString::number(pR->getUp())); if( pR->getDown() > 0 ) down->setText(QString::number(pR->getDown())); if( pR->getIn() > 0 ) in->setText(QString::number(pR->getIn())); if( pR->getOut() > 0 ) out->setText(QString::number(pR->getOut())); QMapIterator<int, QString> it(pR->getOtherMap()); while( it.hasNext() ) { it.next(); int id_to = it.key(); QString dir = it.value(); if( dir.size() < 1 ) continue; QTreeWidgetItem * pI = new QTreeWidgetItem(specialExits); if( pR->hasSpecialExitLock( id_to, dir ) ) pI->setCheckState( 0, Qt::Checked ); else pI->setCheckState( 0, Qt::Unchecked ); pI->setText( 1, QString::number(id_to) ); qDebug()<<"dir="<<dir; if( dir.startsWith('0') || dir.startsWith('1') ) dir = dir.mid(1); pI->setText( 2, dir ); } mRoomID = id; }