diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-05-18 09:40:53 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-05-18 09:40:53 +0000 |
commit | e2cbc98a162d37386b3191ccf16c0d64ad7bb1b2 (patch) | |
tree | 3c3fc7e3c9e0cf7bfaded82101d233492dac2216 /crawl-ref/source/monplace.cc | |
parent | 8f675841ee07a21138fe098204f46018d28ea3b5 (diff) | |
download | crawl-ref-e2cbc98a162d37386b3191ccf16c0d64ad7bb1b2.tar.gz crawl-ref-e2cbc98a162d37386b3191ccf16c0d64ad7bb1b2.zip |
Pull code from mon->can_see(target) into a new function mon->see_grid()
and use it in the checks for monster/monster visibility.
I didn't have the time to test it but it should at least solve part of
the problem of monsters firing through walls (if monster visibility is
even checked there, which I don't know).
Also (as usually), more code cleanup.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5117 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monplace.cc')
-rw-r--r-- | crawl-ref/source/monplace.cc | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc index 91630ca534..f772da69ab 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -63,9 +63,10 @@ bool grid_compatible(dungeon_feature_type grid_wanted, // XXX What in Xom's name is DNGN_WATER_STUCK? It looks like an artificial // device to slow down fiery monsters flying over water. if (grid_wanted == DNGN_FLOOR) - return actual_grid >= DNGN_FLOOR - || (!generation - && actual_grid == DNGN_SHALLOW_WATER); + { + return (actual_grid >= DNGN_FLOOR + || !generation && actual_grid == DNGN_SHALLOW_WATER); + } if (grid_wanted >= DNGN_ROCK_WALL && grid_wanted <= DNGN_CLEAR_PERMAROCK_WALL) @@ -1671,7 +1672,7 @@ void mark_interesting_monst(struct monsters* monster, beh_type behaviour) else if (behaviour == BEH_FRIENDLY || behaviour == BEH_GOD_GIFT) interesting = false; // Don't waste time on moname() if user isn't using this option - else if ( Options.note_monsters.size() > 0 ) + else if (Options.note_monsters.size() > 0) { const std::string iname = mons_type_name(monster->type, DESC_NOCAP_A); for (unsigned i = 0; i < Options.note_monsters.size(); ++i) @@ -1683,16 +1684,18 @@ void mark_interesting_monst(struct monsters* monster, beh_type behaviour) } } } - else if ( you.where_are_you == BRANCH_MAIN_DUNGEON && - you.level_type == LEVEL_DUNGEON && - mons_level(monster->type) >= you.your_level + ood_limit() && - mons_level(monster->type) < 99 && - !(monster->type >= MONS_EARTH_ELEMENTAL && - monster->type <= MONS_AIR_ELEMENTAL) - && !mons_class_flag( monster->type, M_NO_EXP_GAIN )) + else if (you.where_are_you == BRANCH_MAIN_DUNGEON + && you.level_type == LEVEL_DUNGEON + && mons_level(monster->type) >= you.your_level + ood_limit() + && mons_level(monster->type) < 99 + && !(monster->type >= MONS_EARTH_ELEMENTAL + && monster->type <= MONS_AIR_ELEMENTAL) + && !mons_class_flag( monster->type, M_NO_EXP_GAIN )) + { interesting = true; + } - if ( interesting ) + if (interesting) monster->flags |= MF_INTERESTING; } |