]> git.localhorst.tv Git - l2e.git/blobdiff - src/map/MapState.cpp
made TileAt/AreaAt fail silently
[l2e.git] / src / map / MapState.cpp
index 7e6d7328d2756bb533527cf41efc25a9a2b6f703..791cc0bb319373ccceaaba6a7ae70b5d4fdda211 100644 (file)
@@ -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<int> nextPosition;
        switch (nextDirection) {
                case Entity::ORIENTATION_NORTH:
-                       if (tile.BlocksNorth()) {
+                       if (tile->BlocksNorth()) {
                                return true;
                        } else {
                                nextPosition = Vector<int>(
@@ -146,7 +149,7 @@ bool MapState::CheckBlocking() const {
                        }
                        break;
                case Entity::ORIENTATION_EAST:
-                       if (tile.BlocksEast()) {
+                       if (tile->BlocksEast()) {
                                return true;
                        } else {
                                nextPosition = Vector<int>(
@@ -155,7 +158,7 @@ bool MapState::CheckBlocking() const {
                        }
                        break;
                case Entity::ORIENTATION_SOUTH:
-                       if (tile.BlocksSouth()) {
+                       if (tile->BlocksSouth()) {
                                return true;
                        } else {
                                nextPosition = Vector<int>(
@@ -164,7 +167,7 @@ bool MapState::CheckBlocking() const {
                        }
                        break;
                case Entity::ORIENTATION_WEST:
-                       if (tile.BlocksWest()) {
+                       if (tile->BlocksWest()) {
                                return true;
                        } else {
                                nextPosition = Vector<int>(