summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player.h
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-05 20:50:54 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-05 22:30:03 +0100
commitdc3f573c6ef467ddcc4a837ce90ca9df3b502c2e (patch)
treef7915736d0a9bad11d83c3ff8a0263577a27e979 /crawl-ref/source/player.h
parent31124ec682c2b826f169c23e808fa741a3033a04 (diff)
downloadcrawl-ref-dc3f573c6ef467ddcc4a837ce90ca9df3b502c2e.tar.gz
crawl-ref-dc3f573c6ef467ddcc4a837ce90ca9df3b502c2e.zip
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.
Diffstat (limited to 'crawl-ref/source/player.h')
-rw-r--r--crawl-ref/source/player.h27
1 files changed, 20 insertions, 7 deletions
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<int> 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<int> beholders;
+
protected:
FixedVector<PlaceInfo, NUM_BRANCHES> branch_info;
FixedVector<PlaceInfo, NUM_LEVEL_AREA_TYPES - 1> 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);