From c66877019ee228193b9d68c6e8b886d5ffa1d9d5 Mon Sep 17 00:00:00 2001 From: raczman Date: Fri, 15 May 2009 22:41:13 +0200 Subject: Added MTRand object to Map class. This is first step of getting rid of static MTRandTSS object. --HG-- branch : trunk --- src/game/Map.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src') diff --git a/src/game/Map.h b/src/game/Map.h index f117a1c1cec..334a61cd2ff 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -33,6 +33,7 @@ #include "SharedDefines.h" #include "GameSystem/GridRefManager.h" #include "MapRefManager.h" +#include "mersennetwister/MersenneTwister.h" #include #include @@ -278,6 +279,33 @@ class TRINITY_DLL_SPEC Map : public GridRefManager, public Trinity::O template void VisitWorld(const float &x, const float &y, float radius, NOTIFIER ¬ifier); template void VisitGrid(const float &x, const float &y, float radius, NOTIFIER ¬ifier); CreatureGroupHolderType CreatureGroupHolder; + MTRand mtRand; + + int32 irand(int32 min, int32 max) + { + return int32 (mtRand.randInt(max - min)) + min; + } + + uint32 urand(uint32 min, uint32 max) + { + return mtRand.randInt(max - min) + min; + } + + int32 rand32() + { + return mtRand.randInt(); + } + + double rand_norm(void) + { + return mtRand.randExc(); + } + + double rand_chance(void) + { + return mtRand.randExc(100.0); + } + private: void LoadVMap(int pX, int pY); void LoadMap(uint32 mapid, uint32 instanceid, int x,int y); -- cgit v1.2.3