1
0

Fixed alignment issues in Fireworks Serializer

This commit is contained in:
Tycho 2014-03-10 11:13:07 -07:00
parent 7c974b27b1
commit 8864e7d8ca

View File

@ -90,16 +90,16 @@ void cFireworkItem::ParseFromNBT(cFireworkItem & a_FireworkItem, const cParsedNB
if (ExplosionName == "Colors") if (ExplosionName == "Colors")
{ {
// Divide by four as data length returned in bytes // Divide by four as data length returned in bytes
int DataLength = a_NBT.GetDataLength(explosiontag) / 4; int DataLength = a_NBT.GetDataLength(explosiontag);
if (DataLength == 0) if (DataLength == 0)
{ {
continue; continue;
} }
const int * ColourData = (const int *)(a_NBT.GetData(explosiontag)); const char * ColourData = (a_NBT.GetData(explosiontag));
for (int i = 0; i < DataLength; i++) for (int i = 0; i < DataLength; i += 4 /* Size of network int*/)
{ {
a_FireworkItem.m_Colours.push_back(ntohl(ColourData[i])); a_FireworkItem.m_Colours.push_back(GetBEInt(ColourData + i));
} }
} }
else if (ExplosionName == "FadeColors") else if (ExplosionName == "FadeColors")
@ -110,10 +110,10 @@ void cFireworkItem::ParseFromNBT(cFireworkItem & a_FireworkItem, const cParsedNB
continue; continue;
} }
const int * FadeColourData = (const int *)(a_NBT.GetData(explosiontag)); const char * FadeColourData = (a_NBT.GetData(explosiontag));
for (int i = 0; i < DataLength; i++) for (int i = 0; i < DataLength; i += 4 /* Size of network int*/)
{ {
a_FireworkItem.m_FadeColours.push_back(ntohl(FadeColourData[i])); a_FireworkItem.m_FadeColours.push_back(GetBEInt(FadeColourData + i));
} }
} }
} }