diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-02-21 16:18:02 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-02-21 16:18:02 +0100 |
commit | f0145ee9fa09ce2c27b8149fee37c6f5fce7e1da (patch) | |
tree | 9eaa3d17bbeda373649470cd5ce060c4fbf76b58 /source/cClientHandle.cpp | |
parent | Optimized hightmap recalc when setting a chunk's block (diff) | |
download | cuberite-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/cClientHandle.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp index 51cd31433..6db6a2501 100644 --- a/source/cClientHandle.cpp +++ b/source/cClientHandle.cpp @@ -408,10 +408,8 @@ void cClientHandle::StreamChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ) cWorld * World = m_Player->GetWorld();
ASSERT(World != NULL);
- cChunkPtr Chunk = World->GetChunk(a_ChunkX, 0, a_ChunkZ);
- if (!Chunk->HasClient(this))
+ if (World->AddChunkClient(a_ChunkX, a_ChunkY, a_ChunkZ, this))
{
- Chunk->AddClient(this);
cCSLock Lock(m_CSChunkLists);
m_LoadedChunks.push_back(cChunkCoords(a_ChunkX, a_ChunkY, a_ChunkZ));
m_ChunksToSend.push_back(cChunkCoords(a_ChunkX, a_ChunkY, a_ChunkZ));
@@ -429,10 +427,7 @@ void cClientHandle::RemoveFromAllChunks() cWorld * World = m_Player->GetWorld();
if (World != NULL)
{
- for (cChunkCoordsList::iterator itr = m_LoadedChunks.begin(); itr != m_LoadedChunks.end(); ++itr)
- {
- World->GetChunk(itr->m_ChunkX, itr->m_ChunkY, itr->m_ChunkZ)->RemoveClient(this);
- }
+ World->RemoveClientFromChunks(this, m_LoadedChunks);
}
m_LoadedChunks.clear();
m_ChunksToSend.clear();
@@ -1657,14 +1652,11 @@ void cClientHandle::Tick(float a_Dt) int NumSent = 0;
for (cChunkCoordsList::iterator itr = m_ChunksToSend.begin(); itr != m_ChunksToSend.end();)
{
- cChunkPtr Chunk = World->GetChunk(itr->m_ChunkX, itr->m_ChunkY, itr->m_ChunkZ);
- if (!Chunk->IsValid())
+ if (!World->SendChunkTo(itr->m_ChunkX, itr->m_ChunkY, itr->m_ChunkZ, this))
{
++itr;
continue;
}
- // The chunk has become valid, send it and remove it from the list:
- Chunk->Send(this);
itr = m_ChunksToSend.erase(itr);
NumSent++;
if (NumSent > 10)
|