diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-03-11 11:48:20 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-03-11 11:48:20 +0100 |
commit | af44154ff57ee725903d58c94cbba12413ddeb41 (patch) | |
tree | 688bb37acf3c9795266e3f6513e39056808128a3 /source/cClientHandle.cpp | |
parent | Anvil format: fixed loading with XZY ordering (diff) | |
download | cuberite-af44154ff57ee725903d58c94cbba12413ddeb41.tar cuberite-af44154ff57ee725903d58c94cbba12413ddeb41.tar.gz cuberite-af44154ff57ee725903d58c94cbba12413ddeb41.tar.bz2 cuberite-af44154ff57ee725903d58c94cbba12413ddeb41.tar.lz cuberite-af44154ff57ee725903d58c94cbba12413ddeb41.tar.xz cuberite-af44154ff57ee725903d58c94cbba12413ddeb41.tar.zst cuberite-af44154ff57ee725903d58c94cbba12413ddeb41.zip |
Diffstat (limited to 'source/cClientHandle.cpp')
-rw-r--r-- | source/cClientHandle.cpp | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp index c610f91a3..07be3d4a7 100644 --- a/source/cClientHandle.cpp +++ b/source/cClientHandle.cpp @@ -475,27 +475,6 @@ void cClientHandle::RemoveFromAllChunks() -void cClientHandle::ChunkJustSent(cChunk * a_ChunkCompleted)
-{
- cCSLock Lock(m_CSChunkLists);
- for (cChunkCoordsList::iterator itr = m_ChunksToSend.begin(); itr != m_ChunksToSend.end(); ++itr)
- {
- if (((*itr).m_ChunkX == a_ChunkCompleted->GetPosX()) && ((*itr).m_ChunkZ == a_ChunkCompleted->GetPosZ()))
- {
- m_ChunksToSend.erase(itr);
- if ((m_State == csDownloadingWorld) && (m_ChunksToSend.empty()))
- {
- CheckIfWorldDownloaded();
- }
- return;
- }
- } // for itr - m_ChunksToSend[]
-}
-
-
-
-
-
void cClientHandle::HandlePacket(cPacket * a_Packet)
{
m_TimeLastPacket = cWorld::GetTime();
@@ -1745,6 +1724,7 @@ void cClientHandle::Send(const cPacket & a_Packet, ENUM_PRIORITY a_Priority /* = int ChunkX = ((cPacket_MapChunk &)a_Packet).m_PosX / cChunk::c_ChunkWidth;
int ChunkZ = ((cPacket_MapChunk &)a_Packet).m_PosZ / cChunk::c_ChunkWidth;
#endif
+ bool Found = false;
cCSLock Lock(m_CSChunkLists);
for (cChunkCoordsList::iterator itr = m_ChunksToSend.begin(); itr != m_ChunksToSend.end(); ++itr)
{
@@ -1752,9 +1732,14 @@ void cClientHandle::Send(const cPacket & a_Packet, ENUM_PRIORITY a_Priority /* = {
m_ChunksToSend.erase(itr);
CheckIfWorldDownloaded();
+ Found = true;
break;
}
} // for itr - m_ChunksToSend[]
+ if (!Found)
+ {
+ return;
+ }
}
// Optimize away multiple queued RelativeEntityMoveLook packets:
@@ -1874,6 +1859,16 @@ void cClientHandle::SetViewDistance(int a_ViewDistance) +bool cClientHandle::WantsSendChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
+{
+ cCSLock Lock(m_CSChunkLists);
+ return (std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), cChunkCoords(a_ChunkX, a_ChunkY, a_ChunkZ)) != m_ChunksToSend.end());
+}
+
+
+
+
+
void cClientHandle::DataReceived(const char * a_Data, int a_Size)
{
// Data is received from the client
|