summaryrefslogtreecommitdiffstats
path: root/source/cWorldGenerator.cpp
diff options
context:
space:
mode:
authormtilden@gmail.com <mtilden@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-26 10:09:47 +0100
committermtilden@gmail.com <mtilden@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-26 10:09:47 +0100
commitc7fa610be3b6e072d3da4611f6de72390ebbf446 (patch)
treeeaa1e1d08d9136c78228ec067f4d41b1d33ef320 /source/cWorldGenerator.cpp
parent - Added timer to cPlayer PlayerListItem because sending the packets like minecraft does (every tick per player) is 20 pps per client to each client and was causing Kicks for having too high of a packet queue (diff)
downloadcuberite-c7fa610be3b6e072d3da4611f6de72390ebbf446.tar
cuberite-c7fa610be3b6e072d3da4611f6de72390ebbf446.tar.gz
cuberite-c7fa610be3b6e072d3da4611f6de72390ebbf446.tar.bz2
cuberite-c7fa610be3b6e072d3da4611f6de72390ebbf446.tar.lz
cuberite-c7fa610be3b6e072d3da4611f6de72390ebbf446.tar.xz
cuberite-c7fa610be3b6e072d3da4611f6de72390ebbf446.tar.zst
cuberite-c7fa610be3b6e072d3da4611f6de72390ebbf446.zip
Diffstat (limited to 'source/cWorldGenerator.cpp')
-rw-r--r--source/cWorldGenerator.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/source/cWorldGenerator.cpp b/source/cWorldGenerator.cpp
index f07f5f791..b4291ddb0 100644
--- a/source/cWorldGenerator.cpp
+++ b/source/cWorldGenerator.cpp
@@ -3,6 +3,7 @@
#include "cWorld.h"
#include "cChunk.h"
#include "cGenSettings.h"
+#include "MersenneTwister.h"
#include "BlockID.h"
#include "Vector3i.h"
@@ -205,7 +206,7 @@ void cWorldGenerator::GenerateFoliage( cChunk* a_Chunk )
BlockType[ index ] = (char)GrassID;
}
-
+ MTRand r1;
// Plant sum trees
{
int xx = x + PosX*16;
@@ -215,10 +216,10 @@ void cWorldGenerator::GenerateFoliage( cChunk* a_Chunk )
float val2 = m_Noise.CubicNoise2D( xx*0.01f, zz*0.01f );
if( BlockType[index] == SandID )
{
- if( (val1 + val2 > 0.f) && (rand()%128) > 124 && BlockType[index] == E_BLOCK_SAND )
+ if( (val1 + val2 > 0.f) && (r1.randInt()%128) > 124 && BlockType[index] == E_BLOCK_SAND )
{
BlockType[ cChunk::MakeIndex(x, TopY+1, z) ] = E_BLOCK_CACTUS;
- if( (rand() & 3) == 3 )
+ if( (r1.randInt() & 3) == 3 )
{
BlockType[ cChunk::MakeIndex(x, TopY+2, z) ] = E_BLOCK_CACTUS;
}
@@ -229,15 +230,15 @@ void cWorldGenerator::GenerateFoliage( cChunk* a_Chunk )
{
float val3 = m_Noise.CubicNoise2D( xx*0.01f+10, zz*0.01f+10 );
float val4 = m_Noise.CubicNoise2D( xx*0.05f+20, zz*0.05f+20 );
- if( val1 + val2 > 0.2f && (rand()%128) > 124 )
+ if( val1 + val2 > 0.2f && (r1.randInt()%128) > 124 )
World->GrowTree( xx, TopY, zz );
- else if( val3 > 0.2f && (rand()%128) > 124 )
+ else if( val3 > 0.2f && (r1.randInt()%128) > 124 )
BlockType[ cChunk::MakeIndex(x, TopY+1, z) ] = E_BLOCK_YELLOW_FLOWER;
- else if( val4 > 0.2f && (rand()%128) > 124 )
+ else if( val4 > 0.2f && (r1.randInt()%128) > 124 )
BlockType[ cChunk::MakeIndex(x, TopY+1, z) ] = E_BLOCK_RED_ROSE;
- else if( val1+val2+val3+val4 > 0.2f && (rand()%128) > 124 )
+ else if( val1+val2+val3+val4 > 0.2f && (r1.randInt()%128) > 124 )
BlockType[ cChunk::MakeIndex(x, TopY+1, z) ] = E_BLOCK_RED_MUSHROOM;
- else if( val1+val2+val3+val4 > 0.2f && (rand()%128) > 124 )
+ else if( val1+val2+val3+val4 > 0.2f && (r1.randInt()%128) > 124 )
BlockType[ cChunk::MakeIndex(x, TopY+1, z) ] = E_BLOCK_BROWN_MUSHROOM;
}
}