summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/view.cc
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/view.cc
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/view.cc')
-rw-r--r--crawl-ref/source/view.cc35
1 files changed, 6 insertions, 29 deletions
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index e032183849..a17925354d 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -158,31 +158,14 @@ static void _get_symbol( const coord_def& where,
&& feat <= DNGN_ESCAPE_HATCH_UP
&& is_exclude_root(where));
- bool blocked_movement = false;
- if (!excluded_stairs
- && feat >= DNGN_MINMOVE
- && you.duration[DUR_MESMERISED])
+ if (excluded_stairs)
+ *colour = Options.tc_excluded | colmask;
+ else if (feat >= DNGN_MINMOVE && you.get_beholder(where))
{
// Colour grids that cannot be reached due to beholders
// dark grey.
- for (unsigned int i = 0; i < you.mesmerised_by.size(); i++)
- {
- monsters& mon = menv[you.mesmerised_by[i]];
- const int olddist = grid_distance(you.pos(), mon.pos());
- const int newdist = grid_distance(where, mon.pos());
-
- if (olddist < newdist)
- {
- blocked_movement = true;
- break;
- }
- }
- }
-
- if (excluded_stairs)
- *colour = Options.tc_excluded | colmask;
- else if (blocked_movement)
*colour = DARKGREY | colmask;
+ }
else if (feat >= DNGN_MINMOVE && is_sanctuary(where))
{
if (testbits(env.map(where).property, FPROP_SANCTUARY_1))
@@ -953,14 +936,8 @@ bool noisy(int loudness, const coord_def& where, const char *msg, int who,
you.check_awaken(dist - player_distance);
- if (!mermaid && loudness >= 20 && you.duration[DUR_MESMERISED])
- {
- mprf("For a moment, you cannot hear the mermaid%s!",
- you.mesmerised_by.size() == 1? "" : "s");
- mpr("You break out of your daze!", MSGCH_DURATION);
- you.duration[DUR_MESMERISED] = 0;
- you.mesmerised_by.clear();
- }
+ if (!mermaid)
+ you.beholders_check_noise(loudness);
ret = true;
}