From 43e684071933adef93040e8d4b830d5c6b71cf9a Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sat, 12 Jan 2013 04:46:01 +0000 Subject: Merged branch "branches/hooks" into "trunk". git-svn-id: http://mc-server.googlecode.com/svn/trunk@1139 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/World.cpp | 82 +++++++++++++++++++++++++------------------------------- 1 file changed, 36 insertions(+), 46 deletions(-) (limited to 'source/World.cpp') diff --git a/source/World.cpp b/source/World.cpp index 6eaf7a279..084bf8cd2 100644 --- a/source/World.cpp +++ b/source/World.cpp @@ -174,50 +174,6 @@ protected: /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // cWorld: -cWorld* cWorld::GetWorld() -{ - LOGWARN("WARNING: Using deprecated function cWorld::GetWorld() use cRoot::Get()->GetDefaultWorld() instead!"); - return cRoot::Get()->GetDefaultWorld(); -} - - - - - -cWorld::~cWorld() -{ - { - cCSLock Lock(m_CSEntities); - while( m_AllEntities.begin() != m_AllEntities.end() ) - { - cEntity* Entity = *m_AllEntities.begin(); - m_AllEntities.remove( Entity ); - if ( !Entity->IsDestroyed() ) - { - Entity->Destroy(); - } - delete Entity; - } - } - - delete m_SimulatorManager; - delete m_SandSimulator; - delete m_WaterSimulator; - delete m_LavaSimulator; - delete m_FireSimulator; - delete m_RedstoneSimulator; - - UnloadUnusedChunks(); - - m_Storage.WaitForFinish(); - - delete m_ChunkMap; -} - - - - - cWorld::cWorld(const AString & a_WorldName) : m_WorldAgeSecs(0), m_TimeOfDaySecs(0), @@ -317,6 +273,40 @@ cWorld::cWorld(const AString & a_WorldName) : +cWorld::~cWorld() +{ + { + cCSLock Lock(m_CSEntities); + while( m_AllEntities.begin() != m_AllEntities.end() ) + { + cEntity* Entity = *m_AllEntities.begin(); + m_AllEntities.remove( Entity ); + if ( !Entity->IsDestroyed() ) + { + Entity->Destroy(); + } + delete Entity; + } + } + + delete m_SimulatorManager; + delete m_SandSimulator; + delete m_WaterSimulator; + delete m_LavaSimulator; + delete m_FireSimulator; + delete m_RedstoneSimulator; + + UnloadUnusedChunks(); + + m_Storage.WaitForFinish(); + + delete m_ChunkMap; +} + + + + + void cWorld::SetWeather(eWeather a_Weather) { switch (a_Weather) @@ -1064,14 +1054,14 @@ int cWorld::GetBiomeAt (int a_BlockX, int a_BlockZ) void cWorld::SetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) { - if(a_BlockType == E_BLOCK_AIR) + if (a_BlockType == E_BLOCK_AIR) { BlockHandler(GetBlock(a_BlockX, a_BlockY, a_BlockZ))->OnDestroyed(this, a_BlockX, a_BlockY, a_BlockZ); } m_ChunkMap->SetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta); GetSimulatorManager()->WakeUp(a_BlockX, a_BlockY, a_BlockZ); - BlockHandler(a_BlockType)->OnPlaced(this, a_BlockX, a_BlockY, a_BlockZ, a_BlockMeta); + BlockHandler(a_BlockType)->OnPlaced(this, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta); } -- cgit v1.2.3