From ad89cf88ba997651257412594cdd88e84a525a19 Mon Sep 17 00:00:00 2001 From: faketruth Date: Sat, 3 Mar 2012 20:55:16 +0000 Subject: Got rid of some hardcoded numbers, now using hardcoded variables! woo git-svn-id: http://mc-server.googlecode.com/svn/trunk@355 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/packets/cPacket_MapChunk.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'source/packets/cPacket_MapChunk.cpp') 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; -- cgit v1.2.3