diff --git a/source/glest_game/network/client_interface.cpp b/source/glest_game/network/client_interface.cpp index b30b70c76..75b482340 100755 --- a/source/glest_game/network/client_interface.cpp +++ b/source/glest_game/network/client_interface.cpp @@ -655,7 +655,7 @@ void ClientInterface::waitUntilReady(Checksum* checksum) { } //delay the start a bit, so clients have more room to get messages - sleep(GameConstants::networkExtraLatency); + //sleep(GameConstants::networkExtraLatency); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] END\n",__FILE__,__FUNCTION__); } diff --git a/source/shared_lib/sources/util/randomgen.cpp b/source/shared_lib/sources/util/randomgen.cpp index 4e2832c56..43489982c 100644 --- a/source/shared_lib/sources/util/randomgen.cpp +++ b/source/shared_lib/sources/util/randomgen.cpp @@ -1,6 +1,7 @@ #include "randomgen.h" #include #include "util.h" +#include "math_wrapper.h" #include "leak_dumper.h" namespace Shared { namespace Util { @@ -14,15 +15,19 @@ const int RandomGen::a= 1366; const int RandomGen::b= 150889; RandomGen::RandomGen(){ - lastNumber= 0; +#ifdef USE_STREFLOP + lastNumber = streflop::RandomInit(0); // streflop +#else + lastNumber= 0; +#endif //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] lastNumber = %d\n",__FILE__,__FUNCTION__,__LINE__,lastNumber); } void RandomGen::init(int seed){ -#ifdef STREFLOP_H - lastNumber = math::RandomInit(seed); // streflop +#ifdef USE_STREFLOP + lastNumber = streflop::RandomInit(seed); // streflop #else lastNumber= seed % m; #endif @@ -33,7 +38,7 @@ void RandomGen::init(int seed){ int RandomGen::rand() { //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] lastNumber = %d\n",__FILE__,__FUNCTION__,__LINE__,lastNumber); - lastNumber= (a*lastNumber + b) % m; + lastNumber= ((a*lastNumber) + b) % m; //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] lastNumber = %d\n",__FILE__,__FUNCTION__,__LINE__,lastNumber); @@ -43,11 +48,11 @@ int RandomGen::rand() { int RandomGen::randRange(int min, int max){ assert(min<=max); -#ifdef STREFLOP_H - int res = math::Random(min, max); // streflop +#ifdef USE_STREFLOP + int res = streflop::Random(min, max); // streflop #else int diff= max-min; - int res= min + static_cast(static_cast(diff+1)*RandomGen::rand() / m); + int res= min + static_cast((static_cast(diff+1)*RandomGen::rand()) / m); #endif assert(res>=min && res<=max); @@ -59,11 +64,11 @@ int RandomGen::randRange(int min, int max){ float RandomGen::randRange(float min, float max){ assert(min<=max); -#ifdef STREFLOP_H - float res = math::Random(min, max); // streflop +#ifdef USE_STREFLOP + float res = streflop::Random(min, max); // streflop #else float rand01= static_cast(RandomGen::rand())/(m-1); - float res= min+(max-min)*rand01; + float res= min+((max-min)*rand01); #endif assert(res>=min && res<=max);