summaryrefslogtreecommitdiffstats
path: root/source/cWorld.cpp
diff options
context:
space:
mode:
authoradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-06 10:23:20 +0100
committeradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-06 10:23:20 +0100
commit36f7084e3fb4193676b14f302d0f961f2102e4ba (patch)
treeb2e7d7c7d1854dbe484605b4054e707c0bd09cef /source/cWorld.cpp
parentFinished most of piston class. Pistons should work when a redstone current with wire is lit up or extinguished near them but don't yet. There'sa bug to kill. (diff)
downloadcuberite-36f7084e3fb4193676b14f302d0f961f2102e4ba.tar
cuberite-36f7084e3fb4193676b14f302d0f961f2102e4ba.tar.gz
cuberite-36f7084e3fb4193676b14f302d0f961f2102e4ba.tar.bz2
cuberite-36f7084e3fb4193676b14f302d0f961f2102e4ba.tar.lz
cuberite-36f7084e3fb4193676b14f302d0f961f2102e4ba.tar.xz
cuberite-36f7084e3fb4193676b14f302d0f961f2102e4ba.tar.zst
cuberite-36f7084e3fb4193676b14f302d0f961f2102e4ba.zip
Diffstat (limited to '')
-rw-r--r--source/cWorld.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/source/cWorld.cpp b/source/cWorld.cpp
index c67998064..0601746e8 100644
--- a/source/cWorld.cpp
+++ b/source/cWorld.cpp
@@ -13,6 +13,7 @@
#include "../iniFile/iniFile.h"
#include "cChunkMap.h"
#include "cWaterSimulator.h"
+#include "cLavaSimulator.h"
#include "cChicken.h"
#include "cSpider.h"
#include "cCow.h" //cow
@@ -47,6 +48,8 @@
#include <sys/types.h>
#endif
+
+
float cWorld::m_Time = 0.f;
char g_BlockLightValue[128];
@@ -94,6 +97,7 @@ cWorld::~cWorld()
UnlockEntities();
delete m_WaterSimulator;
+ delete m_LavaSimulator;
UnloadUnusedChunks();
delete m_ChunkMap;
@@ -114,9 +118,9 @@ cWorld::cWorld( const char* a_WorldName )
cMakeDir::MakeDir(m_pState->WorldName.c_str());
srand( (unsigned int) time(0) );
- m_SpawnX = (double)((rand()%10000)-5000);
+ m_SpawnX = (double)((rand()%1000)-500);
m_SpawnY = 128;
- m_SpawnZ = (double)((rand()%10000)-5000);
+ m_SpawnZ = (double)((rand()%1000)-500);
m_WorldSeed = rand();
m_GameMode = 0;
@@ -187,6 +191,7 @@ cWorld::cWorld( const char* a_WorldName )
m_ChunksCriticalSection = new cCriticalSection();
m_WaterSimulator = new cWaterSimulator( this );
+ m_LavaSimulator = new cLavaSimulator( this );
memset( g_BlockLightValue, 0x0, 128 );
memset( g_BlockSpreadLightFalloff, 0xf, 128 ); // 0xf means total falloff
@@ -263,6 +268,8 @@ void cWorld::Tick(float a_Dt)
{
m_Time+=a_Dt/1000.f;
+ CurrentTick++;
+
bool bSendTime = false;
m_WorldTimeFraction+=a_Dt/1000.f;
while( m_WorldTimeFraction > 1.f )
@@ -302,7 +309,10 @@ void cWorld::Tick(float a_Dt)
}
m_ChunkMap->Tick(a_Dt);
- m_WaterSimulator->Simulate(a_Dt);
+ if( CurrentTick % 6 == 0 )
+ m_WaterSimulator->Simulate(a_Dt);
+ if( CurrentTick % 12 == 0 )
+ m_LavaSimulator->Simulate(a_Dt);
UnlockChunks();
if( m_Time - m_LastSave > 60*5 ) // Save each 5 minutes
@@ -499,6 +509,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 );
int ChunkX, ChunkY, ChunkZ;
AbsoluteToRelative( a_X, a_Y, a_Z, ChunkX, ChunkY, ChunkZ );
@@ -556,6 +567,7 @@ bool cWorld::DigBlock( int a_X, int a_Y, int a_Z, cItem & a_PickupItem )
{
DestChunk->SetBlock(PosX, PosY, PosZ, 0, 0 );
m_WaterSimulator->WakeUp( a_X, a_Y, a_Z );
+ m_LavaSimulator->WakeUp( a_X, a_Y, a_Z );
if( !a_PickupItem.IsEmpty() )
{