diff options
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/abyss.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/arena.cc | 10 | ||||
-rw-r--r-- | crawl-ref/source/dungeon.cc | 10 | ||||
-rw-r--r-- | crawl-ref/source/monplace.cc | 25 | ||||
-rw-r--r-- | crawl-ref/source/monplace.h | 3 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.cc | 3 |
6 files changed, 24 insertions, 29 deletions
diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc index 910b85eec7..e8a33b2f4d 100644 --- a/crawl-ref/source/abyss.cc +++ b/crawl-ref/source/abyss.cc @@ -675,7 +675,7 @@ static bool _spawn_corrupted_servant_near(const coord_def &pos) const coord_def p( pos.x + random2avg(4, 3) + random2(3), pos.y + random2avg(4, 3) + random2(3) ); if (!in_bounds(p) || p == you.pos() || mgrd(p) != NON_MONSTER - || !grid_compatible(DNGN_FLOOR, grd(p), true)) + || !grid_compatible(DNGN_FLOOR, grd(p))) { continue; } diff --git a/crawl-ref/source/arena.cc b/crawl-ref/source/arena.cc index aefd29729d..db02ef669e 100644 --- a/crawl-ref/source/arena.cc +++ b/crawl-ref/source/arena.cc @@ -167,16 +167,15 @@ namespace arena for (int q = 0; q < spec.quantity; ++q) { - const coord_def loc = - find_newmons_square_contiguous(MONS_GIANT_BAT, pos, 6); + const coord_def loc = pos; if (!in_bounds(loc)) break; const int imon = dgn_place_monster(spec, you.your_level, loc, false, true, false); if (imon == -1) - end(1, false, "Failed to create monster at (%d,%d)", - loc.x, loc.y); + end(1, false, "Failed to create monster at (%d,%d) grd: %s", + loc.x, loc.y, dungeon_feature_name(grd(loc))); list_eq(imon); } } @@ -223,7 +222,8 @@ namespace arena ASSERT(map); bool success = dgn_place_map(map, true, true); if (!success) - throw make_stringf("Failed to create arena named \"%s\"", arena_type.c_str()); + throw make_stringf("Failed to create arena named \"%s\"", + arena_type.c_str()); link_items(); if (!env.rock_colour) diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index b9eaf73704..779538c1b8 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -4668,12 +4668,8 @@ int dgn_place_monster(mons_spec &mspec, const habitat_type habitat = mons_class_primary_habitat(montype); - if (habitat != HT_LAND - && (habitat != HT_WATER || !mons_class_amphibious(montype)) - && (habitat != HT_ROCK || !mons_class_wall_shielded(montype))) - { + if (!monster_habitable_grid(montype, grd(where))) grd(where) = habitat2grid(habitat); - } } mgen_data mg(static_cast<monster_type>(mid)); @@ -4728,10 +4724,10 @@ int dgn_place_monster(mons_spec &mspec, if (!force_pos && mgrd(place) != NON_MONSTER && mg.cls != RANDOM_MONSTER && mg.cls < NUM_MONSTERS) { - place = find_newmons_square_contiguous(mg.cls, where, 6); + place = find_newmons_square_contiguous(mg.cls, where, 7); } - mg.pos = where; + mg.pos = place; if (mons_class_is_zombified(mg.base_type)) { diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc index 20d5c5f88a..e165d49c1a 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -72,7 +72,7 @@ static int _place_monster_aux(const mgen_data &mg, bool first_band_member, // Returns whether actual_grid is compatible with grid_wanted for monster // movement (or for monster generation, if generation is true). bool grid_compatible(dungeon_feature_type grid_wanted, - dungeon_feature_type actual_grid, bool generation) + dungeon_feature_type actual_grid) { // XXX What in Xom's name is DNGN_WATER_STUCK? It looks like an artificial // device to slow down fiery monsters flying over water. @@ -80,7 +80,7 @@ bool grid_compatible(dungeon_feature_type grid_wanted, { return (actual_grid >= DNGN_FLOOR && actual_grid != DNGN_BUILDER_SPECIAL_WALL - || !generation && actual_grid == DNGN_SHALLOW_WATER); + || actual_grid == DNGN_SHALLOW_WATER); } if (grid_wanted >= DNGN_ROCK_WALL @@ -95,7 +95,7 @@ bool grid_compatible(dungeon_feature_type grid_wanted, return (grid_wanted == actual_grid || (grid_wanted == DNGN_DEEP_WATER && (actual_grid == DNGN_SHALLOW_WATER - || !generation && actual_grid == DNGN_FOUNTAIN_BLUE))); + || actual_grid == DNGN_FOUNTAIN_BLUE))); } // Can this monster survive on actual_grid? @@ -664,8 +664,7 @@ static int _is_near_stairs(coord_def &p) * creatures in fountains. */ static bool _valid_monster_location(const mgen_data &mg, - const coord_def &mg_pos, - bool force_location) + const coord_def &mg_pos) { const int montype = (mons_class_is_zombified(mg.cls) ? mg.base_type : mg.cls); @@ -682,9 +681,9 @@ static bool _valid_monster_location(const mgen_data &mg, return (false); // Is the monster happy where we want to put it? - if (!grid_compatible(grid_preferred, grd(mg_pos), !force_location) + if (!grid_compatible(grid_preferred, grd(mg_pos)) && (grid_nonpreferred == grid_preferred - || !grid_compatible(grid_nonpreferred, grd(mg_pos), !force_location))) + || !grid_compatible(grid_nonpreferred, grd(mg_pos)))) { return (false); } @@ -701,9 +700,9 @@ static bool _valid_monster_location(const mgen_data &mg, return (true); } -static bool _valid_monster_location(mgen_data &mg, bool force_location) +static bool _valid_monster_location(mgen_data &mg) { - return _valid_monster_location(mg, mg.pos, force_location); + return _valid_monster_location(mg, mg.pos); } int place_monster(mgen_data mg, bool force_pos) @@ -784,7 +783,7 @@ int place_monster(mgen_data mg, bool force_pos) if (mg.proximity != PROX_NEAR_STAIRS) mg.pos = random_in_bounds(); - if (!_valid_monster_location(mg, false)) + if (!_valid_monster_location(mg)) continue; // Is the grid verboten? @@ -846,7 +845,7 @@ int place_monster(mgen_data mg, bool force_pos) break; } // end while... place first monster } - else if (!_valid_monster_location(mg, true)) + else if (!_valid_monster_location(mg)) { // Sanity check that the specified position is valid. return (-1); @@ -971,7 +970,7 @@ static int _place_monster_aux(const mgen_data &mg, fpos = mg.pos + coord_def( random_range(-3, 3), random_range(-3, 3) ); - if (_valid_monster_location(mg, fpos, false)) + if (_valid_monster_location(mg, fpos)) break; } @@ -2185,7 +2184,7 @@ public: { return (false); } - if (!grid_compatible(grid_wanted, grd(dc), true)) + if (!grid_compatible(grid_wanted, grd(dc))) { if (passable.find(grd(dc)) != passable.end()) good_square(dc); diff --git a/crawl-ref/source/monplace.h b/crawl-ref/source/monplace.h index 8d98254c17..36a3ebdf22 100644 --- a/crawl-ref/source/monplace.h +++ b/crawl-ref/source/monplace.h @@ -324,8 +324,7 @@ void mark_interesting_monst(monsters* monster, beh_type behaviour = BEH_SLEEP); bool grid_compatible(dungeon_feature_type grid_wanted, - dungeon_feature_type actual_grid, - bool generation = false); + dungeon_feature_type actual_grid); bool monster_habitable_grid(const monsters *m, dungeon_feature_type actual_grid); bool monster_habitable_grid(int monster_class, diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 6258f57a18..1bd6087071 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -6746,7 +6746,8 @@ static void _handle_monster_move(int i, monsters *monster) // Same for friendlies if friendly_pickup is set to "none". if (!mons_neutral(monster) && !monster->has_ench(ENCH_CHARM) && (!mons_friendly(monster) - || you.friendly_pickup > FRIENDLY_PICKUP_NONE)) + || you.friendly_pickup > FRIENDLY_PICKUP_NONE + || crawl_state.arena)) { if (_handle_pickup(monster)) { |