From f765ab0880c2f0c9adb03362d77c2a7b487c0d8e Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Thu, 26 Aug 2010 23:04:14 +0000 Subject: [PATCH] - updated game data mismatch display --- .../menu/menu_state_connected_game.cpp | 17 +- source/glest_game/network/network_message.cpp | 152 +++++++++--------- 2 files changed, 84 insertions(+), 85 deletions(-) diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index fa7cd653..a596df9e 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -529,27 +529,21 @@ void MenuStateConnectedGame::update() { if(updateDataSynchDetailText == true && clientInterface->getReceivedDataSynchCheck() && - lastMapDataSynchError != "map CRC mismatch") { - lastMapDataSynchError = "map CRC mismatch"; + lastMapDataSynchError != "map CRC mismatch, " + listBoxMap.getSelectedItem()) { + lastMapDataSynchError = "map CRC mismatch, " + listBoxMap.getSelectedItem(); clientInterface->sendTextMessage(lastMapDataSynchError,-1,true); } } - else { - lastMapDataSynchError = ""; - } if(clientInterface->getNetworkGameDataSynchCheckOkTile() == false) { label = label + " tile"; if(updateDataSynchDetailText == true && clientInterface->getReceivedDataSynchCheck() && - lastTileDataSynchError != "tile CRC mismatch") { - lastTileDataSynchError = "tile CRC mismatch"; + lastTileDataSynchError != "tile CRC mismatch, " + listBoxTileset.getSelectedItem()) { + lastTileDataSynchError = "tile CRC mismatch, " + listBoxTileset.getSelectedItem(); clientInterface->sendTextMessage(lastTileDataSynchError,-1,true); } } - else { - lastTileDataSynchError = ""; - } if(clientInterface->getNetworkGameDataSynchCheckOkTech() == false) { label = label + " techtree"; @@ -572,9 +566,6 @@ void MenuStateConnectedGame::update() { } } } - else { - lastTechtreeDataSynchError = ""; - } if(clientInterface->getReceivedDataSynchCheck() == true) { updateDataSynchDetailText = false; diff --git a/source/glest_game/network/network_message.cpp b/source/glest_game/network/network_message.cpp index da8a946c..4c080930 100644 --- a/source/glest_game/network/network_message.cpp +++ b/source/glest_game/network/network_message.cpp @@ -505,50 +505,54 @@ NetworkMessageSynchNetworkGameData::NetworkMessageSynchNetworkGameData(const Gam string NetworkMessageSynchNetworkGameData::getTechCRCFileMismatchReport(vector > &vctFileList) { string result = "Techtree: [" + data.header.tech.getString() + "] Filecount local: " + intToStr(vctFileList.size()) + " remote: " + intToStr(data.header.techCRCFileCount) + "\n"; - for(int idx = 0; idx < vctFileList.size(); ++idx) { - std::pair &fileInfo = vctFileList[idx]; - bool fileFound = false; - int32 remoteCRC = -1; - for(int j = 0; j < data.header.techCRCFileCount; ++j) { - string networkFile = data.detail.techCRCFileList[j].getString(); - int32 &networkFileCRC = data.detail.techCRCFileCRCList[j]; - if(fileInfo.first == networkFile) { - fileFound = true; - remoteCRC = networkFileCRC; - break; - } - } - - if(fileFound == false) { - result = result + "local file [" + fileInfo.first + "] missing remotely.\n"; - } - else if(fileInfo.second != remoteCRC) { - result = result + "local file [" + fileInfo.first + "] CRC mismatch.\n"; - } + if(vctFileList.size() <= 0) { + result = result + "Local player has no files.\n"; } - - for(int i = 0; i < data.header.techCRCFileCount; ++i) { - string networkFile = data.detail.techCRCFileList[i].getString(); - int32 &networkFileCRC = data.detail.techCRCFileCRCList[i]; - bool fileFound = false; - int32 localCRC = -1; + else { for(int idx = 0; idx < vctFileList.size(); ++idx) { std::pair &fileInfo = vctFileList[idx]; - if(networkFile == fileInfo.first) { - fileFound = true; - localCRC = fileInfo.second; - break; + bool fileFound = false; + int32 remoteCRC = -1; + for(int j = 0; j < data.header.techCRCFileCount; ++j) { + string networkFile = data.detail.techCRCFileList[j].getString(); + int32 &networkFileCRC = data.detail.techCRCFileCRCList[j]; + if(fileInfo.first == networkFile) { + fileFound = true; + remoteCRC = networkFileCRC; + break; + } + } + + if(fileFound == false) { + result = result + "local file [" + fileInfo.first + "] missing remotely.\n"; + } + else if(fileInfo.second != remoteCRC) { + result = result + "local file [" + fileInfo.first + "] CRC mismatch.\n"; } } - if(fileFound == false) { - result = result + "remote file [" + networkFile + "] missing locally.\n"; - } - else if(networkFileCRC != localCRC) { - result = result + "remote file [" + networkFile + "] CRC mismatch.\n"; + for(int i = 0; i < data.header.techCRCFileCount; ++i) { + string networkFile = data.detail.techCRCFileList[i].getString(); + int32 &networkFileCRC = data.detail.techCRCFileCRCList[i]; + bool fileFound = false; + int32 localCRC = -1; + for(int idx = 0; idx < vctFileList.size(); ++idx) { + std::pair &fileInfo = vctFileList[idx]; + if(networkFile == fileInfo.first) { + fileFound = true; + localCRC = fileInfo.second; + break; + } + } + + if(fileFound == false) { + result = result + "remote file [" + networkFile + "] missing locally.\n"; + } + else if(networkFileCRC != localCRC) { + result = result + "remote file [" + networkFile + "] CRC mismatch.\n"; + } } } - return result; } @@ -691,51 +695,55 @@ NetworkMessageSynchNetworkGameDataStatus::NetworkMessageSynchNetworkGameDataStat string NetworkMessageSynchNetworkGameDataStatus::getTechCRCFileMismatchReport(string techtree, vector > &vctFileList) { string result = "Techtree: [" + techtree + "] Filecount local: " + intToStr(vctFileList.size()) + " remote: " + intToStr(data.header.techCRCFileCount) + "\n"; - for(int idx = 0; idx < vctFileList.size(); ++idx) { - std::pair &fileInfo = vctFileList[idx]; - bool fileFound = false; - int32 remoteCRC = -1; - for(int j = 0; j < data.header.techCRCFileCount; ++j) { - string networkFile = data.detail.techCRCFileList[j].getString(); - int32 &networkFileCRC = data.detail.techCRCFileCRCList[j]; - if(fileInfo.first == networkFile) { - fileFound = true; - remoteCRC = networkFileCRC; - break; - } - } - - if(fileFound == false) { - result = result + "local file [" + fileInfo.first + "] missing remotely.\n"; - } - else if(fileInfo.second != remoteCRC) { - result = result + "local file [" + fileInfo.first + "] CRC mismatch.\n"; - } + if(vctFileList.size() <= 0) { + result = result + "Local player has no files.\n"; } - - for(int i = 0; i < data.header.techCRCFileCount; ++i) { - string networkFile = data.detail.techCRCFileList[i].getString(); - int32 &networkFileCRC = data.detail.techCRCFileCRCList[i]; - bool fileFound = false; - int32 localCRC = -1; + else { for(int idx = 0; idx < vctFileList.size(); ++idx) { std::pair &fileInfo = vctFileList[idx]; + bool fileFound = false; + int32 remoteCRC = -1; + for(int j = 0; j < data.header.techCRCFileCount; ++j) { + string networkFile = data.detail.techCRCFileList[j].getString(); + int32 &networkFileCRC = data.detail.techCRCFileCRCList[j]; + if(fileInfo.first == networkFile) { + fileFound = true; + remoteCRC = networkFileCRC; + break; + } + } - if(networkFile == fileInfo.first) { - fileFound = true; - localCRC = fileInfo.second; - break; + if(fileFound == false) { + result = result + "local file [" + fileInfo.first + "] missing remotely.\n"; + } + else if(fileInfo.second != remoteCRC) { + result = result + "local file [" + fileInfo.first + "] CRC mismatch.\n"; } } - if(fileFound == false) { - result = result + "remote file [" + networkFile + "] missing locally.\n"; - } - else if(networkFileCRC != localCRC) { - result = result + "remote file [" + networkFile + "] CRC mismatch.\n"; + for(int i = 0; i < data.header.techCRCFileCount; ++i) { + string networkFile = data.detail.techCRCFileList[i].getString(); + int32 &networkFileCRC = data.detail.techCRCFileCRCList[i]; + bool fileFound = false; + int32 localCRC = -1; + for(int idx = 0; idx < vctFileList.size(); ++idx) { + std::pair &fileInfo = vctFileList[idx]; + + if(networkFile == fileInfo.first) { + fileFound = true; + localCRC = fileInfo.second; + break; + } + } + + if(fileFound == false) { + result = result + "remote file [" + networkFile + "] missing locally.\n"; + } + else if(networkFileCRC != localCRC) { + result = result + "remote file [" + networkFile + "] CRC mismatch.\n"; + } } } - return result; }