- updated game data mismatch display

This commit is contained in:
Mark Vejvoda 2010-08-26 23:04:14 +00:00
parent 8884c32e78
commit f765ab0880
2 changed files with 84 additions and 85 deletions

View File

@ -529,27 +529,21 @@ void MenuStateConnectedGame::update() {
if(updateDataSynchDetailText == true && if(updateDataSynchDetailText == true &&
clientInterface->getReceivedDataSynchCheck() && clientInterface->getReceivedDataSynchCheck() &&
lastMapDataSynchError != "map CRC mismatch") { lastMapDataSynchError != "map CRC mismatch, " + listBoxMap.getSelectedItem()) {
lastMapDataSynchError = "map CRC mismatch"; lastMapDataSynchError = "map CRC mismatch, " + listBoxMap.getSelectedItem();
clientInterface->sendTextMessage(lastMapDataSynchError,-1,true); clientInterface->sendTextMessage(lastMapDataSynchError,-1,true);
} }
} }
else {
lastMapDataSynchError = "";
}
if(clientInterface->getNetworkGameDataSynchCheckOkTile() == false) { if(clientInterface->getNetworkGameDataSynchCheckOkTile() == false) {
label = label + " tile"; label = label + " tile";
if(updateDataSynchDetailText == true && if(updateDataSynchDetailText == true &&
clientInterface->getReceivedDataSynchCheck() && clientInterface->getReceivedDataSynchCheck() &&
lastTileDataSynchError != "tile CRC mismatch") { lastTileDataSynchError != "tile CRC mismatch, " + listBoxTileset.getSelectedItem()) {
lastTileDataSynchError = "tile CRC mismatch"; lastTileDataSynchError = "tile CRC mismatch, " + listBoxTileset.getSelectedItem();
clientInterface->sendTextMessage(lastTileDataSynchError,-1,true); clientInterface->sendTextMessage(lastTileDataSynchError,-1,true);
} }
} }
else {
lastTileDataSynchError = "";
}
if(clientInterface->getNetworkGameDataSynchCheckOkTech() == false) { if(clientInterface->getNetworkGameDataSynchCheckOkTech() == false) {
label = label + " techtree"; label = label + " techtree";
@ -572,9 +566,6 @@ void MenuStateConnectedGame::update() {
} }
} }
} }
else {
lastTechtreeDataSynchError = "";
}
if(clientInterface->getReceivedDataSynchCheck() == true) { if(clientInterface->getReceivedDataSynchCheck() == true) {
updateDataSynchDetailText = false; updateDataSynchDetailText = false;

View File

@ -505,50 +505,54 @@ NetworkMessageSynchNetworkGameData::NetworkMessageSynchNetworkGameData(const Gam
string NetworkMessageSynchNetworkGameData::getTechCRCFileMismatchReport(vector<std::pair<string,int32> > &vctFileList) { string NetworkMessageSynchNetworkGameData::getTechCRCFileMismatchReport(vector<std::pair<string,int32> > &vctFileList) {
string result = "Techtree: [" + data.header.tech.getString() + "] Filecount local: " + intToStr(vctFileList.size()) + " remote: " + intToStr(data.header.techCRCFileCount) + "\n"; 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) { if(vctFileList.size() <= 0) {
std::pair<string,int32> &fileInfo = vctFileList[idx]; result = result + "Local player has no files.\n";
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";
}
} }
else {
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) { for(int idx = 0; idx < vctFileList.size(); ++idx) {
std::pair<string,int32> &fileInfo = vctFileList[idx]; std::pair<string,int32> &fileInfo = vctFileList[idx];
if(networkFile == fileInfo.first) { bool fileFound = false;
fileFound = true; int32 remoteCRC = -1;
localCRC = fileInfo.second; for(int j = 0; j < data.header.techCRCFileCount; ++j) {
break; 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) { for(int i = 0; i < data.header.techCRCFileCount; ++i) {
result = result + "remote file [" + networkFile + "] missing locally.\n"; string networkFile = data.detail.techCRCFileList[i].getString();
} int32 &networkFileCRC = data.detail.techCRCFileCRCList[i];
else if(networkFileCRC != localCRC) { bool fileFound = false;
result = result + "remote file [" + networkFile + "] CRC mismatch.\n"; int32 localCRC = -1;
for(int idx = 0; idx < vctFileList.size(); ++idx) {
std::pair<string,int32> &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; return result;
} }
@ -691,51 +695,55 @@ NetworkMessageSynchNetworkGameDataStatus::NetworkMessageSynchNetworkGameDataStat
string NetworkMessageSynchNetworkGameDataStatus::getTechCRCFileMismatchReport(string techtree, vector<std::pair<string,int32> > &vctFileList) { string NetworkMessageSynchNetworkGameDataStatus::getTechCRCFileMismatchReport(string techtree, vector<std::pair<string,int32> > &vctFileList) {
string result = "Techtree: [" + techtree + "] Filecount local: " + intToStr(vctFileList.size()) + " remote: " + intToStr(data.header.techCRCFileCount) + "\n"; string result = "Techtree: [" + techtree + "] Filecount local: " + intToStr(vctFileList.size()) + " remote: " + intToStr(data.header.techCRCFileCount) + "\n";
for(int idx = 0; idx < vctFileList.size(); ++idx) { if(vctFileList.size() <= 0) {
std::pair<string,int32> &fileInfo = vctFileList[idx]; result = result + "Local player has no files.\n";
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";
}
} }
else {
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) { for(int idx = 0; idx < vctFileList.size(); ++idx) {
std::pair<string,int32> &fileInfo = vctFileList[idx]; std::pair<string,int32> &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) { if(fileFound == false) {
fileFound = true; result = result + "local file [" + fileInfo.first + "] missing remotely.\n";
localCRC = fileInfo.second; }
break; else if(fileInfo.second != remoteCRC) {
result = result + "local file [" + fileInfo.first + "] CRC mismatch.\n";
} }
} }
if(fileFound == false) { for(int i = 0; i < data.header.techCRCFileCount; ++i) {
result = result + "remote file [" + networkFile + "] missing locally.\n"; string networkFile = data.detail.techCRCFileList[i].getString();
} int32 &networkFileCRC = data.detail.techCRCFileCRCList[i];
else if(networkFileCRC != localCRC) { bool fileFound = false;
result = result + "remote file [" + networkFile + "] CRC mismatch.\n"; int32 localCRC = -1;
for(int idx = 0; idx < vctFileList.size(); ++idx) {
std::pair<string,int32> &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; return result;
} }