diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-03-01 22:26:43 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-03-09 13:48:58 +0100 |
commit | 124fc8bc664f96158b4db28372da62896d1db211 (patch) | |
tree | d3098f08070471792e431421c993da8f19ecf192 /src/WorldStorage/FireworksSerializer.cpp | |
parent | Added extra dye rules to crafting.txt (diff) | |
download | cuberite-124fc8bc664f96158b4db28372da62896d1db211.tar cuberite-124fc8bc664f96158b4db28372da62896d1db211.tar.gz cuberite-124fc8bc664f96158b4db28372da62896d1db211.tar.bz2 cuberite-124fc8bc664f96158b4db28372da62896d1db211.tar.lz cuberite-124fc8bc664f96158b4db28372da62896d1db211.tar.xz cuberite-124fc8bc664f96158b4db28372da62896d1db211.tar.zst cuberite-124fc8bc664f96158b4db28372da62896d1db211.zip |
Diffstat (limited to 'src/WorldStorage/FireworksSerializer.cpp')
-rw-r--r-- | src/WorldStorage/FireworksSerializer.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/WorldStorage/FireworksSerializer.cpp b/src/WorldStorage/FireworksSerializer.cpp index 7f5077912..34204ae8a 100644 --- a/src/WorldStorage/FireworksSerializer.cpp +++ b/src/WorldStorage/FireworksSerializer.cpp @@ -89,26 +89,28 @@ void cFireworkItem::ParseFromNBT(cFireworkItem & a_FireworkItem, const cParsedNB if (ExplosionName == "Colors") { - if (a_NBT.GetDataLength(explosiontag) == 0) + int DataLength = a_NBT.GetDataLength(explosiontag); + if (DataLength == 0) { continue; } const int * ColourData = (const int *)(a_NBT.GetData(explosiontag)); - for (int i = 0; i < ARRAYCOUNT(ColourData); i++) + for (int i = 0; i < DataLength; i++) { a_FireworkItem.m_Colours.push_back(ntohl(ColourData[i])); } } else if (ExplosionName == "FadeColors") { - if (a_NBT.GetDataLength(explosiontag) == 0) + int DataLength = a_NBT.GetDataLength(explosiontag); + if (DataLength == 0) { continue; } const int * FadeColourData = (const int *)(a_NBT.GetData(explosiontag)); - for (int i = 0; i < ARRAYCOUNT(FadeColourData); i++) + for (int i = 0; i < DataLength; i++) { a_FireworkItem.m_FadeColours.push_back(ntohl(FadeColourData[i])); } @@ -244,6 +246,6 @@ int cFireworkItem::GetVanillaColourCodeFromDye(short a_DyeMeta) case E_META_DYE_MAGENTA: return 12801229; case E_META_DYE_ORANGE: return 15435844; case E_META_DYE_WHITE: return 15790320; - default: ASSERT(!"Unhandled dye meta whilst trying to get colour code for fireworks!"); break; + default: ASSERT(!"Unhandled dye meta whilst trying to get colour code for fireworks!"); return 0; } } |