summaryrefslogtreecommitdiffstats
path: root/source/cWorld.cpp
diff options
context:
space:
mode:
authorlapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-26 21:57:12 +0100
committerlapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-26 21:57:12 +0100
commit9f77572fb0d045229556314ba9d7aa0f52ad5635 (patch)
tree67bf3cfaf013be8566e0d541c1a1b571719816f7 /source/cWorld.cpp
parent- improved ClosestPlayerDetection (Really the closest now ;)) (diff)
downloadcuberite-9f77572fb0d045229556314ba9d7aa0f52ad5635.tar
cuberite-9f77572fb0d045229556314ba9d7aa0f52ad5635.tar.gz
cuberite-9f77572fb0d045229556314ba9d7aa0f52ad5635.tar.bz2
cuberite-9f77572fb0d045229556314ba9d7aa0f52ad5635.tar.lz
cuberite-9f77572fb0d045229556314ba9d7aa0f52ad5635.tar.xz
cuberite-9f77572fb0d045229556314ba9d7aa0f52ad5635.tar.zst
cuberite-9f77572fb0d045229556314ba9d7aa0f52ad5635.zip
Diffstat (limited to '')
-rw-r--r--source/cWorld.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/source/cWorld.cpp b/source/cWorld.cpp
index 382744e43..7b181c982 100644
--- a/source/cWorld.cpp
+++ b/source/cWorld.cpp
@@ -13,8 +13,10 @@
#include "cRoot.h"
#include "../iniFile/iniFile.h"
#include "cChunkMap.h"
+#include "cSimulatorManager.h"
#include "cWaterSimulator.h"
#include "cLavaSimulator.h"
+#include "cSandSimulator.h"
#include "cChicken.h"
#include "cSpider.h"
#include "cCow.h" //cow
@@ -119,6 +121,8 @@ cWorld::~cWorld()
}
UnlockEntities();
+ delete m_SimulatorManager;
+ delete m_SandSimulator;
delete m_WaterSimulator;
delete m_LavaSimulator;
@@ -219,8 +223,20 @@ cWorld::cWorld( const char* a_WorldName )
m_EntitiesCriticalSection = new cCriticalSection();
m_ChunksCriticalSection = new cCriticalSection();
+ //Simulators:
+ m_SimulatorManager = new cSimulatorManager();
+
m_WaterSimulator = new cWaterSimulator( this );
+ m_SimulatorManager->RegisterSimulator(m_WaterSimulator, 6);
+
m_LavaSimulator = new cLavaSimulator( this );
+ m_SimulatorManager->RegisterSimulator(m_LavaSimulator, 12);
+
+ m_SandSimulator = new cSandSimulator(this);
+
+ m_SimulatorManager->RegisterSimulator(m_SandSimulator, 1);
+
+
memset( g_BlockLightValue, 0x0, 128 );
memset( g_BlockSpreadLightFalloff, 0xf, 128 ); // 0xf means total falloff
@@ -407,10 +423,9 @@ void cWorld::Tick(float a_Dt)
}
m_ChunkMap->Tick(a_Dt);
- if( CurrentTick % 6 == 0 )
- m_WaterSimulator->Simulate(a_Dt);
- if( CurrentTick % 12 == 0 )
- m_LavaSimulator->Simulate(a_Dt);
+
+ GetSimulatorManager()->Simulate(a_Dt);
+
UnlockChunks();
MTRand r1;
@@ -700,8 +715,7 @@ cChunk* cWorld::GetChunkOfBlock( int a_X, int a_Y, int a_Z )
void cWorld::SetBlock( int a_X, int a_Y, int a_Z, char a_BlockType, char a_BlockMeta )
{
- m_WaterSimulator->WakeUp( a_X, a_Y, a_Z );
- m_LavaSimulator->WakeUp( a_X, a_Y, a_Z );
+ this->GetSimulatorManager()->WakeUp(a_X, a_Y, a_Z);
int ChunkX, ChunkY, ChunkZ;
AbsoluteToRelative( a_X, a_Y, a_Z, ChunkX, ChunkY, ChunkZ );
@@ -785,8 +799,8 @@ bool cWorld::DigBlock( int a_X, int a_Y, int a_Z, cItem & a_PickupItem )
if(DestChunk)
{
DestChunk->SetBlock(PosX, PosY, PosZ, E_BLOCK_AIR, 0 );
- m_WaterSimulator->WakeUp( a_X, a_Y, a_Z );
- m_LavaSimulator->WakeUp( a_X, a_Y, a_Z );
+
+ GetSimulatorManager()->WakeUp(a_X, a_Y, a_Z);
if( !a_PickupItem.IsEmpty() )
{