Fix compability with some servers fly systems

master
Eduardo Bart 12 years ago
parent ea2fa55a25
commit 06388c5673

@ -481,10 +481,9 @@ void Game::walk(Otc::Direction direction)
Position pos = toPos; Position pos = toPos;
if(!pos.down()) if(!pos.down())
return false; return false;
toTile = g_map.getTile(pos); TilePtr toTile = g_map.getTile(pos);
if(toTile && toTile->hasElevation(3)) { if(toTile && toTile->hasElevation(3))
return true; return true;
}
return false; return false;
}; };
@ -496,13 +495,14 @@ void Game::walk(Otc::Direction direction)
Position pos = toPos; Position pos = toPos;
if(!pos.up()) if(!pos.up())
return false; return false;
toTile = g_map.getTile(pos); TilePtr toTile = g_map.getTile(pos);
if(!toTile || !toTile->isWalkable()) if(!toTile || !toTile->isWalkable())
return false; return false;
return true; return true;
}; };
if(canChangeFloorDown() || canChangeFloorUp()) { if(canChangeFloorDown() || canChangeFloorUp() ||
(!toTile || toTile->isEmpty())) {
m_localPlayer->lockWalk(); m_localPlayer->lockWalk();
} else } else
return; return;

@ -312,7 +312,7 @@ void MapView::updateVisibleTilesCache(int start)
tilePos.coveredUp(cameraPosition.z - iz); tilePos.coveredUp(cameraPosition.z - iz);
if(const TilePtr& tile = g_map.getTile(tilePos)) { if(const TilePtr& tile = g_map.getTile(tilePos)) {
// skip tiles that have nothing // skip tiles that have nothing
if(tile->isEmpty()) if(!tile->isDrawable())
continue; continue;
// skip tiles that are completely behind another tile // skip tiles that are completely behind another tile
if(g_map.isCompletelyCovered(tilePos, m_cachedFirstVisibleFloor)) if(g_map.isCompletelyCovered(tilePos, m_cachedFirstVisibleFloor))
@ -366,7 +366,7 @@ void MapView::updateVisibleTilesCache(int start)
Position tilePos = cameraPosition.translated(p.x - m_virtualCenterOffset.x, p.y - m_virtualCenterOffset.y); Position tilePos = cameraPosition.translated(p.x - m_virtualCenterOffset.x, p.y - m_virtualCenterOffset.y);
tilePos.coveredUp(cameraPosition.z - iz); tilePos.coveredUp(cameraPosition.z - iz);
if(const TilePtr& tile = g_map.getTile(tilePos)) { if(const TilePtr& tile = g_map.getTile(tilePos)) {
if(!tile->isEmpty()) if(tile->isDrawable())
m_cachedVisibleTiles.push_back(tile); m_cachedVisibleTiles.push_back(tile);
} }
} }

@ -60,10 +60,13 @@ void ProtocolGame::onRecv(const InputMessagePtr& inputMessage)
{ {
if(m_firstRecv) { if(m_firstRecv) {
m_firstRecv = false; m_firstRecv = false;
int size = inputMessage->getU16();
if(size != inputMessage->getUnreadSize()) { if(g_game.getClientVersion() > 810) {
g_logger.traceError("invalid message size"); int size = inputMessage->getU16();
return; if(size != inputMessage->getUnreadSize()) {
g_logger.traceError("invalid message size");
return;
}
} }
} }

@ -504,6 +504,11 @@ bool Tile::isEmpty()
return m_things.size() == 0; return m_things.size() == 0;
} }
bool Tile::isDrawable()
{
return !m_things.empty() || !m_walkingCreatures.empty() || !m_effects.empty();
}
bool Tile::mustHookEast() bool Tile::mustHookEast()
{ {
for(const ThingPtr& thing : m_things) for(const ThingPtr& thing : m_things)

@ -98,6 +98,7 @@ public:
bool isLookPossible(); bool isLookPossible();
bool isClickable(); bool isClickable();
bool isEmpty(); bool isEmpty();
bool isDrawable();
bool mustHookSouth(); bool mustHookSouth();
bool mustHookEast(); bool mustHookEast();
bool hasCreature(); bool hasCreature();

Loading…
Cancel
Save