summaryrefslogtreecommitdiffstats
path: root/source/cClientHandle.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-04-10 13:22:11 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-04-10 13:22:11 +0200
commitc51a4b9469fee0314d1b849206d1cf1c7c1240e4 (patch)
tree655d6a392b5483eea1453a08c24e269f8ae68d09 /source/cClientHandle.cpp
parentCompression error -5 fix (diff)
downloadcuberite-c51a4b9469fee0314d1b849206d1cf1c7c1240e4.tar
cuberite-c51a4b9469fee0314d1b849206d1cf1c7c1240e4.tar.gz
cuberite-c51a4b9469fee0314d1b849206d1cf1c7c1240e4.tar.bz2
cuberite-c51a4b9469fee0314d1b849206d1cf1c7c1240e4.tar.lz
cuberite-c51a4b9469fee0314d1b849206d1cf1c7c1240e4.tar.xz
cuberite-c51a4b9469fee0314d1b849206d1cf1c7c1240e4.tar.zst
cuberite-c51a4b9469fee0314d1b849206d1cf1c7c1240e4.zip
Diffstat (limited to 'source/cClientHandle.cpp')
-rw-r--r--source/cClientHandle.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp
index 7ec5e9834..0e9fd76b7 100644
--- a/source/cClientHandle.cpp
+++ b/source/cClientHandle.cpp
@@ -1708,9 +1708,9 @@ void cClientHandle::Send(const cPacket & a_Packet, ENUM_PRIORITY a_Priority /* =
}
}
- // Check chunks being sent, erase them from m_ChunksToSend:
if (a_Packet.m_PacketID == E_MAP_CHUNK)
{
+ // Check chunks being sent, erase them from m_ChunksToSend:
int ChunkX = ((cPacket_MapChunk &)a_Packet).m_PosX;
int ChunkZ = ((cPacket_MapChunk &)a_Packet).m_PosZ;
bool Found = false;
@@ -1727,6 +1727,7 @@ void cClientHandle::Send(const cPacket & a_Packet, ENUM_PRIORITY a_Priority /* =
} // for itr - m_ChunksToSend[]
if (!Found)
{
+ LOGD("Refusing to send chunk [%d, %d] - no longer wanted by client \"%s\".", ChunkX, ChunkZ, m_Username.c_str());
return;
}
}
@@ -1858,6 +1859,20 @@ bool cClientHandle::WantsSendChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
+void cClientHandle::AddWantedChunk(int a_ChunkX, int a_ChunkZ)
+{
+ LOGD("Adding chunk [%d, %d] to wanted chunks for client %p", a_ChunkX, a_ChunkZ, this);
+ cCSLock Lock(m_CSChunkLists);
+ if (std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), cChunkCoords(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ)) == m_ChunksToSend.end())
+ {
+ m_ChunksToSend.push_back(cChunkCoords(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ));
+ }
+}
+
+
+
+
+
void cClientHandle::DataReceived(const char * a_Data, int a_Size)
{
// Data is received from the client