Core: Fix the SFMT randgen-initbug
Signed-off-by: click <[email protected]>
This commit is contained in:
@@ -31,6 +31,11 @@
|
||||
typedef ACE_TSS<SFMTRand> SFMTRandTSS;
|
||||
static SFMTRandTSS sfmtRand;
|
||||
|
||||
void init_sfmt()
|
||||
{
|
||||
sfmtRand->RandomInit((int)(time(0)));
|
||||
}
|
||||
|
||||
int32 irand(int32 min, int32 max)
|
||||
{
|
||||
return int32(sfmtRand->IRandom(min, max));
|
||||
|
||||
@@ -24,6 +24,11 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifdef USE_SFMT_FOR_RNG
|
||||
// Initialize SFMT before first use, if enabled.
|
||||
void init_sfmt();
|
||||
#endif
|
||||
|
||||
// Searcher for map of structs
|
||||
template<typename T, class S> struct Finder
|
||||
{
|
||||
|
||||
@@ -139,7 +139,9 @@ int Master::Run()
|
||||
#ifdef USE_SFMT_FOR_RNG
|
||||
sLog->outString("\n");
|
||||
sLog->outString("SFMT has been enabled as the random number generator, if worldserver");
|
||||
sLog->outString("freezes or crashes randomly, first, try disabling SFMT in CMAKE configuration");
|
||||
sLog->outString("freezes or crashes randomly, first, try disabling SFMT in CMAKE configuration.");
|
||||
sLog->outString("Initializing SFMT before first use.");
|
||||
init_sfmt();
|
||||
sLog->outString("\n");
|
||||
#endif //USE_SFMT_FOR_RNG
|
||||
|
||||
|
||||
Reference in New Issue
Block a user