- 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.

This commit is contained in:
Mark Vejvoda 2011-01-25 00:54:37 +00:00
parent ed90d620b3
commit 4670935fd0
1 changed files with 7 additions and 2 deletions

View File

@ -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);
}