diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-02-15 17:01:48 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-02-15 17:01:48 +0000 |
commit | a5f8b4aaccf99929024188fb2253f1fa2b6b3f44 (patch) | |
tree | 5b9f5df4951f2217c6367cdbd0e723dc97674d21 /crawl-ref/source/monplace.cc | |
parent | cf4b68bb3c2e5d1955d41fff7284a7d56a484b3f (diff) | |
download | crawl-ref-a5f8b4aaccf99929024188fb2253f1fa2b6b3f44.tar.gz crawl-ref-a5f8b4aaccf99929024188fb2253f1fa2b6b3f44.zip |
Lots more cleanups.
Remove the sound-strength #defines because they're not used anymore (except
for SL_SPLASH, which has been replaced by its value.)
Change some #defines to const variables.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9087 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 c6866b3a7b..90f8738603 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -523,7 +523,7 @@ static monster_type _resolve_monster_type(monster_type mon_type, { pos = random_in_bounds(); - if (mgrd(pos) != NON_MONSTER || pos == you.pos()) + if (actor_at(pos)) continue; // Is the grid verboten? @@ -695,7 +695,7 @@ static bool _valid_monster_location(const mgen_data &mg, return (false); // Occupied? - if (mgrd(mg_pos) != NON_MONSTER || mg_pos == you.pos()) + if (actor_at(mg_pos)) return (false); // Is the monster happy where we want to put it? @@ -733,7 +733,7 @@ int place_monster(mgen_data mg, bool force_pos) int id = -1; // (1) Early out (summoned to occupied grid). - if (mg.use_position() && mgrd(mg.pos) != NON_MONSTER) + if (mg.use_position() && monster_at(mg.pos)) return (-1); mg.cls = _resolve_monster_type(mg.cls, mg.proximity, mg.base_type, @@ -848,6 +848,14 @@ int place_monster(mgen_data mg, bool force_pos) proxOK = false; break; } + + // You can't be shoved if you're caught in a net. + if (you.caught()) + { + proxOK = false; + break; + } + shoved = true; coord_def mpos = mg.pos; mg.pos = you.pos(); @@ -983,7 +991,7 @@ static int _place_monster_aux(const mgen_data &mg, // If the space is occupied, try some neighbouring square instead. if (first_band_member && in_bounds(mg.pos) && (mg.behaviour == BEH_FRIENDLY || !is_sanctuary(mg.pos)) - && mgrd(mg.pos) == NON_MONSTER && mg.pos != you.pos() + && actor_at(mg.pos) == NULL && (force_pos || monster_habitable_grid(montype, grd(mg.pos)))) { fpos = mg.pos; @@ -2294,8 +2302,7 @@ public: good_square(dc); return (false); } - if (mgrd(dc) == NON_MONSTER && dc != you.pos() - && one_chance_in(++nfound)) + if (actor_at(dc) == NULL && one_chance_in(++nfound)) { greedy_dist = traveled_distance; greedy_place = dc; @@ -2447,8 +2454,7 @@ int create_monster(mgen_data mg, bool fail_msg) if (!mg.force_place() || !in_bounds(mg.pos) - || mgrd(mg.pos) != NON_MONSTER - || mg.pos == you.pos() + || actor_at(mg.pos) || !mons_class_can_pass(montype, grd(mg.pos))) { mg.pos = find_newmons_square(montype, mg.pos); @@ -2516,10 +2522,7 @@ bool empty_surrounds(const coord_def& where, dungeon_feature_type spc_wanted, { bool success = false; - if ( *ri == you.pos() ) - continue; - - if (mgrd(*ri) != NON_MONSTER) + if (actor_at(*ri)) continue; // Players won't summon out of LOS, or past transparent walls. |