summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-02 19:56:36 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-02 19:56:36 +0200
commit783ca913d4d5715a862389db6ee6b266ed46cf34 (patch)
tree09d257a6c1aa4a63460a5c60c8da41a0930d34a5
parentFixed Linux compilation complaining about min() and max(), hopefully forever. Use std::min() and std::max() (diff)
downloadcuberite-783ca913d4d5715a862389db6ee6b266ed46cf34.tar
cuberite-783ca913d4d5715a862389db6ee6b266ed46cf34.tar.gz
cuberite-783ca913d4d5715a862389db6ee6b266ed46cf34.tar.bz2
cuberite-783ca913d4d5715a862389db6ee6b266ed46cf34.tar.lz
cuberite-783ca913d4d5715a862389db6ee6b266ed46cf34.tar.xz
cuberite-783ca913d4d5715a862389db6ee6b266ed46cf34.tar.zst
cuberite-783ca913d4d5715a862389db6ee6b266ed46cf34.zip
Diffstat (limited to '')
-rw-r--r--source/cClientHandle.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp
index 8e0c707e7..065bc0c79 100644
--- a/source/cClientHandle.cpp
+++ b/source/cClientHandle.cpp
@@ -65,6 +65,9 @@
#include "packets/cPacket_MapChunk.h"
#include "packets/cPacket_PreChunk.h"
+// DEBUG:
+#include "packets/cPacket_BlockChange.h"
+
@@ -1872,6 +1875,66 @@ void cClientHandle::GetOutgoingData(AString & a_Data)
LOGERROR("ERROR: Too many packets in queue for player %s !!", m_Username.c_str());
cPacket_Disconnect DC("Too many packets in queue.");
m_Socket.Send(DC);
+
+ // DEBUG: Dump all outstanding packets' types to the log:
+ int Idx = 0;
+ int ChunkX = m_Player->GetChunkX();
+ int ChunkZ = m_Player->GetChunkZ();
+ for (PacketList::const_iterator itr = m_PendingNrmSendPackets.begin(); itr != m_PendingNrmSendPackets.end(); ++itr)
+ {
+ switch ((*itr)->m_PacketID)
+ {
+ case E_MAP_CHUNK:
+ {
+ int x = ((cPacket_MapChunk *)(*itr))->m_PosX;
+ int z = ((cPacket_MapChunk *)(*itr))->m_PosZ;
+ bool IsWanted = (abs(x - ChunkX) <= m_ViewDistance) && (abs(z - ChunkZ) <= m_ViewDistance);
+ LOG("Packet %4d: type %2x (MapChunk: %d, %d, %s)",
+ Idx++, (*itr)->m_PacketID,
+ x, z,
+ IsWanted ? "wanted" : "unwanted"
+ );
+ break;
+ }
+
+ case E_PRE_CHUNK:
+ {
+ int x = ((cPacket_PreChunk *)(*itr))->m_PosX;
+ int z = ((cPacket_PreChunk *)(*itr))->m_PosZ;
+ bool IsWanted = (abs(x - ChunkX) <= m_ViewDistance) && (abs(z - ChunkZ) <= m_ViewDistance);
+ bool Loading = ((cPacket_PreChunk *)(*itr))->m_bLoad;
+ LOG("Packet %4d: type %2x (PreChunk: %d, %d, %s, %s)",
+ Idx++, (*itr)->m_PacketID,
+ x, z,
+ Loading ? "loading" : "unloading",
+ IsWanted ? "wanted" : "unwanted"
+ );
+ break;
+ }
+
+ case E_BLOCK_CHANGE:
+ {
+ int x = ((cPacket_BlockChange *)(*itr))->m_PosX;
+ int z = ((cPacket_BlockChange *)(*itr))->m_PosZ;
+ int y, cx, cz;
+ cChunkDef::AbsoluteToRelative(x, y, z, cx, cz);
+ bool IsWanted = (abs(cx - ChunkX) <= m_ViewDistance) && (abs(cz - ChunkZ) <= m_ViewDistance);
+ LOG("Packet %4d: type %2x (BlockChange: [%d, %d], %s chunk)",
+ Idx++, (*itr)->m_PacketID,
+ cx, cz,
+ IsWanted ? "wanted" : "unwanted"
+ );
+ break;
+ }
+
+ default:
+ {
+ LOG("Packet %4d: type %2x", Idx++, (*itr)->m_PacketID);
+ break;
+ }
+ }
+ }
+
Lock.Unlock();
Destroy();
return;