Skip to content

Commit ee6908c

Browse files
authored
Disable LevelDataPacket reading (#511)
1 parent d30b076 commit ee6908c

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

source/client/network/ClientSideNetworkHandler.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& guid, ContainerS
823823

824824
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& guid, LevelDataPacket* packet)
825825
{
826-
if (!m_pLevel) return;
826+
/*if (!m_pLevel) return;
827827
828828
const int uncompMagic = 12847812, compMagic = 58712758, chunkSepMagic = 284787658;
829829
RakNet::BitStream* bs = &packet->m_data, bs2;
@@ -840,7 +840,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& guid, LevelDataP
840840
if (magicNum == compMagic)
841841
{
842842
// Decompress it before we handle it.
843-
int uncompSize = 0, compSize = 0;
843+
uint32_t uncompSize = 0, compSize = 0;
844844
bs->Read(uncompSize);
845845
bs->Read(compSize);
846846
@@ -873,7 +873,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& guid, LevelDataP
873873
bs->Read(magicNum);
874874
}
875875
876-
int chunksX = 0, chunksZ = 0;
876+
uint32_t chunksX = 0, chunksZ = 0;
877877
bs->Read(chunksX);
878878
bs->Read(chunksZ);
879879
@@ -899,7 +899,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& guid, LevelDataP
899899
uint8_t ptype = 0;
900900
901901
// read the data size. This'll let us know how much to read.
902-
int dataSize = 0;
902+
uint32_t dataSize = 0;
903903
bs->Read(dataSize);
904904
905905
LevelChunk* pChunk = m_pLevel->getChunk(cp);
@@ -932,7 +932,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& guid, LevelDataP
932932
933933
// All chunks are loaded. Also flush all the updates we've buffered.
934934
m_chunksRequested = C_MAX_CHUNKS;
935-
flushAllBufferedUpdates();
935+
flushAllBufferedUpdates();*/
936936
}
937937

938938
bool ClientSideNetworkHandler::areAllChunksLoaded()

source/network/packets/LevelDataPacket.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ void LevelDataPacket::write(RakNet::BitStream& bs)
3030

3131
int uncompMagic = 12847812, compMagic = 58712758, chunkSepMagic = 284787658;
3232
bs2.Write(uncompMagic);
33-
bs2.Write(chunksX);
34-
bs2.Write(chunksZ);
33+
bs2.Write<uint32_t>(chunksX);
34+
bs2.Write<uint32_t>(chunksZ);
3535
ChunkPos chunkPos(0, 0);
3636
for (chunkPos.x = 0; chunkPos.x < chunksX; chunkPos.x++)
3737
{
@@ -44,7 +44,7 @@ void LevelDataPacket::write(RakNet::BitStream& bs)
4444
ChunkDataPacket cdp(chunkPos, pChunk);
4545
cdp.write(bs3);
4646

47-
int dataSize = int(bs3.GetNumberOfBytesUsed());
47+
uint32_t dataSize = bs3.GetNumberOfBytesUsed();
4848
bs2.Write(dataSize);
4949
bs2.Write((const char*)bs3.GetData(), dataSize);
5050
}
@@ -67,7 +67,7 @@ void LevelDataPacket::write(RakNet::BitStream& bs)
6767
//float ratio = 100.0f * float(compSize) / float(uncompSize);
6868
//LOG_I("Compression ratio: %.2f (%d comp, %d uncomp)", ratio, int(compSize), int(uncompSize));
6969

70-
int cs2 = int(compSize), us2 = int(uncompSize);
70+
uint32_t cs2 = compSize, us2 = uncompSize;
7171
bs2.Reset();
7272
bs2.Write(compMagic);
7373
bs2.Write(us2);

0 commit comments

Comments
 (0)