From b462416e1fef58b3ddccc92f3dfe613fc27d5483 Mon Sep 17 00:00:00 2001 From: Howaner Date: Sat, 13 Sep 2014 02:20:04 +0200 Subject: 1.8: Fixed maps. --- src/Protocol/Protocol18x.cpp | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'src/Protocol/Protocol18x.cpp') diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp index 735700dda..b3cdcc7bc 100644 --- a/src/Protocol/Protocol18x.cpp +++ b/src/Protocol/Protocol18x.cpp @@ -728,18 +728,21 @@ void cProtocol180::SendPaintingSpawn(const cPainting & a_Painting) -void cProtocol180::SendMapColumn(int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length) +void cProtocol180::SendMapColumn(int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length, unsigned int m_Scale) { ASSERT(m_State == 3); // In game mode? cPacketizer Pkt(*this, 0x34); Pkt.WriteVarInt(a_ID); - Pkt.WriteShort (3 + a_Length); + Pkt.WriteByte(m_Scale); - Pkt.WriteByte(0); + Pkt.WriteVarInt(0); + Pkt.WriteByte(1); + Pkt.WriteByte(a_Length); Pkt.WriteByte(a_X); Pkt.WriteByte(a_Y); - + + Pkt.WriteVarInt(a_Length); for (unsigned int i = 0; i < a_Length; ++i) { Pkt.WriteByte(a_Colors[i]); @@ -750,22 +753,23 @@ void cProtocol180::SendMapColumn(int a_ID, int a_X, int a_Y, const Byte * a_Colo -void cProtocol180::SendMapDecorators(int a_ID, const cMapDecoratorList & a_Decorators) +void cProtocol180::SendMapDecorators(int a_ID, const cMapDecoratorList & a_Decorators, unsigned int m_Scale) { ASSERT(m_State == 3); // In game mode? cPacketizer Pkt(*this, 0x34); Pkt.WriteVarInt(a_ID); - Pkt.WriteShort ((short)(1 + (3 * a_Decorators.size()))); + Pkt.WriteByte(m_Scale); + Pkt.WriteVarInt(a_Decorators.size()); - Pkt.WriteByte(1); - for (cMapDecoratorList::const_iterator it = a_Decorators.begin(); it != a_Decorators.end(); ++it) { Pkt.WriteByte((it->GetType() << 4) | (it->GetRot() & 0xf)); Pkt.WriteByte(it->GetPixelX()); Pkt.WriteByte(it->GetPixelZ()); } + + Pkt.WriteByte(0); } @@ -774,21 +778,16 @@ void cProtocol180::SendMapDecorators(int a_ID, const cMapDecoratorList & a_Decor void cProtocol180::SendMapInfo(int a_ID, unsigned int a_Scale) { - ASSERT(m_State == 3); // In game mode? - - cPacketizer Pkt(*this, 0x34); - Pkt.WriteVarInt(a_ID); - Pkt.WriteShort (2); + UNUSED(a_ID); + UNUSED(a_Scale); - Pkt.WriteByte(2); - Pkt.WriteByte(a_Scale); + // This packet was removed in 1.8 } - void cProtocol180::SendPickupSpawn(const cPickup & a_Pickup) { ASSERT(m_State == 3); // In game mode? -- cgit v1.2.3