Fix compability with some servers fly systems

This commit is contained in:
Eduardo Bart 2012-08-03 00:05:13 -03:00
parent ea2fa55a25
commit 06388c5673
5 changed files with 20 additions and 11 deletions

View File

@ -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;

View File

@ -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);
}
}

View File

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

View File

@ -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)

View File

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