diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-02-21 17:27:30 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-02-21 17:27:30 +0100 |
commit | b653e6a01271c05bdbd947ab7120d10d30ecee91 (patch) | |
tree | 43d7a6e5ce26b77d1c759a8dc0cc533a13a933e7 /source/cClientHandle.cpp | |
parent | Fixed heightmap optimization from rev 302; removed a few more cChunkPtrs (diff) | |
download | cuberite-b653e6a01271c05bdbd947ab7120d10d30ecee91.tar cuberite-b653e6a01271c05bdbd947ab7120d10d30ecee91.tar.gz cuberite-b653e6a01271c05bdbd947ab7120d10d30ecee91.tar.bz2 cuberite-b653e6a01271c05bdbd947ab7120d10d30ecee91.tar.lz cuberite-b653e6a01271c05bdbd947ab7120d10d30ecee91.tar.xz cuberite-b653e6a01271c05bdbd947ab7120d10d30ecee91.tar.zst cuberite-b653e6a01271c05bdbd947ab7120d10d30ecee91.zip |
Diffstat (limited to '')
-rw-r--r-- | source/cClientHandle.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp index 6db6a2501..91ccb4005 100644 --- a/source/cClientHandle.cpp +++ b/source/cClientHandle.cpp @@ -343,7 +343,7 @@ void cClientHandle::StreamChunks(void) int RelZ = (*itr).m_ChunkZ - ChunkPosZ;
if ((RelX > VIEWDISTANCE) || (RelX < -VIEWDISTANCE) || (RelZ > VIEWDISTANCE) || (RelZ < -VIEWDISTANCE))
{
- World->GetChunk(itr->m_ChunkX, itr->m_ChunkY, itr->m_ChunkZ)->RemoveClient(this);
+ World->RemoveChunkClient(itr->m_ChunkX, itr->m_ChunkY, itr->m_ChunkZ, this);
itr = m_LoadedChunks.erase(itr);
}
else
@@ -389,13 +389,13 @@ void cClientHandle::StreamChunks(void) // For each distance touch chunks in a hollow square centered around current position:
for (int i = -d; i <= d; ++i)
{
- World->GetChunk(ChunkPosX + d, ZERO_CHUNK_Y, ChunkPosZ + i);
- World->GetChunk(ChunkPosX - d, ZERO_CHUNK_Y, ChunkPosZ + i);
+ World->TouchChunk(ChunkPosX + d, ZERO_CHUNK_Y, ChunkPosZ + i);
+ World->TouchChunk(ChunkPosX - d, ZERO_CHUNK_Y, ChunkPosZ + i);
} // for i
for (int i = -d + 1; i < d; ++i)
{
- World->GetChunk(ChunkPosX + i, ZERO_CHUNK_Y, ChunkPosZ + d);
- World->GetChunk(ChunkPosX + i, ZERO_CHUNK_Y, ChunkPosZ - d);
+ World->TouchChunk(ChunkPosX + i, ZERO_CHUNK_Y, ChunkPosZ + d);
+ World->TouchChunk(ChunkPosX + i, ZERO_CHUNK_Y, ChunkPosZ - d);
} // for i
} // for d
}
@@ -1510,12 +1510,7 @@ void cClientHandle::HandleWindowClick(cPacket_WindowClick * a_Packet) void cClientHandle::HandleUpdateSign(cPacket_UpdateSign * a_Packet)
{
cWorld * World = m_Player->GetWorld();
- cChunkPtr Chunk = World->GetChunkOfBlock(a_Packet->m_PosX, a_Packet->m_PosY, a_Packet->m_PosZ);
- if ((Chunk == NULL) || !Chunk->IsValid())
- {
- return;
- }
- Chunk->UpdateSign(a_Packet->m_PosX, a_Packet->m_PosY, a_Packet->m_PosZ, a_Packet->m_Line1, a_Packet->m_Line2, a_Packet->m_Line3, a_Packet->m_Line4);
+ World->UpdateSign(a_Packet->m_PosX, a_Packet->m_PosY, a_Packet->m_PosZ, a_Packet->m_Line1, a_Packet->m_Line2, a_Packet->m_Line3, a_Packet->m_Line4);
}
@@ -1664,8 +1659,10 @@ void cClientHandle::Tick(float a_Dt) // Only send up to 10 chunks per tick, otherwise we'd choke the tick thread
break;
}
- CheckIfWorldDownloaded();
} // for itr - m_ChunksToSend[]
+
+ // Check even if we didn't send anything - a chunk may have sent a notification that we'd miss otherwise
+ CheckIfWorldDownloaded();
}
}
|