Changed: #1328 Map time and weather Issue (patch provided by Sywindt)

This commit is contained in:
kervala 2011-10-29 15:34:04 +02:00
parent b4fc34dacd
commit 9e6dc300e0

View file

@ -18,7 +18,7 @@
#include "nel/misc/noise_value.h" #include "nel/misc/noise_value.h"
#include "nel/misc/fast_floor.h" #include "nel/misc/fast_floor.h"
#include "nel/misc/random.h"
namespace NLMISC namespace NLMISC
@ -45,7 +45,8 @@ public:
CRandomGrid3D() CRandomGrid3D()
{ {
//seed //seed
srand(0); CRandom Random;
Random.srand(0);
// init the grid // init the grid
for(uint z=0; z<NL3D_NOISE_GRID_SIZE; z++) for(uint z=0; z<NL3D_NOISE_GRID_SIZE; z++)
@ -56,7 +57,7 @@ public:
{ {
uint id= x + (y<<NL3D_NOISE_GRID_SIZE_SHIFT) + (z<<(NL3D_NOISE_GRID_SIZE_SHIFT*2)); uint id= x + (y<<NL3D_NOISE_GRID_SIZE_SHIFT) + (z<<(NL3D_NOISE_GRID_SIZE_SHIFT*2));
// take higher bits of rand gives better result. // take higher bits of rand gives better result.
uint v= rand() >> 5; uint v= Random.rand() >> 5;
_Texture3d[id]= v&255; _Texture3d[id]= v&255;
} }
} }
@ -80,9 +81,9 @@ public:
// init LevelPhases. // init LevelPhases.
for(i=0; i<NL3D_NOISE_LEVEL; i++) for(i=0; i<NL3D_NOISE_LEVEL; i++)
{ {
_LevelPhase[i].x= frand(NL3D_NOISE_GRID_SIZE); _LevelPhase[i].x= Random.frand(NL3D_NOISE_GRID_SIZE);
_LevelPhase[i].y= frand(NL3D_NOISE_GRID_SIZE); _LevelPhase[i].y= Random.frand(NL3D_NOISE_GRID_SIZE);
_LevelPhase[i].z= frand(NL3D_NOISE_GRID_SIZE); _LevelPhase[i].z= Random.frand(NL3D_NOISE_GRID_SIZE);
} }
// not for level 0. // not for level 0.
_LevelPhase[0]= CVector::Null; _LevelPhase[0]= CVector::Null;