Fix floor change stackpos bug?

This commit is contained in:
Eduardo Bart 2012-08-02 11:47:32 -03:00
parent 5ecb890b06
commit 11387eb08f
3 changed files with 11 additions and 10 deletions

View File

@ -183,7 +183,7 @@ bool Map::removeThingByPos(const Position& pos, int stackPos)
const TilePtr& Map::createTile(const Position& pos)
{
if(!pos.isValid())
if(!pos.isMapPosition())
return m_nulltile;
if(pos.x < m_tilesRect.left())
m_tilesRect.setLeft(pos.x);
@ -212,7 +212,7 @@ const TilePtr& Map::createTileEx(const Position& pos, const Items&... items)
const TilePtr& Map::getOrCreateTile(const Position& pos)
{
if(!pos.isValid())
if(!pos.isMapPosition())
return m_nulltile;
if(pos.x < m_tilesRect.left())
m_tilesRect.setLeft(pos.x);
@ -228,7 +228,7 @@ const TilePtr& Map::getOrCreateTile(const Position& pos)
const TilePtr& Map::getTile(const Position& pos)
{
if(!pos.isValid())
if(!pos.isMapPosition())
return m_nulltile;
auto it = m_tileBlocks[pos.z].find(getBlockIndex(pos));
if(it != m_tileBlocks[pos.z].end())
@ -238,7 +238,7 @@ const TilePtr& Map::getTile(const Position& pos)
void Map::cleanTile(const Position& pos)
{
if(!pos.isValid())
if(!pos.isMapPosition())
return;
auto it = m_tileBlocks[pos.z].find(getBlockIndex(pos));
if(it != m_tileBlocks[pos.z].end()) {

View File

@ -499,13 +499,8 @@ void ProtocolGame::parseCreatureMove(const InputMessagePtr& msg)
return;
}
int stackPos = -2;
// newer protocols stores creatures in reverse order
if(!g_game.getClientVersion() >= 854)
stackPos = -1;
g_map.removeThing(thing);
g_map.addThing(thing, newPos, stackPos);
g_map.addThing(thing, newPos, -1);
}
void ProtocolGame::parseOpenContainer(const InputMessagePtr& msg)

View File

@ -167,7 +167,13 @@ void Tile::addThing(const ThingPtr& thing, int stackPos)
// 5 - items, from top to bottom
if(stackPos < 0 || stackPos == 255) {
int priority = thing->getStackPriority();
bool prepend = (stackPos == -2 || priority <= 3);
// newer protocols does not store creatures in reverse order
if(g_game.getClientVersion() >= 854 && priority == 4)
prepend = !prepend;
for(stackPos = 0; stackPos < (int)m_things.size(); ++stackPos) {
int otherPriority = m_things[stackPos]->getStackPriority();
if((prepend && otherPriority > priority) || (!prepend && otherPriority >= priority))