* Remove support for map-based random number generation (which seems unused).
* Re-add in support for the old mersenne twister for those whose processors don't support SSE2. * Toggling whether or not you are using SFMT is as easy as checking a CMake flag, USE_SFMT, which defaults to 0. --HG-- branch : trunk
This commit is contained in:
@@ -98,6 +98,7 @@ set(game_STAT_SRCS
|
||||
|
||||
include_directories(
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/dep/mersennetwister
|
||||
${CMAKE_SOURCE_DIR}/dep/SFMT
|
||||
${CMAKE_SOURCE_DIR}/dep/zlib
|
||||
${CMAKE_SOURCE_DIR}/src/server/collision
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "SharedDefines.h"
|
||||
#include "GridRefManager.h"
|
||||
#include "MapRefManager.h"
|
||||
#include "SFMT.h"
|
||||
|
||||
#include <bitset>
|
||||
#include <list>
|
||||
@@ -426,15 +425,6 @@ class Map : public GridRefManager<NGridType>
|
||||
|
||||
void UpdateIteratorBack(Player *player);
|
||||
|
||||
#ifdef MAP_BASED_RAND_GEN
|
||||
SFMTRand sfmtRand;
|
||||
int32 irand(int32 min, int32 max) { return int32(sfmtRand.IRandom(min, max)); }
|
||||
uint32 urand(uint32 min, uint32 max) { return uint32(sfmtRand.URandom(min, max)); }
|
||||
int32 rand32() { return int32(sfmtRand.BRandom()); }
|
||||
double rand_norm() { return sfmtRand.Random(); }
|
||||
double rand_chance() { return sfmtRand.Random() * 100.0; }
|
||||
#endif // MAP_BASED_RAND_GEN
|
||||
|
||||
TempSummon *SummonCreature(uint32 entry, const Position &pos, SummonPropertiesEntry const *properties = NULL, uint32 duration = 0, Unit *summoner = NULL, uint32 vehId = 0);
|
||||
Creature* GetCreature(uint64 guid);
|
||||
GameObject* GetGameObject(uint64 guid);
|
||||
|
||||
@@ -53,6 +53,7 @@ message("-- Added Script Library to SCRIPTS lib")
|
||||
include_directories(
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/dep/SFMT
|
||||
${CMAKE_SOURCE_DIR}/dep/mersennetwister
|
||||
${CMAKE_SOURCE_DIR}/dep/zlib
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared/Configuration
|
||||
|
||||
@@ -53,6 +53,7 @@ set(shared_STAT_SRCS
|
||||
include_directories(
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/dep/SFMT
|
||||
${CMAKE_SOURCE_DIR}/dep/mersennetwister
|
||||
${CMAKE_SOURCE_DIR}/dep/sockets/include
|
||||
${CMAKE_SOURCE_DIR}/dep/utf8cpp
|
||||
${CMAKE_SOURCE_DIR}/src/server
|
||||
|
||||
@@ -22,9 +22,14 @@
|
||||
|
||||
#include "socket_include.h"
|
||||
#include "utf8.h"
|
||||
#ifdef USE_SFMT_FOR_RNG
|
||||
#include "SFMT.h"
|
||||
#else
|
||||
#include "MersenneTwister.h"
|
||||
#endif
|
||||
#include <ace/TSS_T.h>
|
||||
|
||||
#ifdef USE_SFMT_FOR_RNG
|
||||
typedef ACE_TSS<SFMTRand> SFMTRandTSS;
|
||||
static SFMTRandTSS sfmtRand;
|
||||
|
||||
@@ -52,6 +57,35 @@ double rand_chance (void)
|
||||
{
|
||||
return sfmtRand->Random() * 100.0;
|
||||
}
|
||||
#else
|
||||
typedef ACE_TSS<MTRand> MTRandTSS;
|
||||
static MTRandTSS 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);
|
||||
}
|
||||
#endif
|
||||
|
||||
Tokens StrSplit(const std::string &src, const std::string &sep)
|
||||
{
|
||||
|
||||
@@ -47,6 +47,7 @@ include_directories(
|
||||
${CMAKE_SOURCE_DIR}/dep/gsoap
|
||||
${CMAKE_SOURCE_DIR}/dep/sockets/include
|
||||
${CMAKE_SOURCE_DIR}/dep/SFMT
|
||||
${CMAKE_SOURCE_DIR}/dep/mersennetwister
|
||||
${CMAKE_SOURCE_DIR}/src/server/collision
|
||||
${CMAKE_SOURCE_DIR}/src/server/collision/Management
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared
|
||||
|
||||
Reference in New Issue
Block a user