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

@ -312,7 +312,7 @@ void MapView::updateVisibleTilesCache(int start)
tilePos.coveredUp(cameraPosition.z - iz);
if(const TilePtr& tile = g_map.getTile(tilePos)) {
// skip tiles that have nothing
if(tile->isEmpty())
if(!tile->isDrawable())
continue;
// skip tiles that are completely behind another tile
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);
tilePos.coveredUp(cameraPosition.z - iz);
if(const TilePtr& tile = g_map.getTile(tilePos)) {
if(!tile->isEmpty())
if(tile->isDrawable())
m_cachedVisibleTiles.push_back(tile);
}
}

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

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

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

Loading…
Cancel
Save