more otserv compatibilities fixes

This commit is contained in:
Eduardo Bart 2012-05-11 18:40:40 -03:00
parent d586bb5e93
commit cc261931be
4 changed files with 7 additions and 9 deletions

View File

@ -376,10 +376,7 @@ void Creature::updateWalkingTile()
// only render creatures where bottom right is inside tile rect // only render creatures where bottom right is inside tile rect
if(virtualTileRect.contains(virtualCreatureRect.bottomRight())) { if(virtualTileRect.contains(virtualCreatureRect.bottomRight())) {
const TilePtr& tile = g_map.getTile(m_position.translated(xi, yi, 0)); newWalkingTile = g_map.getOrCreateTile(m_position.translated(xi, yi, 0));
if(!tile)
continue;
newWalkingTile = tile;
} }
} }
} }

View File

@ -266,9 +266,6 @@ void Map::addCreature(const CreaturePtr& creature)
CreaturePtr Map::getCreatureById(uint32 id) CreaturePtr Map::getCreatureById(uint32 id)
{ {
LocalPlayerPtr localPlayer = g_game.getLocalPlayer();
if(localPlayer && localPlayer->getId() == id)
return localPlayer;
auto it = m_knownCreatures.find(id); auto it = m_knownCreatures.find(id);
if(it == m_knownCreatures.end()) if(it == m_knownCreatures.end())
return nullptr; return nullptr;

View File

@ -170,6 +170,11 @@ ThingPtr Tile::addThing(const ThingPtr& thing, int stackPos)
int priority = thing->getStackPriority(); int priority = thing->getStackPriority();
for(stackPos = 0; stackPos < (int)m_things.size(); ++stackPos) { for(stackPos = 0; stackPos < (int)m_things.size(); ++stackPos) {
int otherPriority = m_things[stackPos]->getStackPriority(); int otherPriority = m_things[stackPos]->getStackPriority();
#if PROTOCOL<=810
// older protocols stores creatures in reverse order
if(priority == 4 && otherPriority == 4)
break;
#endif
if(otherPriority > priority) if(otherPriority > priority)
break; break;
} }

View File

@ -388,6 +388,7 @@ void ProtocolGame::parseMapMoveWest(InputMessage& msg)
void ProtocolGame::parseUpdateTile(InputMessage& msg) void ProtocolGame::parseUpdateTile(InputMessage& msg)
{ {
Position tilePos = parsePosition(msg); Position tilePos = parsePosition(msg);
g_map.cleanTile(tilePos);
int thingId = msg.getU16(true); int thingId = msg.getU16(true);
if(thingId == 0xFF01) { if(thingId == 0xFF01) {
msg.getU16(); msg.getU16();
@ -1161,8 +1162,6 @@ void ProtocolGame::setFloorDescription(InputMessage& msg, int32 x, int32 y, int3
void ProtocolGame::setTileDescription(InputMessage& msg, Position position) void ProtocolGame::setTileDescription(InputMessage& msg, Position position)
{ {
g_map.cleanTile(position);
int stackPos = 0; int stackPos = 0;
while(true) { while(true) {
int inspectItemId = msg.getU16(true); int inspectItemId = msg.getU16(true);