X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=inline;f=src%2Fmap%2FMapState.cpp;h=791cc0bb319373ccceaaba6a7ae70b5d4fdda211;hb=ed792d6d00d822384d79d049e644e372f7c3b4cd;hp=7e6d7328d2756bb533527cf41efc25a9a2b6f703;hpb=7fb774ec1df3d550cd8a6805bdc69c11ad36e498;p=l2e.git diff --git a/src/map/MapState.cpp b/src/map/MapState.cpp index 7e6d732..791cc0b 100644 --- a/src/map/MapState.cpp +++ b/src/map/MapState.cpp @@ -133,11 +133,14 @@ void MapState::OnTileLock() { } bool MapState::CheckBlocking() const { - const Tile &tile(map->TileAt(controlled->Position())); + const Tile *tile(map->TileAt(controlled->Position())); + if (!tile) { + return false; + } Vector nextPosition; switch (nextDirection) { case Entity::ORIENTATION_NORTH: - if (tile.BlocksNorth()) { + if (tile->BlocksNorth()) { return true; } else { nextPosition = Vector( @@ -146,7 +149,7 @@ bool MapState::CheckBlocking() const { } break; case Entity::ORIENTATION_EAST: - if (tile.BlocksEast()) { + if (tile->BlocksEast()) { return true; } else { nextPosition = Vector( @@ -155,7 +158,7 @@ bool MapState::CheckBlocking() const { } break; case Entity::ORIENTATION_SOUTH: - if (tile.BlocksSouth()) { + if (tile->BlocksSouth()) { return true; } else { nextPosition = Vector( @@ -164,7 +167,7 @@ bool MapState::CheckBlocking() const { } break; case Entity::ORIENTATION_WEST: - if (tile.BlocksWest()) { + if (tile->BlocksWest()) { return true; } else { nextPosition = Vector(