Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions source/client/network/ClientSideNetworkHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);

Expand Down Expand Up @@ -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);

Expand All @@ -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);
Expand Down Expand Up @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions source/network/packets/LevelDataPacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ void LevelDataPacket::write(RakNet::BitStream& bs)

int uncompMagic = 12847812, compMagic = 58712758, chunkSepMagic = 284787658;
bs2.Write(uncompMagic);
bs2.Write(chunksX);
bs2.Write(chunksZ);
bs2.Write<uint32_t>(chunksX);
bs2.Write<uint32_t>(chunksZ);
ChunkPos chunkPos(0, 0);
for (chunkPos.x = 0; chunkPos.x < chunksX; chunkPos.x++)
{
Expand All @@ -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);
}
Expand All @@ -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);
Expand Down