From 7296afe57a7ea99996e083e646395f4f4be95648 Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Tue, 10 Nov 2009 13:35:52 +0100 Subject: Remove inside_level_bounds. This was a weird mix of in_bounds and map_bounds (exclusive top-left, inclusive top-right). Replaced with in_bounds. --- crawl-ref/source/dungeon.cc | 3 +-- crawl-ref/source/mon-abil.cc | 2 +- crawl-ref/source/mon-behv.cc | 2 +- crawl-ref/source/mon-util.cc | 3 +-- crawl-ref/source/spells3.cc | 4 ++-- crawl-ref/source/travel.cc | 2 +- crawl-ref/source/view.cc | 10 ---------- crawl-ref/source/view.h | 3 +-- 8 files changed, 8 insertions(+), 21 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index b5a9659482..454c4f5fb9 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -56,7 +56,6 @@ #include "terrain.h" #include "traps.h" #include "travel.h" -#include "view.h" #include "shout.h" #ifdef WIZARD @@ -2879,7 +2878,7 @@ static bool _shaft_is_in_corridor(const coord_def& c) for (unsigned int i = 0; i < ARRAYSZ(adjs); ++i) { const coord_def spot = c + adjs[i]; - if (!inside_level_bounds(spot) || grd(spot) < DNGN_SHALLOW_WATER) + if (!in_bounds(spot) || grd(spot) < DNGN_SHALLOW_WATER) return (true); } return (false); diff --git a/crawl-ref/source/mon-abil.cc b/crawl-ref/source/mon-abil.cc index 5948585d3d..3f52e69449 100644 --- a/crawl-ref/source/mon-abil.cc +++ b/crawl-ref/source/mon-abil.cc @@ -851,7 +851,7 @@ bool mon_special_ability(monsters *monster, bolt & beem) coord_def sg(sgn(diff.x), sgn(diff.y)); coord_def t = monster->pos() + sg; - if (!inside_level_bounds(t)) + if (!in_bounds(t)) continue; if (!feat_is_solid(grd(t))) diff --git a/crawl-ref/source/mon-behv.cc b/crawl-ref/source/mon-behv.cc index 56dce671b0..6fd35d26d3 100644 --- a/crawl-ref/source/mon-behv.cc +++ b/crawl-ref/source/mon-behv.cc @@ -1594,7 +1594,7 @@ void handle_behaviour(monsters *mon) static bool _mons_check_foe(monsters *mon, const coord_def& p, bool friendly, bool neutral) { - if (!inside_level_bounds(p)) + if (!in_bounds(p)) return (false); if (!friendly && !neutral && p == you.pos() diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 29bbfa53db..233c22368b 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -33,7 +33,6 @@ #include "state.h" #include "stuff.h" #include "terrain.h" -#include "view.h" #include "shout.h" //jmf: moved from inside function @@ -2008,7 +2007,7 @@ bool mons_is_influenced_by_sanctuary(const monsters *m) bool mons_is_fleeing_sanctuary(const monsters *m) { return (mons_is_influenced_by_sanctuary(m) - && inside_level_bounds(env.sanctuary_pos) + && in_bounds(env.sanctuary_pos) && (m->flags & MF_FLEEING_FROM_SANCTUARY)); } diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index b95e2fc73a..52b848dbdd 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -1712,7 +1712,7 @@ bool entomb(int powc) // Otherwise, return -1. static int _inside_circle(const coord_def& where, int radius) { - if (!inside_level_bounds(where)) + if (!in_bounds(where)) return -1; const coord_def ep = grid2view(where); @@ -1736,7 +1736,7 @@ bool remove_sanctuary(bool did_attack) if (env.sanctuary_time) env.sanctuary_time = 0; - if (!inside_level_bounds(env.sanctuary_pos)) + if (!in_bounds(env.sanctuary_pos)) return (false); const int radius = 5; diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index c0ab8904de..7e0293d58b 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -250,7 +250,7 @@ static void _init_traps() int x = env.trap[i].pos.x, y = env.trap[i].pos.y; - if (inside_level_bounds(x,y)) + if (in_bounds(x,y)) curr_traps[x][y] = i; } traps_inited = true; diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 05e43236bc..e333bec5e6 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -86,16 +86,6 @@ crawl_view_geometry crawl_view; -bool inside_level_bounds(int x, int y) -{ - return (x > 0 && x < GXM && y > 0 && y < GYM); -} - -bool inside_level_bounds(const coord_def &p) -{ - return (inside_level_bounds(p.x, p.y)); -} - bool is_notable_terrain(dungeon_feature_type ftype) { return (get_feature_def(ftype).is_notable()); diff --git a/crawl-ref/source/view.h b/crawl-ref/source/view.h index 0ebe7859e2..0e55871761 100644 --- a/crawl-ref/source/view.h +++ b/crawl-ref/source/view.h @@ -28,8 +28,7 @@ void reautomap_level(); class level_pos; void show_map( level_pos &spec_place, bool travel_mode, bool allow_esc = false ); bool is_feature(int feature, const coord_def& where); -bool inside_level_bounds(int x, int y); -bool inside_level_bounds(const coord_def &p); + void clear_feature_overrides(); void add_feature_override(const std::string &text); -- cgit v1.2.3-54-g00ecf