diff --git a/source/glest_game/ai/path_finder.cpp b/source/glest_game/ai/path_finder.cpp index 3da3de86..b68bace7 100644 --- a/source/glest_game/ai/path_finder.cpp +++ b/source/glest_game/ai/path_finder.cpp @@ -269,7 +269,6 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout const Vec2i finalPos= computeNearestFreePos(unit, targetPos); //if arrived - /* if(finalPos == unit->getPos()) { Command *command= unit->getCurrCommand(); if(command == NULL || command->getPos() != unit->getPos()) { @@ -286,7 +285,6 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout return tsArrived; } } - */ //path find algorithm diff --git a/source/glest_game/game/commander.cpp b/source/glest_game/game/commander.cpp index 0a26b5d4..982e1b97 100644 --- a/source/glest_game/game/commander.cpp +++ b/source/glest_game/game/commander.cpp @@ -331,7 +331,7 @@ void Commander::updateNetwork() { for(int i= 0; i < gameNetworkInterface->getPendingCommandCount(); ++i){ giveNetworkCommand(gameNetworkInterface->getPendingCommand(i)); } - if(perfTimer.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] giveNetworkCommand took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,perfTimer.getMillis()); + if(perfTimer.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] giveNetworkCommand took %lld msecs, PendingCommandCount = %d\n",__FILE__,__FUNCTION__,__LINE__,perfTimer.getMillis(),gameNetworkInterface->getPendingCommandCount()); gameNetworkInterface->clearPendingCommands(); } } @@ -387,11 +387,11 @@ void Commander::giveNetworkCommand(NetworkCommand* networkCommand) const { { Unit* unit= world->findUnitById(networkCommand->getUnitId()); - //exec ute command, if unit is still alive - if(unit!=NULL) { - switch(networkCommand->getNetworkCommandType()){ + //execute command, if unit is still alive + if(unit != NULL) { + switch(networkCommand->getNetworkCommandType()) { case nctGiveCommand:{ - assert(networkCommand->getCommandTypeId()!=CommandType::invalidId); + assert(networkCommand->getCommandTypeId() != CommandType::invalidId); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] found nctGiveCommand networkCommand->getUnitId() = %d\n",__FILE__,__FUNCTION__,__LINE__,networkCommand->getUnitId()); diff --git a/source/glest_game/network/server_interface.cpp b/source/glest_game/network/server_interface.cpp index e85d499a..e6c6cfc1 100644 --- a/source/glest_game/network/server_interface.cpp +++ b/source/glest_game/network/server_interface.cpp @@ -104,9 +104,12 @@ ServerInterface::~ServerInterface() { delete publishToMasterserverThread; publishToMasterserverThread = NULL; safeMutex.ReleaseLock(); + // This triggers a gameOver message to be sent to the masterserver lastMasterserverHeartbeatTime = 0; - simpleTask(); + if(needToRepublishToMasterserver == true) { + simpleTask(); + } SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); } @@ -1079,9 +1082,11 @@ bool ServerInterface::launchGame(const GameSettings* gameSettings) { publishToMasterserverThread = NULL; lastMasterserverHeartbeatTime = 0; - publishToMasterserverThread = new SimpleTaskThread(this,0,25); - publishToMasterserverThread->setUniqueID(__FILE__); - publishToMasterserverThread->start(); + if(needToRepublishToMasterserver == true) { + publishToMasterserverThread = new SimpleTaskThread(this,0,25); + publishToMasterserverThread->setUniqueID(__FILE__); + publishToMasterserverThread->start(); + } } SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);