Fix stackpos bug again
This commit is contained in:
parent
e244e1975d
commit
3c26555255
|
@ -305,6 +305,7 @@ void Map::setCentralPosition(const Position& centralPosition)
|
|||
localPlayer->onDisappear();
|
||||
localPlayer->setPosition(pos);
|
||||
localPlayer->onAppear();
|
||||
g_logger.debug("forced player position update");
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -497,7 +497,8 @@ void ProtocolGame::parseTileRemoveThing(const InputMessagePtr& msg)
|
|||
return;
|
||||
}
|
||||
|
||||
g_map.removeThing(thing);
|
||||
if(!g_map.removeThing(thing))
|
||||
g_logger.traceError("unable to remove thing");
|
||||
}
|
||||
|
||||
void ProtocolGame::parseCreatureMove(const InputMessagePtr& msg)
|
||||
|
@ -510,7 +511,11 @@ void ProtocolGame::parseCreatureMove(const InputMessagePtr& msg)
|
|||
return;
|
||||
}
|
||||
|
||||
g_map.removeThing(thing);
|
||||
if(!g_map.removeThing(thing)) {
|
||||
g_logger.traceError("unable to remove creature");
|
||||
return;
|
||||
}
|
||||
|
||||
g_map.addThing(thing, newPos, -1);
|
||||
}
|
||||
|
||||
|
@ -1399,7 +1404,7 @@ int ProtocolGame::setTileDescription(const InputMessagePtr& msg, Position positi
|
|||
g_logger.traceError(stdext::format("too many things, pos=%s, stackpos=%d", stdext::to_string(position), stackPos));
|
||||
|
||||
ThingPtr thing = getThing(msg);
|
||||
g_map.addThing(thing, position, -2);
|
||||
g_map.addThing(thing, position, stackPos);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -171,14 +171,17 @@ void Tile::addThing(const ThingPtr& thing, int stackPos)
|
|||
// -1 or 255 => auto detect position
|
||||
// -2 => append
|
||||
|
||||
bool append = (stackPos == -2 || priority <= 3);
|
||||
bool append;
|
||||
if(stackPos == -2)
|
||||
append = true;
|
||||
else {
|
||||
append = (priority <= 3);
|
||||
|
||||
// newer protocols does not store creatures in reverse order
|
||||
if(g_game.getClientVersion() >= 854 && priority == 4)
|
||||
append = !append;
|
||||
}
|
||||
|
||||
if(g_game.getClientVersion() < 900 && priority == 4 && stackPos == -2)
|
||||
append = !append;
|
||||
|
||||
for(stackPos = 0; stackPos < (int)m_things.size(); ++stackPos) {
|
||||
int otherPriority = m_things[stackPos]->getStackPriority();
|
||||
|
|
Loading…
Reference in New Issue