1
0

MTRand class is not created in each tick, therefore much improving tick-thread time (now uses ~5 % CPU instead of one full core)

git-svn-id: http://mc-server.googlecode.com/svn/trunk@245 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com
2012-02-08 12:36:54 +00:00
parent c82c636d8c
commit 32880153ab
10 changed files with 156 additions and 71 deletions

View File

@@ -190,7 +190,7 @@ void cChunk::Initialize()
void cChunk::Tick(float a_Dt)
void cChunk::Tick(float a_Dt, MTRand & a_TickRandom)
{
if (m_bCalculateLighting)
{
@@ -356,11 +356,10 @@ void cChunk::Tick(float a_Dt)
};
}
MTRand r1;
// Tick dem blocks
int RandomX = r1.randInt();
int RandomY = r1.randInt();
int RandomZ = r1.randInt();
int RandomX = a_TickRandom.randInt();
int RandomY = a_TickRandom.randInt();
int RandomZ = a_TickRandom.randInt();
for(int i = 0; i < 50; i++)
{
@@ -426,6 +425,10 @@ void cChunk::Tick(float a_Dt)
}
}
char cChunk::GetHeight( int a_X, int a_Z )
{
if( a_X >= 0 && a_X < 16 && a_Z >= 0 && a_Z < 16 )