From 609bc528d20ad3902545abebca11f91d4d073d56 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Sat, 3 Dec 2011 01:19:54 +0000 Subject: [PATCH] - fixed fog of war bug in map preview for connected client - in headless mode keep three caches in case its related to out of synch - comment out spurious irc console text --- source/glest_game/menu/menu_state_connected_game.cpp | 1 + source/glest_game/type_instances/unit.h | 3 --- source/glest_game/world/unit_updater.cpp | 3 ++- source/glest_game/world/world.cpp | 7 ++++--- source/shared_lib/sources/platform/posix/ircclient.cpp | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index d79ed11d8..a4cda7cab 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -2776,6 +2776,7 @@ void MenuStateConnectedGame::update() { listBoxFogOfWar.setSelectedItemIndex(1); } } + cleanupMapPreviewTexture(); // Allow Observers if(gameSettings->getAllowObservers()) { diff --git a/source/glest_game/type_instances/unit.h b/source/glest_game/type_instances/unit.h index 8da544481..8741a9ccd 100644 --- a/source/glest_game/type_instances/unit.h +++ b/source/glest_game/type_instances/unit.h @@ -416,9 +416,6 @@ private: CauseOfDeathType causeOfDeath; public: - Unit() : id(-1) { - assert(false); - } Unit(int id, UnitPathInterface *path, const Vec2i &pos, const UnitType *type, Faction *faction, Map *map, CardinalDir placeFacing); ~Unit(); diff --git a/source/glest_game/world/unit_updater.cpp b/source/glest_game/world/unit_updater.cpp index d6bab191e..cfe6ffbd5 100644 --- a/source/glest_game/world/unit_updater.cpp +++ b/source/glest_game/world/unit_updater.cpp @@ -2178,7 +2178,8 @@ bool UnitUpdater::findCachedCellsEnemies(Vec2i center, int range, int size, vect bool result = false; //return result; - if(game->isMasterserverMode() == false) { + //if(game->isMasterserverMode() == false) { + { MutexSafeWrapper safeMutex(&mutexUnitRangeCellsLookupItemCache,string(__FILE__) + "_" + intToStr(__LINE__)); std::map > >::iterator iterFind = UnitRangeCellsLookupItemCache.find(center); diff --git a/source/glest_game/world/world.cpp b/source/glest_game/world/world.cpp index 43372661d..090c81075 100644 --- a/source/glest_game/world/world.cpp +++ b/source/glest_game/world/world.cpp @@ -1436,8 +1436,8 @@ void World::exploreCells(const Vec2i &newPos, int sightRange, int teamIndex) { //bool cacheLookupSightResult = false; // cache lookup of previously calculated cells + sight range - if(MaxExploredCellsLookupItemCache > 0 && game->isMasterserverMode() == false) { - //if(MaxExploredCellsLookupItemCache > 0) { + //if(MaxExploredCellsLookupItemCache > 0 && game->isMasterserverMode() == false) { + if(MaxExploredCellsLookupItemCache > 0) { if(difftime(time(NULL),ExploredCellsLookupItem::lastDebug) >= 10) { ExploredCellsLookupItem::lastDebug = time(NULL); //printf("In [%s::%s Line: %d] ExploredCellsLookupItemCache.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,ExploredCellsLookupItemCache.size()); @@ -1704,7 +1704,8 @@ void World::computeFow(int factionIdxToTick) { //compute texture //printf("Masterserver = %d\n",game->isMasterserverMode()); - if(fogOfWar == true && game->isMasterserverMode() == false) { + //if(fogOfWar == true && game->isMasterserverMode() == false) { + if(fogOfWar == true) { for(int i=0; igetTeam() == thisTeamIndex) { diff --git a/source/shared_lib/sources/platform/posix/ircclient.cpp b/source/shared_lib/sources/platform/posix/ircclient.cpp index 6f3d5671f..b09c972d7 100644 --- a/source/shared_lib/sources/platform/posix/ircclient.cpp +++ b/source/shared_lib/sources/platform/posix/ircclient.cpp @@ -235,7 +235,7 @@ void dcc_file_recv_callback (irc_session_t * session, irc_dcc_t id, int status, void event_channel(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count) { //IRC: Event "433", origin: "leguin.freenode.net", params: 3 [*|softcoder|Nickname is already in use.] - printf("In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__); if ( count != 2 ) return;