From 41a38e8d9098d6627cd26351577cf032e6996c87 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 14 Oct 2012 18:30:16 +0000 Subject: Floody fluid simulator now dries up correctly, too. git-svn-id: http://mc-server.googlecode.com/svn/trunk@964 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/ChunkMap.cpp | 79 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 49 insertions(+), 30 deletions(-) (limited to 'source/ChunkMap.cpp') diff --git a/source/ChunkMap.cpp b/source/ChunkMap.cpp index 671eac708..a616cf63d 100644 --- a/source/ChunkMap.cpp +++ b/source/ChunkMap.cpp @@ -898,18 +898,19 @@ BLOCKTYPE cChunkMap::GetBlockSkyLight(int a_X, int a_Y, int a_Z) -void cChunkMap::SetBlockMeta(int a_X, int a_Y, int a_Z, NIBBLETYPE a_BlockMeta) +void cChunkMap::SetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_BlockMeta) { int ChunkX, ChunkZ; - cChunkDef::AbsoluteToRelative( a_X, a_Y, a_Z, ChunkX, ChunkZ ); + cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); + // a_BlockXYZ now contains relative coords! cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ ); - if ((Chunk != NULL) && Chunk->IsValid() ) + cChunkPtr Chunk = GetChunk(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if ((Chunk != NULL) && Chunk->IsValid()) { - Chunk->SetMeta(a_X, a_Y, a_Z, a_BlockMeta); + Chunk->SetMeta(a_BlockX, a_BlockY, a_BlockZ, a_BlockMeta); Chunk->MarkDirty(); - Chunk->SendBlockTo( a_X, a_Y, a_Z, NULL ); + Chunk->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, NULL); } } @@ -1657,6 +1658,48 @@ void cChunkMap::SaveAllChunks(void) +int cChunkMap::GetNumChunks(void) +{ + cCSLock Lock(m_CSLayers); + int NumChunks = 0; + for (cChunkLayerList::iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) + { + NumChunks += (*itr)->GetNumChunksLoaded(); + } + return NumChunks; +} + + + + + +void cChunkMap::ChunkValidated(void) +{ + m_evtChunkValid.Set(); +} + + + + + +void cChunkMap::CheckBlock(int a_BlockX, int a_BlockY, int a_BlockZ) +{ + int ChunkX, ChunkZ; + cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); + // a_BlockXYZ now contains relative coords! + + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if (Chunk != NULL) + { + Chunk->CheckBlock(a_BlockX, a_BlockY, a_BlockZ); + } +} + + + + + //////////////////////////////////////////////////////////////////////////////// // cChunkMap::cChunkLayer: @@ -1817,30 +1860,6 @@ void cChunkMap::cChunkLayer::UnloadUnusedChunks(void) -int cChunkMap::GetNumChunks(void) -{ - cCSLock Lock(m_CSLayers); - int NumChunks = 0; - for (cChunkLayerList::iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) - { - NumChunks += (*itr)->GetNumChunksLoaded(); - } - return NumChunks; -} - - - - - -void cChunkMap::ChunkValidated(void) -{ - m_evtChunkValid.Set(); -} - - - - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // cChunkStay: -- cgit v1.2.3