From 341e6e03d6347b96c54d6a295c81070d13ea9152 Mon Sep 17 00:00:00 2001 From: dolorous Date: Sun, 5 Oct 2008 16:57:06 +0000 Subject: Add still more miscellaneous minor fixes. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7139 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/dungeon.cc | 9 +++++---- crawl-ref/source/monplace.cc | 27 ++++++++++++++------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 06a2193657..fc35399d36 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -4651,12 +4651,13 @@ bool dgn_place_monster(mons_spec &mspec, if (mons_is_unique(mid) && you.unique_creatures[mid]) return (false); - const int type = mons_class_is_zombified(mid) ? mspec.monbase - : mid; + const int montype = mons_class_is_zombified(mid) ? mspec.monbase + : mid; + + const habitat_type habitat = mons_habitat_by_type(montype); - const habitat_type habitat = mons_habitat_by_type(type); if (habitat != HT_LAND - && (habitat != HT_WATER || !mons_class_amphibious(mid))) + && (habitat != HT_WATER || !mons_class_amphibious(montype))) { grd(where) = habitat2grid(habitat); } diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc index a60c628957..5070f80348 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -89,10 +89,10 @@ bool monster_habitable_grid(const monsters *m, dungeon_feature_type actual_grid) { // Zombified monsters enjoy the same habitat as their original. - const int type = mons_is_zombified(m) ? mons_zombie_base(m) - : m->type; + const int montype = mons_is_zombified(m) ? mons_zombie_base(m) + : m->type; - return (monster_habitable_grid(type, actual_grid, mons_flies(m), + return (monster_habitable_grid(montype, actual_grid, mons_flies(m), mons_cannot_move(m))); } @@ -550,10 +550,10 @@ static bool _valid_monster_location(const mgen_data &mg, const coord_def &mg_pos, bool force_location) { - const int htype = (mons_class_is_zombified(mg.cls) ? mg.base_type - : mg.cls); + const int montype = (mons_class_is_zombified(mg.cls) ? mg.base_type + : mg.cls); dungeon_feature_type grid_wanted = - habitat2grid(mons_habitat_by_type(htype)); + habitat2grid(mons_habitat_by_type(montype)); if (!in_bounds(mg_pos)) return (false); @@ -824,15 +824,15 @@ static int _place_monster_aux( const mgen_data &mg, menv[id].reset(); - const int htype = (mons_class_is_zombified(mg.cls) ? mg.base_type - : mg.cls); + const int montype = (mons_class_is_zombified(mg.cls) ? mg.base_type + : mg.cls); // Setup habitat and placement. // 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() - && (force_pos || monster_habitable_grid(htype, grd(mg.pos)))) + && (force_pos || monster_habitable_grid(montype, grd(mg.pos)))) { fpos = mg.pos; } @@ -2123,17 +2123,18 @@ bool player_angers_monster(monsters *mon) int create_monster( mgen_data mg, bool fail_msg ) { + const int montype = (mons_class_is_zombified(mg.cls) ? mg.base_type + : mg.cls); + int summd = -1; - int type = (mons_class_is_zombified(mg.cls) ? mg.base_type - : mg.cls); if (!mg.force_place() || !in_bounds(mg.pos) || mgrd(mg.pos) != NON_MONSTER || mg.pos == you.pos() - || !mons_class_can_pass(type, grd(mg.pos))) + || !mons_class_can_pass(montype, grd(mg.pos))) { - mg.pos = find_newmons_square(type, mg.pos); + mg.pos = find_newmons_square(montype, mg.pos); } if (in_bounds(mg.pos)) -- cgit v1.2.3-54-g00ecf