From dc3f573c6ef467ddcc4a837ce90ca9df3b502c2e Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Thu, 5 Nov 2009 20:50:54 +0100 Subject: Unify mesmerisation code. There were several places that had copies of the same code, checking whether mesmerisation blocked movement to a given target. The various mesmerisation functions have become methods of player and were moved into behold.cc. --- crawl-ref/source/player.h | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'crawl-ref/source/player.h') diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h index 97fc296692..8ec9756c8d 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -35,8 +35,6 @@ public: bool banished; std::string banished_by; - std::vector mesmerised_by; // monsters mesmerising player - int friendly_pickup; // pickup setting for allies unsigned short prev_targ; @@ -283,10 +281,15 @@ public: // When other levels are loaded (e.g. viewing), is the player on this level? bool on_current_level; + // monsters mesmerising player; should be proteced, but needs to be saved + // and restored. + std::vector beholders; + protected: FixedVector branch_info; FixedVector non_branch_info; + public: player(); player(const player &other); @@ -319,6 +322,18 @@ public: bool light_flight() const; bool travelling_light() const; + // Dealing with beholders. Implemented in behold.cc. + void add_beholder(const monsters *mon); + bool beheld() const; + bool beheld_by(const monsters *mon) const; + monsters* get_beholder(const coord_def &pos) const; + monsters* get_any_beholder() const; + void remove_beholder(const monsters *mon); + void clear_beholders(); + void beholders_check_noise(int loudness); + void update_beholders(); + void update_beholder(const monsters *mon); + kill_category kill_alignment() const; bool has_spell(spell_type spell) const; @@ -489,6 +504,9 @@ public: protected: void base_moveto(const coord_def &c); + + void _removed_beholder(); + bool _possible_beholder(const monsters *mon) const; }; extern player you; @@ -633,11 +651,6 @@ int scan_artefacts(artefact_prop_type which_property, bool calc_unid = true); int slaying_bonus(char which_affected, bool ranged = false); - -bool player_mesmerised_by(const monsters *mon); -void update_beholders(const monsters *mon, bool force = false); -void check_beholders(); - unsigned long exp_needed(int lev); int get_expiration_threshold(duration_type dur); -- cgit v1.2.3-54-g00ecf