From 4a48f9c8c4c0da0bedf3c6462542b760fb5eb03d Mon Sep 17 00:00:00 2001 From: Brent Da Mage Date: Sun, 22 Feb 2026 19:12:08 -0600 Subject: [PATCH 1/2] Disable LevelDataPacket reading --- source/client/network/ClientSideNetworkHandler.cpp | 10 +++++----- source/network/packets/LevelDataPacket.cpp | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/client/network/ClientSideNetworkHandler.cpp b/source/client/network/ClientSideNetworkHandler.cpp index 603847af5..910e47666 100644 --- a/source/client/network/ClientSideNetworkHandler.cpp +++ b/source/client/network/ClientSideNetworkHandler.cpp @@ -823,7 +823,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& guid, ContainerS void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& guid, LevelDataPacket* packet) { - if (!m_pLevel) return; + /*if (!m_pLevel) return; const int uncompMagic = 12847812, compMagic = 58712758, chunkSepMagic = 284787658; RakNet::BitStream* bs = &packet->m_data, bs2; @@ -840,7 +840,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& guid, LevelDataP if (magicNum == compMagic) { // Decompress it before we handle it. - int uncompSize = 0, compSize = 0; + uint32_t uncompSize = 0, compSize = 0; bs->Read(uncompSize); bs->Read(compSize); @@ -873,7 +873,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& guid, LevelDataP bs->Read(magicNum); } - int chunksX = 0, chunksZ = 0; + uint32_t chunksX = 0, chunksZ = 0; bs->Read(chunksX); bs->Read(chunksZ); @@ -899,7 +899,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& guid, LevelDataP uint8_t ptype = 0; // read the data size. This'll let us know how much to read. - int dataSize = 0; + uint32_t dataSize = 0; bs->Read(dataSize); LevelChunk* pChunk = m_pLevel->getChunk(cp); @@ -932,7 +932,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& guid, LevelDataP // All chunks are loaded. Also flush all the updates we've buffered. m_chunksRequested = C_MAX_CHUNKS; - flushAllBufferedUpdates(); + flushAllBufferedUpdates();*/ } bool ClientSideNetworkHandler::areAllChunksLoaded() diff --git a/source/network/packets/LevelDataPacket.cpp b/source/network/packets/LevelDataPacket.cpp index 23c944e08..b3e12868a 100644 --- a/source/network/packets/LevelDataPacket.cpp +++ b/source/network/packets/LevelDataPacket.cpp @@ -22,8 +22,8 @@ void LevelDataPacket::write(RakNet::BitStream& bs) // @TODO: Maybe offload this to a different 'worker thread'? Or maybe just the compression job? // send a crapton of them in a raw packet(why? Laziness) - int chunksX = C_MAX_CHUNKS_X; - int chunksZ = C_MAX_CHUNKS_Z; + uint32_t chunksX = C_MAX_CHUNKS_X; + uint32_t chunksZ = C_MAX_CHUNKS_Z; //int minus9999 = -9999; RakNet::BitStream bs2; bs.Write((unsigned char)PACKET_LEVEL_DATA); @@ -67,7 +67,7 @@ void LevelDataPacket::write(RakNet::BitStream& bs) //float ratio = 100.0f * float(compSize) / float(uncompSize); //LOG_I("Compression ratio: %.2f (%d comp, %d uncomp)", ratio, int(compSize), int(uncompSize)); - int cs2 = int(compSize), us2 = int(uncompSize); + uint32_t cs2 = compSize, us2 = uncompSize; bs2.Reset(); bs2.Write(compMagic); bs2.Write(us2); From 2e6fd03a12c97e49c5f8c0fe2d751af81b082e58 Mon Sep 17 00:00:00 2001 From: Brent Da Mage Date: Sun, 22 Feb 2026 19:19:58 -0600 Subject: [PATCH 2/2] Fixed warn --- source/network/packets/LevelDataPacket.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/network/packets/LevelDataPacket.cpp b/source/network/packets/LevelDataPacket.cpp index b3e12868a..95ba56029 100644 --- a/source/network/packets/LevelDataPacket.cpp +++ b/source/network/packets/LevelDataPacket.cpp @@ -22,16 +22,16 @@ void LevelDataPacket::write(RakNet::BitStream& bs) // @TODO: Maybe offload this to a different 'worker thread'? Or maybe just the compression job? // send a crapton of them in a raw packet(why? Laziness) - uint32_t chunksX = C_MAX_CHUNKS_X; - uint32_t chunksZ = C_MAX_CHUNKS_Z; + int chunksX = C_MAX_CHUNKS_X; + int chunksZ = C_MAX_CHUNKS_Z; //int minus9999 = -9999; RakNet::BitStream bs2; bs.Write((unsigned char)PACKET_LEVEL_DATA); int uncompMagic = 12847812, compMagic = 58712758, chunkSepMagic = 284787658; bs2.Write(uncompMagic); - bs2.Write(chunksX); - bs2.Write(chunksZ); + bs2.Write(chunksX); + bs2.Write(chunksZ); ChunkPos chunkPos(0, 0); for (chunkPos.x = 0; chunkPos.x < chunksX; chunkPos.x++) { @@ -44,7 +44,7 @@ void LevelDataPacket::write(RakNet::BitStream& bs) ChunkDataPacket cdp(chunkPos, pChunk); cdp.write(bs3); - int dataSize = int(bs3.GetNumberOfBytesUsed()); + uint32_t dataSize = bs3.GetNumberOfBytesUsed(); bs2.Write(dataSize); bs2.Write((const char*)bs3.GetData(), dataSize); }