void doubleEndSearch(State& from,State& to,stack<State>& result) { cleanMap(bfsMap); cleanMap(dfsMap); cleanStateQueue(); pthread_t tid1,tid2; stack<State> stackForBFS; stack<State> stackForDFS; Para bfsPara = {to,stackForBFS}; Para dfsPara = {from,stackForDFS}; pthread_create(&tid1,NULL,Thread1,&bfsPara); pthread_create(&tid2,NULL,Thread2,&dfsPara); pthread_join(tid1,NULL); pthread_join(tid2,NULL); while(!stackForBFS.empty()){ result.push(stackForBFS.top()); stackForBFS.pop(); } reverseStack(stackForDFS); while(!stackForDFS.empty()){ result.push(stackForDFS.top()); stackForDFS.pop(); } cleanMap(bfsMap); cleanMap(dfsMap); cleanStateQueue(); }
void MapEditor::loadMap(std::string fileName) { cleanMap(); std::ifstream file; file.open(fileName.c_str(), std::ios::in | std::ios::binary ); if(file.is_open() && !file.eof()) { MapHeader header; MapEntity4_t ent4; MapEntity2_t ent2; ModelEntity_t model; file.read((char*)&header,sizeof(MapHeader)); std::cout<<header.entity4Count<<std::endl; for(int i=0;i<header.entity4Count&&!file.eof();i++) { file.read((char*)(&ent4),sizeof(MapEntity4_t)); mapEntity4Vector.push_back(ent4); } for(int i=0;i<header.entity2Count&&!file.eof();i++) { file.read((char*)(&ent2),sizeof(MapEntity2_t)); mapEntity2Vector.push_back(ent2); } for(int i=0;i<header.modelCount&&!file.eof();i++) { file.read((char*)(&model),sizeof(ModelEntity_t)); modelEntityVector.push_back(model); } this->header = header; } file.close(); }
void Graphics::refreshScreen(Map *map) { app->Clear(); printBackground(); cleanMap(map); highlightCase(map->getHud()); printRessources(map); printEggs(map); printPlayers(map); printHud(map); app->Display(); }
// //////////////////////////////////////////////////////////////////////////// static BOOL gameInit(void) { UDWORD player; scriptInit(); // If this is from a savegame, stop here! if (getSaveGameType() == GTYPE_SAVE_START || getSaveGameType() == GTYPE_SAVE_MIDMISSION) { // these two lines are the biggest hack in the world. // the reticule seems to get detached from 'reticuleup' // this forces it back in sync... intRemoveReticule(); intAddReticule(); return true; } for(player = 0; player<game.maxPlayers; player++) // clean up only to the player limit for this map.. { cleanMap(player); } for (player = 1; player < MAX_PLAYERS; player++) { // we want to remove disabled AI & all the other players that don't belong if ((game.skDiff[player] == 0 || player >= game.maxPlayers) && (!game.scavengers || player != 7)) { clearPlayer(player, true); // do this quietly debug(LOG_NET, "removing disabled AI (%d) from map.", player); } } if (game.scavengers) // FIXME - not sure if we still need this hack - Per { // ugly hack for now game.skDiff[7] = DIFF_SLIDER_STOPS / 2; } if (NetPlay.isHost) // add oil drums { addOilDrum(NetPlay.playercount * 2); } playerResponding(); // say howdy! return true; }
unsigned RelationManager::deleteNonExistingRelations() { // removes nulls from maps -> important to keep relation manager up to date with destroyed classes unsigned deletedRecords = 0; deletedRecords += cleanMap(m_aggregation); deletedRecords += cleanMap(m_association); deletedRecords += cleanMap(m_composition); deletedRecords += cleanMap(m_dependency); deletedRecords += cleanMap(m_whoDoesKeyInherit); deletedRecords += cleanMap(m_keyIsInheritedBy); return deletedRecords; }