diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/map.cpp b/src/map.cpp index 0f531288..d4fb9dde 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -214,10 +214,16 @@ void Map::setWalk(int x, int y, bool walkable) bool Map::getWalk(int x, int y) { + // You can't walk outside of the map + if (x < 0 || y < 0 || x >= width || y >= height) { + return false; + } + + // Check if the tile is walkable bool ret = metaTiles[x + y * width].walkable; + // If walkable, check for colliding into a being if (ret) { - // Check for colliding into a being std::list<Being*>::iterator i = beings.begin(); while (i != beings.end() && ret) { Being *being = (*i); |