summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage
diff options
context:
space:
mode:
Diffstat (limited to 'src/WorldStorage')
-rw-r--r--src/WorldStorage/NBTChunkSerializer.cpp2
-rw-r--r--src/WorldStorage/WSSAnvil.cpp6
-rw-r--r--src/WorldStorage/WSSCompact.cpp6
-rw-r--r--src/WorldStorage/WSSCompact.h8
4 files changed, 15 insertions, 7 deletions
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp
index c9013b1b3..5c87c2679 100644
--- a/src/WorldStorage/NBTChunkSerializer.cpp
+++ b/src/WorldStorage/NBTChunkSerializer.cpp
@@ -432,7 +432,7 @@ bool cNBTChunkSerializer::LightIsValid(bool a_IsLightValid)
void cNBTChunkSerializer::BiomeData(const cChunkDef::BiomeMap * a_BiomeMap)
{
memcpy(m_Biomes, a_BiomeMap, sizeof(m_Biomes));
- for (int i = 0; i < ARRAYCOUNT(m_Biomes); i++)
+ for (size_t i = 0; i < ARRAYCOUNT(m_Biomes); i++)
{
if ((*a_BiomeMap)[i] < 255)
{
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index 79be4dfa2..dd06f19fa 100644
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -469,7 +469,7 @@ cChunkDef::BiomeMap * cWSSAnvil::LoadVanillaBiomeMapFromNBT(cChunkDef::BiomeMap
return NULL;
}
const unsigned char * VanillaBiomeData = (const unsigned char *)(a_NBT.GetData(a_TagIdx));
- for (int i = 0; i < ARRAYCOUNT(*a_BiomeMap); i++)
+ for (size_t i = 0; i < ARRAYCOUNT(*a_BiomeMap); i++)
{
if ((VanillaBiomeData)[i] == 0xff)
{
@@ -497,7 +497,7 @@ cChunkDef::BiomeMap * cWSSAnvil::LoadBiomeMapFromNBT(cChunkDef::BiomeMap * a_Bio
return NULL;
}
const int * BiomeData = (const int *)(a_NBT.GetData(a_TagIdx));
- for (int i = 0; i < ARRAYCOUNT(*a_BiomeMap); i++)
+ for (size_t i = 0; i < ARRAYCOUNT(*a_BiomeMap); i++)
{
(*a_BiomeMap)[i] = (EMCSBiome)(ntohl(BiomeData[i]));
if ((*a_BiomeMap)[i] == 0xff)
@@ -1538,7 +1538,7 @@ unsigned cWSSAnvil::cMCAFile::FindFreeLocation(int a_LocalX, int a_LocalZ, const
// Doesn't fit, append to the end of file (we're wasting a lot of space, TODO: fix this later)
unsigned MaxLocation = 2 << 8; // Minimum sector is #2 - after the headers
- for (int i = 0; i < ARRAYCOUNT(m_Header); i++)
+ for (size_t i = 0; i < ARRAYCOUNT(m_Header); i++)
{
ChunkLocation = ntohl(m_Header[i]);
ChunkLocation = ChunkLocation + ((ChunkLocation & 0xff) << 8); // Add the number of sectors used; don't care about the 4th byte
diff --git a/src/WorldStorage/WSSCompact.cpp b/src/WorldStorage/WSSCompact.cpp
index 287938b24..e2556b96e 100644
--- a/src/WorldStorage/WSSCompact.cpp
+++ b/src/WorldStorage/WSSCompact.cpp
@@ -871,9 +871,9 @@ bool cWSSCompact::LoadChunkFromData(const cChunkCoords & a_Chunk, int & a_Uncomp
}
BLOCKTYPE * BlockData = (BLOCKTYPE *)UncompressedData.data();
- NIBBLETYPE * MetaData = (NIBBLETYPE *)(BlockData + cChunkDef::MetaOffset);
- NIBBLETYPE * BlockLight = (NIBBLETYPE *)(BlockData + cChunkDef::LightOffset);
- NIBBLETYPE * SkyLight = (NIBBLETYPE *)(BlockData + cChunkDef::SkyLightOffset);
+ NIBBLETYPE * MetaData = (NIBBLETYPE *)(BlockData + MetaOffset);
+ NIBBLETYPE * BlockLight = (NIBBLETYPE *)(BlockData + LightOffset);
+ NIBBLETYPE * SkyLight = (NIBBLETYPE *)(BlockData + SkyLightOffset);
a_World->SetChunkData(
a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ,
diff --git a/src/WorldStorage/WSSCompact.h b/src/WorldStorage/WSSCompact.h
index a75c41ccb..3223a986e 100644
--- a/src/WorldStorage/WSSCompact.h
+++ b/src/WorldStorage/WSSCompact.h
@@ -58,6 +58,14 @@ public:
protected:
+ enum
+ {
+ // Offsets to individual components in the joined blockdata array
+ MetaOffset = cChunkDef::NumBlocks,
+ LightOffset = MetaOffset + cChunkDef::NumBlocks / 2,
+ SkyLightOffset = LightOffset + cChunkDef::NumBlocks / 2,
+ } ;
+
struct sChunkHeader;
typedef std::vector<sChunkHeader *> sChunkHeaders;