summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-03-19 20:13:05 +0100
committerTycho <work.tycho+git@gmail.com>2014-03-19 20:13:05 +0100
commit1635c696de75e17adaeee65531fa9b864542cca8 (patch)
treefbea00253179bfb2e11d5a8899071cbc191091ab /src
parentAdded unreachable lines backit prtected by preprocessor guards (diff)
parentAPIDump: Reformatted the plugin to avoid all ZBS Analyzer issues. (diff)
downloadcuberite-1635c696de75e17adaeee65531fa9b864542cca8.tar
cuberite-1635c696de75e17adaeee65531fa9b864542cca8.tar.gz
cuberite-1635c696de75e17adaeee65531fa9b864542cca8.tar.bz2
cuberite-1635c696de75e17adaeee65531fa9b864542cca8.tar.lz
cuberite-1635c696de75e17adaeee65531fa9b864542cca8.tar.xz
cuberite-1635c696de75e17adaeee65531fa9b864542cca8.tar.zst
cuberite-1635c696de75e17adaeee65531fa9b864542cca8.zip
Diffstat (limited to 'src')
-rw-r--r--src/Bindings/LuaChunkStay.cpp3
-rw-r--r--src/ChunkMap.cpp10
-rw-r--r--src/OSSupport/GZipFile.cpp5
-rw-r--r--src/WorldStorage/FireworksSerializer.cpp10
4 files changed, 14 insertions, 14 deletions
diff --git a/src/Bindings/LuaChunkStay.cpp b/src/Bindings/LuaChunkStay.cpp
index 0e982637f..db865cfa4 100644
--- a/src/Bindings/LuaChunkStay.cpp
+++ b/src/Bindings/LuaChunkStay.cpp
@@ -131,9 +131,6 @@ void cLuaChunkStay::Enable(cChunkMap & a_ChunkMap, int a_OnChunkAvailableStackPo
void cLuaChunkStay::OnChunkAvailable(int a_ChunkX, int a_ChunkZ)
{
- // DEBUG:
- LOGD("LuaChunkStay: Chunk [%d, %d] is now available, calling the callback...", a_ChunkX, a_ChunkZ);
-
cPluginLua::cOperation Op(m_Plugin);
Op().Call((int)m_OnChunkAvailable, a_ChunkX, a_ChunkZ);
}
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp
index 60fbf39d4..ffba52d54 100644
--- a/src/ChunkMap.cpp
+++ b/src/ChunkMap.cpp
@@ -1376,19 +1376,13 @@ void cChunkMap::ReplaceTreeBlocks(const sSetBlockVector & a_Blocks)
break;
}
case E_BLOCK_LEAVES:
- {
- if (itr->BlockType == E_BLOCK_LOG)
- {
- Chunk->SetBlock(itr->x, itr->y, itr->z, itr->BlockType, itr->BlockMeta);
- }
- break;
- }
case E_BLOCK_NEW_LEAVES:
{
- if (itr->BlockType == E_BLOCK_NEW_LOG)
+ if ((itr->BlockType == E_BLOCK_LOG) || (itr->BlockType == E_BLOCK_NEW_LOG))
{
Chunk->SetBlock(itr->x, itr->y, itr->z, itr->BlockType, itr->BlockMeta);
}
+ break;
}
}
} // for itr - a_Blocks[]
diff --git a/src/OSSupport/GZipFile.cpp b/src/OSSupport/GZipFile.cpp
index cbf6be6c4..b13e519e0 100644
--- a/src/OSSupport/GZipFile.cpp
+++ b/src/OSSupport/GZipFile.cpp
@@ -73,12 +73,15 @@ int cGZipFile::ReadRestOfFile(AString & a_Contents)
// Since the gzip format doesn't really support getting the uncompressed length, we need to read incrementally. Yuck!
int NumBytesRead = 0;
+ int TotalBytes = 0;
char Buffer[64 KiB];
while ((NumBytesRead = gzread(m_File, Buffer, sizeof(Buffer))) > 0)
{
+ TotalBytes += NumBytesRead;
a_Contents.append(Buffer, NumBytesRead);
}
- return NumBytesRead;
+ // NumBytesRead is < 0 on error
+ return (NumBytesRead >= 0) ? TotalBytes : NumBytesRead;
}
diff --git a/src/WorldStorage/FireworksSerializer.cpp b/src/WorldStorage/FireworksSerializer.cpp
index 3c97ae0a2..744fc731f 100644
--- a/src/WorldStorage/FireworksSerializer.cpp
+++ b/src/WorldStorage/FireworksSerializer.cpp
@@ -20,8 +20,14 @@ void cFireworkItem::WriteToNBTCompound(const cFireworkItem & a_FireworkItem, cFa
a_Writer.AddByte("Flicker", a_FireworkItem.m_HasFlicker);
a_Writer.AddByte("Trail", a_FireworkItem.m_HasTrail);
a_Writer.AddByte("Type", a_FireworkItem.m_Type);
- a_Writer.AddIntArray("Colors", &(a_FireworkItem.m_Colours[0]), a_FireworkItem.m_Colours.size());
- a_Writer.AddIntArray("FadeColors", &(a_FireworkItem.m_FadeColours[0]), a_FireworkItem.m_FadeColours.size());
+ if (!a_FireworkItem.m_Colours.empty())
+ {
+ a_Writer.AddIntArray("Colors", &(a_FireworkItem.m_Colours[0]), a_FireworkItem.m_Colours.size());
+ }
+ if (!a_FireworkItem.m_FadeColours.empty())
+ {
+ a_Writer.AddIntArray("FadeColors", &(a_FireworkItem.m_FadeColours[0]), a_FireworkItem.m_FadeColours.size());
+ }
a_Writer.EndCompound();
a_Writer.EndList();
a_Writer.EndCompound();