From 4670935fd0158d2303cc7bc5c908391afdd312a6 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Tue, 25 Jan 2011 00:54:37 +0000 Subject: [PATCH] - added a new check is there is a connection lost during command execution we now display a Connection Lost error along with possible out of synch. --- source/glest_game/game/commander.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/glest_game/game/commander.cpp b/source/glest_game/game/commander.cpp index f2d8ae2b..214ddc96 100644 --- a/source/glest_game/game/commander.cpp +++ b/source/glest_game/game/commander.cpp @@ -662,9 +662,14 @@ Command* Commander::buildCommand(const NetworkCommand* networkCommand) const { std::string worldLog = world->DumpWorldToLog(); GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface(); - if(gameNetworkInterface != NULL) { + if(gameNetworkInterface != NULL && gameNetworkInterface->isConnected() == true) { char szMsg[1024]=""; - sprintf(szMsg,"Player detected an error: Unit / Faction mismatch for unitId: %d, Local faction index = %d, remote index = %d. Game out of synch.",networkCommand->getUnitId(),unit->getFaction()->getIndex(),networkCommand->getUnitFactionIndex()); + sprintf(szMsg,"Player detected an error: Unit / Faction mismatch for unitId: %d\nLocal faction index = %d, remote index = %d. Game out of synch.",networkCommand->getUnitId(),unit->getFaction()->getIndex(),networkCommand->getUnitFactionIndex()); + gameNetworkInterface->sendTextMessage(szMsg,-1, true); + } + else { + char szMsg[1024]=""; + sprintf(szMsg,"Player detected an error: Connection lost, possible Unit / Faction mismatch for unitId: %d\nLocal faction index = %d, remote index = %d. Game out of synch.",networkCommand->getUnitId(),unit->getFaction()->getIndex(),networkCommand->getUnitFactionIndex()); gameNetworkInterface->sendTextMessage(szMsg,-1, true); }