diff --git a/Minecraft.World/TextureAndGeometryPacket.cpp b/Minecraft.World/TextureAndGeometryPacket.cpp index 44309caa..ec121ab2 100644 --- a/Minecraft.World/TextureAndGeometryPacket.cpp +++ b/Minecraft.World/TextureAndGeometryPacket.cpp @@ -184,7 +184,6 @@ void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException uiAnimOverrideBitmask = dis->readInt(); short rawBoxC = dis->readShort(); - short rawOffsetC = dis->readShort(); if (rawBoxC <= 0) { dwBoxC = 0; @@ -197,27 +196,12 @@ void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException dwBoxC = 0; // sane limit for skin boxes } } - if (rawOffsetC <= 0) - { - dwOffsetC = 0; - } - else - { - dwOffsetC = (DWORD)(unsigned short)rawOffsetC; - if (dwOffsetC > 256) - { - dwOffsetC = 0; // sane limit for skin offsets - } - } + if(dwBoxC>0) { this->BoxDataA= new SKIN_BOX [dwBoxC]; } - if(dwOffsetC>0) - { - this->OffsetDataA= new SKIN_OFFSET [dwOffsetC]; - } for(DWORD i=0;iBoxDataA[i].fM = dis->readFloat(); this->BoxDataA[i].fS = dis->readFloat(); } + + short rawOffsetC = dis->readShort(); + + if (rawOffsetC <= 0) + { + dwOffsetC = 0; + } + else + { + dwOffsetC = (DWORD)(unsigned short)rawOffsetC; + if (dwOffsetC > 256) + { + dwOffsetC = 0; // sane limit for skin offsets + } + } + + if (dwOffsetC > 0) + { + this->OffsetDataA = new SKIN_OFFSET[dwOffsetC]; + } + for(DWORD i=0;iOffsetDataA[i].ePart = static_cast(dis->readShort());