From fb276d1dd75b8ec8d7ea92702525ca96f6ed867e Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Thu, 17 Oct 2013 02:49:25 +0000 Subject: [PATCH] - added more crc logging to detect oos location --- source/glest_game/type_instances/faction.cpp | 1 + source/glest_game/type_instances/unit.cpp | 4 +++- source/shared_lib/include/util/randomgen.h | 1 + source/shared_lib/sources/util/randomgen.cpp | 6 ++++-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/source/glest_game/type_instances/faction.cpp b/source/glest_game/type_instances/faction.cpp index 721c77228..1bd8e4d69 100644 --- a/source/glest_game/type_instances/faction.cpp +++ b/source/glest_game/type_instances/faction.cpp @@ -2320,6 +2320,7 @@ void Faction::addCRC_DetailsForWorldFrame(int worldFrameCount,bool isNetworkServ for(unsigned int i = 0; i < units.size(); ++i) { Unit *unit = units[i]; + unit->getRandom()->clearLastCaller(); unit->clearNetworkCRCDecHpList(); } diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index b47a9f16d..36f7cf788 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -4242,7 +4242,9 @@ std::string Unit::toString(bool crcMode) const { result += "inBailOutAttempt = " + intToStr(inBailOutAttempt) + "\n"; result += "random = " + intToStr(random.getLastNumber()) + "\n"; - result += "randomlastCaller = " + random.getLastCaller() + "\n"; + if(this->random.getLastCaller() != "") { + result += "randomlastCaller = " + random.getLastCaller() + "\n"; + } result += "pathFindRefreshCellCount = " + intToStr(pathFindRefreshCellCount) + "\n"; result += "lastStuckFrame = " + uIntToStr(lastStuckFrame) + "\n"; diff --git a/source/shared_lib/include/util/randomgen.h b/source/shared_lib/include/util/randomgen.h index 40123bd4e..406d61573 100644 --- a/source/shared_lib/include/util/randomgen.h +++ b/source/shared_lib/include/util/randomgen.h @@ -48,6 +48,7 @@ public: std::string getLastCaller() const; void clearLastCaller() { lastCaller.clear(); } //void clearLastCaller() { } + void addLastCaller(std::string text) { lastCaller.push_back(text); } }; }}//end namespace diff --git a/source/shared_lib/sources/util/randomgen.cpp b/source/shared_lib/sources/util/randomgen.cpp index 31db2f54d..88f885137 100644 --- a/source/shared_lib/sources/util/randomgen.cpp +++ b/source/shared_lib/sources/util/randomgen.cpp @@ -40,7 +40,9 @@ void RandomGen::init(int seed){ } int RandomGen::rand(string lastCaller) { - this->lastCaller.push_back(lastCaller); + if(lastCaller != "") { + this->lastCaller.push_back(lastCaller); + } this->lastNumber = (a*lastNumber + b) % m; return lastNumber; } @@ -49,7 +51,7 @@ std::string RandomGen::getLastCaller() const { std::string result = ""; if(lastCaller.empty() == false) { for(unsigned int index = 0; index < lastCaller.size(); ++index) { - result += lastCaller[index] + " "; + result += lastCaller[index] + "|"; } } return result;