diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-24 05:52:35 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-24 05:52:35 +0000 |
commit | 282e620e20e26847f617b3c6a3deb5e7bab0c239 (patch) | |
tree | 7e7492bd20cb7cd82a68a9dabdda27abc21d5c8c /crawl-ref/source | |
parent | cc6d8cbcbc57396500d87731f6742fb6317aa1c2 (diff) | |
download | crawl-ref-282e620e20e26847f617b3c6a3deb5e7bab0c239.tar.gz crawl-ref-282e620e20e26847f617b3c6a3deb5e7bab0c239.zip |
[2026251] Fixed Elf:1 arrival sometimes being disconnected - the map used ORIENT: south, but defined no exits. Fixed by applying the old floating vault exit behaviour to all vaults (apart from minivaults) so explicit @ exits are now optional.
Also fixed maps being unable to place monsters on shallow water.
Added debug_mons_scan to scan the mgrd for stranded monsters in fulldebug mode.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6659 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/AppHdr.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/acr.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/debug.cc | 20 | ||||
-rw-r--r-- | crawl-ref/source/debug.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/dungeon.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/monplace.cc | 21 |
6 files changed, 40 insertions, 8 deletions
diff --git a/crawl-ref/source/AppHdr.h b/crawl-ref/source/AppHdr.h index 0ad0b91951..456de40231 100644 --- a/crawl-ref/source/AppHdr.h +++ b/crawl-ref/source/AppHdr.h @@ -295,6 +295,7 @@ // against the name. Still, it is nice to know the // turn in which "bad" items appear. #define DEBUG_ITEM_SCAN 1 + #define DEBUG_MONS_SCAN 1 #endif #ifdef _DEBUG // this is how MSVC signals a debug build diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 30ad0506bd..74ce3aab57 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -3367,6 +3367,9 @@ static command_type _get_next_cmd() #if DEBUG_ITEM_SCAN debug_item_scan(); #endif +#if DEBUG_MONS_SCAN + debug_mons_scan(); +#endif const time_t before = time(NULL); keycode_type keyin = _get_next_keycode(); diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index 84c992a030..1a9d5fbef2 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -1971,8 +1971,28 @@ void debug_item_scan( void ) } } } + +#endif + +#if DEBUG_MONS_SCAN +void debug_mons_scan() +{ + for (int y = 0; y < GYM; ++y) + for (int x = 0; x < GXM; ++x) + { + const int mons = mgrd[x][y]; + if (mons != NON_MONSTER && + menv[mons].pos() != coord_def(x, y)) + { + const monsters *m = &menv[mons]; + mprf(MSGCH_WARN, "Bogosity: mgrd at %d,%d points at %s, but monster is at %d,%d", + x, y, m->name(DESC_PLAIN).c_str(), m->x, m->y); + } + } +} #endif + //--------------------------------------------------------------- // // debug_item_statistics diff --git a/crawl-ref/source/debug.h b/crawl-ref/source/debug.h index 9e57942fed..ca73dcbbcd 100644 --- a/crawl-ref/source/debug.h +++ b/crawl-ref/source/debug.h @@ -97,6 +97,7 @@ void debug_make_shop( void ); void debug_place_map(); // Honest debugging functions. void debug_item_scan( void ); +void debug_mons_scan(); void debug_item_statistics( void ); void debug_fight_statistics( bool use_init_defaults, bool defence = false ); void debug_list_monsters(); diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 622f97ef5d..9276ba9218 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -4303,7 +4303,7 @@ static bool _build_vaults(int level_number, int force_vault, int rune_subst, place.map.map.apply_overlays(place.pos); _register_place(place); - if (gluggy == MAP_FLOAT && target_connections.empty()) + if (target_connections.empty()) _pick_float_exits(place, target_connections); if (make_no_exits) diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc index 24103129a3..f38c036414 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -547,8 +547,15 @@ static int _is_near_stairs(coord_def &p) return (result); } +/* + * Checks if the monster is ok to place at mg_pos. If force_location + * is true, then we'll be less rigorous in our checks, in particular + * allowing land monsters to be placed in shallow water and water + * creatures in fountains. + */ static bool _valid_monster_location(const mgen_data &mg, - const coord_def &mg_pos) + const coord_def &mg_pos, + bool force_location) { const int htype = (mons_class_is_zombified(mg.cls) ? mg.base_type : mg.cls); @@ -563,7 +570,7 @@ 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_wanted, grd(mg_pos), true)) + if (!grid_compatible(grid_wanted, grd(mg_pos), !force_location)) return (false); if (mg.behaviour != BEH_FRIENDLY && is_sanctuary(mg_pos)) @@ -581,9 +588,9 @@ static bool _valid_monster_location(const mgen_data &mg, return (true); } -static bool _valid_monster_location(mgen_data &mg) +static bool _valid_monster_location(mgen_data &mg, bool force_location) { - return _valid_monster_location(mg, mg.pos); + return _valid_monster_location(mg, mg.pos, force_location); } int place_monster(mgen_data mg, bool force_pos) @@ -665,7 +672,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)) + if (!_valid_monster_location(mg, false)) continue; // Is the grid verboten? @@ -731,7 +738,7 @@ int place_monster(mgen_data mg, bool force_pos) break; } // end while... place first monster } - else if (!_valid_monster_location(mg)) + else if (!_valid_monster_location(mg, true)) { // Sanity check that the specified position is valid. return (-1); @@ -852,7 +859,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)) + if (_valid_monster_location(mg, fpos, false)) break; } |