From 37a53c114a06efec1af61dc00dcfad2c5def1618 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Mon, 14 Oct 2013 02:35:42 +0000 Subject: [PATCH] - attempt to detect oos by adding more crc and log info --- source/glest_game/type_instances/unit.cpp | 3 +++ source/shared_lib/include/util/randomgen.h | 4 ++-- source/shared_lib/sources/util/randomgen.cpp | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 13d5e2de..b47a9f16 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -5223,6 +5223,9 @@ Checksum Unit::getCRC() { //Vec2i currentPathFinderDesiredFinalPos; crcForUnit.addInt(random.getLastNumber()); + if(this->random.getLastCaller() != "") { + crcForUnit.addString(this->random.getLastCaller()); + } if(consoleDebug) printf("#16 Unit: %d CRC: %u\n",id,crcForUnit.getSum()); diff --git a/source/shared_lib/include/util/randomgen.h b/source/shared_lib/include/util/randomgen.h index 848e36c3..40123bd4 100644 --- a/source/shared_lib/include/util/randomgen.h +++ b/source/shared_lib/include/util/randomgen.h @@ -46,8 +46,8 @@ public: void setLastNumber(int value) { lastNumber = value; } std::string getLastCaller() const; - //void clearLastCaller() { lastCaller.clear(); } - void clearLastCaller() { } + void clearLastCaller() { lastCaller.clear(); } + //void clearLastCaller() { } }; }}//end namespace diff --git a/source/shared_lib/sources/util/randomgen.cpp b/source/shared_lib/sources/util/randomgen.cpp index 1e6eb825..31db2f54 100644 --- a/source/shared_lib/sources/util/randomgen.cpp +++ b/source/shared_lib/sources/util/randomgen.cpp @@ -40,6 +40,7 @@ void RandomGen::init(int seed){ } int RandomGen::rand(string lastCaller) { + this->lastCaller.push_back(lastCaller); this->lastNumber = (a*lastNumber + b) % m; return lastNumber; }