Anvil format: fixed loading with XZY ordering

git-svn-id: http://mc-server.googlecode.com/svn/trunk@398 0a769ca7-a7f5-676a-18bf-c427514a06d6
master
madmaxoft@gmail.com 2012-03-11 10:47:37 +00:00
parent 219be8186c
commit dc8004d5e6
1 changed files with 9 additions and 11 deletions

View File

@ -170,15 +170,13 @@ bool cWSSAnvil::LoadChunkFromData(const cChunkCoords & a_Chunk, const AString &
bool cWSSAnvil::LoadChunkFromNBT(const cChunkCoords & a_Chunk, cNBTTag & a_NBT) bool cWSSAnvil::LoadChunkFromNBT(const cChunkCoords & a_Chunk, cNBTTag & a_NBT)
{ {
// The data arrays, in MCA-native y/z/x ordering (will be reordered for the final chunk data) // The data arrays, in MCA-native y/z/x ordering (will be reordered for the final chunk data)
char BlockData[cChunk::c_NumBlocks]; char BlockData[cChunk::c_BlockDataSize];
char MetaData[cChunk::c_NumBlocks / 2]; char * MetaData = BlockData + cChunk::c_NumBlocks;
char BlockLight[cChunk::c_NumBlocks / 2]; char * BlockLight = MetaData + cChunk::c_NumBlocks / 2;
char SkyLight[cChunk::c_NumBlocks / 2]; char * SkyLight = BlockLight + cChunk::c_NumBlocks / 2;
memset(BlockData, E_BLOCK_AIR, sizeof(BlockData)); memset(BlockData, E_BLOCK_AIR, sizeof(BlockData) - cChunk::c_NumBlocks / 2);
memset(MetaData, 0, sizeof(MetaData)); memset(SkyLight, 0xff, cChunk::c_NumBlocks / 2); // By default, data not present in the NBT means air, which means full skylight
memset(BlockLight, 0, sizeof(BlockLight));
memset(SkyLight, 0xff, sizeof(SkyLight)); // By default, data not present in the NBT means air, which means full skylight
// Load the blockdata, blocklight and skylight: // Load the blockdata, blocklight and skylight:
cNBTList * Sections = (cNBTList *)a_NBT.FindChildByPath("Level\\Sections"); cNBTList * Sections = (cNBTList *)a_NBT.FindChildByPath("Level\\Sections");