From a24fe381748f068d5196648fbefbb58472b898c6 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Wed, 8 Feb 2012 02:20:14 -0200 Subject: [PATCH] fix some issues with stackpos --- src/otclient/core/tile.cpp | 9 ++++++++- src/otclient/net/protocolgameparse.cpp | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/otclient/core/tile.cpp b/src/otclient/core/tile.cpp index 94bd6462..e26abb3e 100644 --- a/src/otclient/core/tile.cpp +++ b/src/otclient/core/tile.cpp @@ -157,11 +157,18 @@ ThingPtr Tile::addThing(const ThingPtr& thing, int stackPos) } if(stackPos < 0) { + // the items stackpos follows this order: + // 0 - ground + // 1 - ground borders + // 2 - bottom (walls) + // 3 - on top (doors) + // 4 - creatures, from top to bottom + // 5 - items, from top to bottom stackPos = 0; int priority = thing->getStackPriority(); for(stackPos = 0; stackPos < (int)m_things.size(); ++stackPos) { int otherPriority = m_things[stackPos]->getStackPriority(); - if(otherPriority > priority || (otherPriority == priority && otherPriority == 5)) + if(otherPriority > priority) break; } } else if(stackPos > (int)m_things.size()) diff --git a/src/otclient/net/protocolgameparse.cpp b/src/otclient/net/protocolgameparse.cpp index 6d9aa782..995d4c03 100644 --- a/src/otclient/net/protocolgameparse.cpp +++ b/src/otclient/net/protocolgameparse.cpp @@ -994,7 +994,7 @@ void ProtocolGame::setTileDescription(InputMessage& msg, Position position) ThingPtr thing = internalGetThing(msg); if(thing) - g_map.addThing(thing, position, 255); + g_map.addThing(thing, position, -1); } stackPos++; }