summaryrefslogtreecommitdiffstats
path: root/source/packets/cPacket_MapChunk.cpp
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-03 21:55:16 +0100
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-03 21:55:16 +0100
commitad89cf88ba997651257412594cdd88e84a525a19 (patch)
tree7706bc9b0b9ae25cbb4b2b097e3c27bed5ba2e30 /source/packets/cPacket_MapChunk.cpp
parentThat should not have been committed... (diff)
downloadcuberite-ad89cf88ba997651257412594cdd88e84a525a19.tar
cuberite-ad89cf88ba997651257412594cdd88e84a525a19.tar.gz
cuberite-ad89cf88ba997651257412594cdd88e84a525a19.tar.bz2
cuberite-ad89cf88ba997651257412594cdd88e84a525a19.tar.lz
cuberite-ad89cf88ba997651257412594cdd88e84a525a19.tar.xz
cuberite-ad89cf88ba997651257412594cdd88e84a525a19.tar.zst
cuberite-ad89cf88ba997651257412594cdd88e84a525a19.zip
Diffstat (limited to '')
-rw-r--r--source/packets/cPacket_MapChunk.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/source/packets/cPacket_MapChunk.cpp b/source/packets/cPacket_MapChunk.cpp
index 24d7b8d88..d602007e3 100644
--- a/source/packets/cPacket_MapChunk.cpp
+++ b/source/packets/cPacket_MapChunk.cpp
@@ -36,12 +36,13 @@ cPacket_MapChunk::cPacket_MapChunk(cChunk * a_Chunk)
m_UnusedInt = 0;
- unsigned int DataSize = 16 * (4096 + 2048 + 2048 + 2048);
+
+ unsigned int DataSize = (cChunk::c_ChunkHeight/16) * (4096 + 2048 + 2048 + 2048);
char* AllData = new char[ DataSize ];
memset( AllData, 0, DataSize );
unsigned int iterator = 0;
- for( int i = 0; i < 8; ++i ) // Old world is only 8*16 high (should be 16*16)
+ for( int i = 0; i < (cChunk::c_ChunkHeight/16); ++i ) // Old world is only 8*16 high (should be 16*16)
{
m_BitMap1 |= (1 << i); // This tells what chunks are sent. Use this to NOT send air only chunks (right now everything is sent)
for( int y = 0; y < 16; ++y ) for( int z = 0; z < 16; ++z ) for( int x = 0; x < 16; ++x )
@@ -51,7 +52,7 @@ cPacket_MapChunk::cPacket_MapChunk(cChunk * a_Chunk)
}
}
//Send block metadata
- for( int i = 0; i < 8; ++i )
+ for( int i = 0; i < (cChunk::c_ChunkHeight/16); ++i )
{
for( int y = 0; y < 16; ++y ) for( int z = 0; z < 16; ++z )
{
@@ -63,7 +64,7 @@ cPacket_MapChunk::cPacket_MapChunk(cChunk * a_Chunk)
}
}
//Send block light
- for( int i = 0; i < 8; ++i )
+ for( int i = 0; i < (cChunk::c_ChunkHeight/16); ++i )
{
for( int y = 0; y < 16; ++y ) for( int z = 0; z < 16; ++z )
{
@@ -75,7 +76,7 @@ cPacket_MapChunk::cPacket_MapChunk(cChunk * a_Chunk)
}
}
//Send sky light
- for( int i = 0; i < 8; ++i )
+ for( int i = 0; i < (cChunk::c_ChunkHeight/16); ++i )
{
for( int y = 0; y < 16; ++y ) for( int z = 0; z < 16; ++z )
{
@@ -98,9 +99,9 @@ cPacket_MapChunk::cPacket_MapChunk(cChunk * a_Chunk)
m_CompressedSize = CompressedSize;
#else
- m_PosX = a_Chunk->GetPosX() * 16; // It has to be block coordinates
- m_PosY = (short)(a_Chunk->GetPosY() * 128);
- m_PosZ = a_Chunk->GetPosZ() * 16;
+ m_PosX = a_Chunk->GetPosX() * cChunk::c_ChunkWidth; // It has to be block coordinates
+ m_PosY = (short)(a_Chunk->GetPosY() * cChunk::c_ChunkHeight);
+ m_PosZ = a_Chunk->GetPosZ() * cChunk::c_ChunkWidth;
m_SizeX = 15;
m_SizeY = 127;