From d21b754210905c4bf50e0c346d820b3d8b1af01c Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Fri, 13 Nov 2009 15:06:56 +0100 Subject: Move trans_wall_blocking into player. --- crawl-ref/source/actor-los.cc | 5 +++++ crawl-ref/source/los.cc | 6 ------ crawl-ref/source/los.h | 1 - crawl-ref/source/mon-behv.cc | 2 +- crawl-ref/source/player.h | 2 ++ crawl-ref/source/spells1.cc | 4 ++-- crawl-ref/source/spells4.cc | 4 ++-- crawl-ref/source/teleport.cc | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/actor-los.cc b/crawl-ref/source/actor-los.cc index bc7f1c4868..25361a7177 100644 --- a/crawl-ref/source/actor-los.cc +++ b/crawl-ref/source/actor-los.cc @@ -32,6 +32,11 @@ bool player::see_cell_no_trans(const coord_def &p) const return (los_no_trans.see_cell(p)); } +bool player::trans_wall_blocking(const coord_def &p) const +{ + return (see_cell(p) && !see_cell_no_trans(p)); +} + const los_def& actor::get_los() const { return (los); diff --git a/crawl-ref/source/los.cc b/crawl-ref/source/los.cc index 0931802478..9a3354eac0 100644 --- a/crawl-ref/source/los.cc +++ b/crawl-ref/source/los.cc @@ -904,9 +904,3 @@ void calc_show_los() if (!crawl_state.arena && !crawl_state.arena_suspended) you.update_los(); } - -// Is the cell visible, but a translucent wall is in the way? -bool trans_wall_blocking(const coord_def &p) -{ - return (you.see_cell(p) && !you.see_cell_no_trans(p)); -} diff --git a/crawl-ref/source/los.h b/crawl-ref/source/los.h index 35ce06ed54..c39a9f4143 100644 --- a/crawl-ref/source/los.h +++ b/crawl-ref/source/los.h @@ -48,6 +48,5 @@ void losight(los_grid& sh, const coord_def& center, void losight(los_grid& sh, const los_param& param); void calc_show_los(); -bool trans_wall_blocking( const coord_def &p ); #endif diff --git a/crawl-ref/source/mon-behv.cc b/crawl-ref/source/mon-behv.cc index 4d5321ae18..df5647d123 100644 --- a/crawl-ref/source/mon-behv.cc +++ b/crawl-ref/source/mon-behv.cc @@ -1092,7 +1092,7 @@ void handle_behaviour(monsters *mon) // or has guessed the player's location. bool proxPlayer = mons_near(mon) && !crawl_state.arena; - bool trans_wall_block = trans_wall_blocking(mon->pos()); + bool trans_wall_block = you.trans_wall_blocking(mon->pos()); #ifdef WIZARD // If stealth is greater than actually possible (wizmode level) diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h index 4cc53caab8..b705e889d4 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -328,6 +328,8 @@ public: bool see_cell(const coord_def& c) const; bool see_cell_no_trans(const coord_def &c) const; + // Is c in view but behind a transparent wall? + bool trans_wall_blocking(const coord_def &c) const; void update_los(); bool is_icy() const; diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index da3b065aea..f6e386bffc 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -138,7 +138,7 @@ int blink(int pow, bool high_level_controlled_blink, bool wizard_blink) // Grid in los, no problem. break; } - else if (trans_wall_blocking( beam.target )) + else if (you.trans_wall_blocking( beam.target )) { // Wizard blink can move past translucent walls. if (wizard_blink) @@ -557,7 +557,7 @@ bool conjure_flame(int pow, const coord_def& where) return (false); } - if (trans_wall_blocking(where)) + if (you.trans_wall_blocking(where)) { mpr("A translucent wall is in the way."); return (false); diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index 83840ea20d..bbd80c8cab 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -1777,7 +1777,7 @@ bool cast_portal_projectile(int pow) } // Can't use portal through walls. (That'd be just too cheap!) - if (trans_wall_blocking( target.target )) + if (you.trans_wall_blocking( target.target )) { mpr("A translucent wall is in the way."); return (false); @@ -1801,7 +1801,7 @@ bool cast_apportation(int pow, const coord_def& where) return (false); } - if (trans_wall_blocking(where)) + if (you.trans_wall_blocking(where)) { mpr("A translucent wall is in the way."); return (false); diff --git a/crawl-ref/source/teleport.cc b/crawl-ref/source/teleport.cc index 133590ef1b..fe0c2f4b7f 100644 --- a/crawl-ref/source/teleport.cc +++ b/crawl-ref/source/teleport.cc @@ -30,7 +30,7 @@ bool random_near_space(const coord_def& origin, coord_def& target, tried.init(false); // Is the monster on the other side of a transparent wall? - const bool trans_wall_block = trans_wall_blocking(origin); + const bool trans_wall_block = you.trans_wall_blocking(origin); const bool origin_is_player = (you.pos() == origin); int min_walls_between = 0; -- cgit v1.2.3-54-g00ecf