diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-03-11 11:47:37 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-03-11 11:47:37 +0100 |
commit | dc8004d5e6797ce6b9e9de25d35dbee21ecaf9d7 (patch) | |
tree | 3b30dc07e40d14df245fbb96e75b3d633f573f92 /source/WSSAnvil.cpp | |
parent | Fixed a few obsoleted functions (diff) | |
download | cuberite-dc8004d5e6797ce6b9e9de25d35dbee21ecaf9d7.tar cuberite-dc8004d5e6797ce6b9e9de25d35dbee21ecaf9d7.tar.gz cuberite-dc8004d5e6797ce6b9e9de25d35dbee21ecaf9d7.tar.bz2 cuberite-dc8004d5e6797ce6b9e9de25d35dbee21ecaf9d7.tar.lz cuberite-dc8004d5e6797ce6b9e9de25d35dbee21ecaf9d7.tar.xz cuberite-dc8004d5e6797ce6b9e9de25d35dbee21ecaf9d7.tar.zst cuberite-dc8004d5e6797ce6b9e9de25d35dbee21ecaf9d7.zip |
Diffstat (limited to 'source/WSSAnvil.cpp')
-rw-r--r-- | source/WSSAnvil.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/source/WSSAnvil.cpp b/source/WSSAnvil.cpp index d3b4a51fe..73449e5bc 100644 --- a/source/WSSAnvil.cpp +++ b/source/WSSAnvil.cpp @@ -137,9 +137,9 @@ bool cWSSAnvil::LoadChunkFromData(const cChunkCoords & a_Chunk, const AString & // Decompress the data:
char Uncompressed[CHUNK_INFLATE_MAX];
z_stream strm;
- strm.zalloc = (alloc_func)NULL; - strm.zfree = (free_func)NULL; - strm.opaque = NULL; + strm.zalloc = (alloc_func)NULL;
+ strm.zfree = (free_func)NULL;
+ strm.opaque = NULL;
inflateInit(&strm);
strm.next_out = (Bytef *)Uncompressed;
strm.avail_out = sizeof(Uncompressed);
@@ -170,15 +170,13 @@ bool cWSSAnvil::LoadChunkFromData(const cChunkCoords & a_Chunk, const AString & 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)
- char BlockData[cChunk::c_NumBlocks];
- char MetaData[cChunk::c_NumBlocks / 2];
- char BlockLight[cChunk::c_NumBlocks / 2];
- char SkyLight[cChunk::c_NumBlocks / 2];
+ char BlockData[cChunk::c_BlockDataSize];
+ char * MetaData = BlockData + cChunk::c_NumBlocks;
+ char * BlockLight = MetaData + cChunk::c_NumBlocks / 2;
+ char * SkyLight = BlockLight + cChunk::c_NumBlocks / 2;
- memset(BlockData, E_BLOCK_AIR, sizeof(BlockData));
- memset(MetaData, 0, sizeof(MetaData));
- memset(BlockLight, 0, sizeof(BlockLight));
- memset(SkyLight, 0xff, sizeof(SkyLight)); // By default, data not present in the NBT means air, which means full skylight
+ memset(BlockData, E_BLOCK_AIR, sizeof(BlockData) - cChunk::c_NumBlocks / 2);
+ memset(SkyLight, 0xff, cChunk::c_NumBlocks / 2); // By default, data not present in the NBT means air, which means full skylight
// Load the blockdata, blocklight and skylight:
cNBTList * Sections = (cNBTList *)a_NBT.FindChildByPath("Level\\Sections");
|