diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-10-14 20:30:16 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-10-14 20:30:16 +0200 |
commit | 41a38e8d9098d6627cd26351577cf032e6996c87 (patch) | |
tree | 34d53e6291c6d353a9c3a37a472b933f9fa5e57d /source/ChunkMap.cpp | |
parent | Initial Floody fluid simulator. (diff) | |
download | cuberite-41a38e8d9098d6627cd26351577cf032e6996c87.tar cuberite-41a38e8d9098d6627cd26351577cf032e6996c87.tar.gz cuberite-41a38e8d9098d6627cd26351577cf032e6996c87.tar.bz2 cuberite-41a38e8d9098d6627cd26351577cf032e6996c87.tar.lz cuberite-41a38e8d9098d6627cd26351577cf032e6996c87.tar.xz cuberite-41a38e8d9098d6627cd26351577cf032e6996c87.tar.zst cuberite-41a38e8d9098d6627cd26351577cf032e6996c87.zip |
Diffstat (limited to '')
-rw-r--r-- | source/ChunkMap.cpp | 79 |
1 files changed, 49 insertions, 30 deletions
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: |