diff options
Diffstat (limited to 'crawl-ref/source/stuff.cc')
-rw-r--r-- | crawl-ref/source/stuff.cc | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc index 0d6368fb83..d724ca5730 100644 --- a/crawl-ref/source/stuff.cc +++ b/crawl-ref/source/stuff.cc @@ -1243,11 +1243,30 @@ bool player_can_hear(const coord_def& p) return (!silenced(p) && !silenced(you.pos())); } +bool in_bounds_x(int x) +{ + return (x > X_BOUND_1 && x < X_BOUND_2); +} + +bool in_bounds_y(int y) +{ + return (y > Y_BOUND_1 && y < Y_BOUND_2); +} + // Returns true if inside the area the player can move and dig (ie exclusive). bool in_bounds(int x, int y) { - return (x > X_BOUND_1 && x < X_BOUND_2 - && y > Y_BOUND_1 && y < Y_BOUND_2); + return (in_bounds_x(x) && in_bounds_y(y)); +} + +bool map_bounds_x(int x) +{ + return (x >= X_BOUND_1 && x <= X_BOUND_2); +} + +bool map_bounds_y(int y) +{ + return (y >= Y_BOUND_1 && y <= Y_BOUND_2); } // Returns true if inside the area the player can map (ie inclusive). @@ -1255,8 +1274,7 @@ bool in_bounds(int x, int y) // ring of rock to frame the level. bool map_bounds(int x, int y) { - return (x >= X_BOUND_1 && x <= X_BOUND_2 - && y >= Y_BOUND_1 && y <= Y_BOUND_2); + return (map_bounds_x(x) && map_bounds_y(y)); } coord_def random_in_bounds() |