}
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>(
}
break;
case Entity::ORIENTATION_EAST:
- if (tile.BlocksEast()) {
+ if (tile->BlocksEast()) {
return true;
} else {
nextPosition = Vector<int>(
}
break;
case Entity::ORIENTATION_SOUTH:
- if (tile.BlocksSouth()) {
+ if (tile->BlocksSouth()) {
return true;
} else {
nextPosition = Vector<int>(
}
break;
case Entity::ORIENTATION_WEST:
- if (tile.BlocksWest()) {
+ if (tile->BlocksWest()) {
return true;
} else {
nextPosition = Vector<int>(