summaryrefslogtreecommitdiffstats
path: root/source/cChunkMap.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-21 16:18:02 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-21 16:18:02 +0100
commitf0145ee9fa09ce2c27b8149fee37c6f5fce7e1da (patch)
tree9eaa3d17bbeda373649470cd5ce060c4fbf76b58 /source/cChunkMap.cpp
parentOptimized hightmap recalc when setting a chunk's block (diff)
downloadcuberite-f0145ee9fa09ce2c27b8149fee37c6f5fce7e1da.tar
cuberite-f0145ee9fa09ce2c27b8149fee37c6f5fce7e1da.tar.gz
cuberite-f0145ee9fa09ce2c27b8149fee37c6f5fce7e1da.tar.bz2
cuberite-f0145ee9fa09ce2c27b8149fee37c6f5fce7e1da.tar.lz
cuberite-f0145ee9fa09ce2c27b8149fee37c6f5fce7e1da.tar.xz
cuberite-f0145ee9fa09ce2c27b8149fee37c6f5fce7e1da.tar.zst
cuberite-f0145ee9fa09ce2c27b8149fee37c6f5fce7e1da.zip
Diffstat (limited to '')
-rw-r--r--source/cChunkMap.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/source/cChunkMap.cpp b/source/cChunkMap.cpp
index 3e59c08ef..2621e0793 100644
--- a/source/cChunkMap.cpp
+++ b/source/cChunkMap.cpp
@@ -537,6 +537,51 @@ void cChunkMap::CompareChunkClients(int a_ChunkX1, int a_ChunkY1, int a_ChunkZ1,
+bool cChunkMap::AddChunkClient(int a_ChunkX, int a_ChunkY, int a_ChunkZ, cClientHandle * a_Client)
+{
+ cCSLock Lock(m_CSLayers);
+ cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, a_ChunkY, a_ChunkZ);
+ if (Chunk == NULL)
+ {
+ return false;
+ }
+ return Chunk->AddClient(a_Client);
+}
+
+
+
+
+
+void cChunkMap::RemoveClientFromChunks(cClientHandle * a_Client, const cChunkCoordsList & a_Chunks)
+{
+ cCSLock Lock(m_CSLayers);
+
+ for (cChunkCoordsList::const_iterator itr = a_Chunks.begin(); itr != a_Chunks.end(); ++itr)
+ {
+ GetChunkNoGen(itr->m_ChunkX, itr->m_ChunkY, itr->m_ChunkZ)->RemoveClient(a_Client);
+ }
+}
+
+
+
+
+
+bool cChunkMap::SendChunkTo(int a_ChunkX, int a_ChunkY, int a_ChunkZ, cClientHandle * a_Client)
+{
+ cCSLock Lock(m_CSLayers);
+ cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, a_ChunkY, a_ChunkZ);
+ if ((Chunk == NULL) || !Chunk->IsValid())
+ {
+ return false;
+ }
+ Chunk->SendTo(a_Client);
+ return true;
+}
+
+
+
+
+
void cChunkMap::MoveEntityToChunk(cEntity * a_Entity, int a_ChunkX, int a_ChunkY, int a_ChunkZ)
{
cCSLock Lock(m_CSLayers);