diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-11-23 20:38:59 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-11-23 20:38:59 +0000 |
commit | 742b5eb9836417ae5c0a6c2bb915eda51ea527a8 (patch) | |
tree | a28a608077b5ce038ecd511dca4e77c8c9bc2046 /crawl-ref | |
parent | 9007dee72716b25f791d49beabe2d5b662086f7b (diff) | |
download | crawl-ref-742b5eb9836417ae5c0a6c2bb915eda51ea527a8.tar.gz crawl-ref-742b5eb9836417ae5c0a6c2bb915eda51ea527a8.zip |
Discard more junk parameters from vault building routines.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7558 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/debug.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/decks.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/dungeon.cc | 58 | ||||
-rw-r--r-- | crawl-ref/source/dungeon.h | 3 | ||||
-rw-r--r-- | crawl-ref/source/maps.cc | 23 | ||||
-rw-r--r-- | crawl-ref/source/maps.h | 3 |
6 files changed, 41 insertions, 50 deletions
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index 4987cd4f97..59a63f1e86 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -3775,7 +3775,7 @@ static void debug_load_map_by_name(std::string name) where = you.pos(); } - if (dgn_place_map(map, false, true, false, where)) + if (dgn_place_map(map, true, false, where)) mprf("Successfully placed %s.", map_by_index(map)->name.c_str()); else mprf("Failed to place %s.", map_by_index(map)->name.c_str()); diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index cf02cfa371..92128f03a4 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -2315,7 +2315,7 @@ static bool _trowel_card(int power, deck_rarity_type rarity) { { no_messages n; - dgn_place_map(mapidx, false, true, true, you.pos()); + dgn_place_map(mapidx, true, true, you.pos()); } mpr("A mystic portal forms."); } diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index ed49e16bf9..2e5322e791 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -196,18 +196,16 @@ static void _jelly_pit(int level_number, spec_room &sr); // VAULT FUNCTIONS static bool _build_secondary_vault(int level_number, int vault, int rune_subst = -1, - bool generating_level = true, bool clobber = false, bool make_no_exits = false, const coord_def &where = coord_def(-1, -1)); static bool _build_vaults(int level_number, int vault_number, int rune_subst = -1, bool build_only = false, - bool check_vault_place = false, - bool generating_level = true, bool clobber = false, + bool check_collisions = false, bool make_no_exits = false, const coord_def &where = coord_def(-1, -1)); static bool _build_minivaults(int level_number, int force_vault, - bool level_builder = true, bool clobber = false, + bool clobber = false, bool make_no_exits = false, const coord_def &where = coord_def() ); static void _vault_grid( vault_placement &, @@ -242,6 +240,8 @@ std::set<std::string> Level_Unique_Tags; std::string dgn_Build_Method; std::string dgn_Layout_Type; +bool Generating_Level = false; + static int can_create_vault = true; static bool dgn_level_vetoed = false; static bool use_random_maps = true; @@ -287,6 +287,8 @@ bool builder(int level_number, int level_type) const std::set<std::string> uniq_tags = you.uniq_map_tags; const std::set<std::string> uniq_names = you.uniq_map_names; + unwind_bool levelgen(Generating_Level, true); + // N tries to build the level, after which we bail with a capital B. int tries = 20; while (tries-- > 0) @@ -2000,8 +2002,8 @@ static void _prepare_shoals(int level_number) // Place the rune int vaultidx = random_map_for_tag("shoal_rune", true); - _build_minivaults( level_number, vaultidx, true, false, false, - centres[1] ); + _build_minivaults( level_number, vaultidx, false, false, + centres[1] ); for ( int i = 2; i < num_islands; ++i ) { @@ -2012,7 +2014,7 @@ static void _prepare_shoals(int level_number) } while ( vaultidx == -1 ); - _build_minivaults( level_number, vaultidx, true, false, false, + _build_minivaults( level_number, vaultidx, false, false, centres[i] ); } } @@ -3933,8 +3935,8 @@ static bool _find_minivault_place(const vault_placement &place, } static bool _build_minivaults(int level_number, int force_vault, - bool building_level, bool clobber, - bool make_no_exits, const coord_def &where) + bool clobber, bool make_no_exits, + const coord_def &where) { if (dgn_check_connectivity && !dgn_zones) dgn_zones = _dgn_count_disconnected_zones(false); @@ -3984,7 +3986,7 @@ static bool _build_minivaults(int level_number, int force_vault, const dungeon_feature_type oldgrid = grd(*ri); _vault_grid( place, feat, *ri, target_connections ); - if (!building_level) + if (!Generating_Level) { link_items(); const dungeon_feature_type newgrid = grd(*ri); @@ -4393,14 +4395,11 @@ static dungeon_feature_type _dgn_find_rune_subst_tags(const std::string &tags) // // NOTE: encompass maps will destroy the existing level! // -// generating_level: If true, assumes that this is in the middle of normal -// level generation, and does not link items or handle -// changing terrain. // clobber: If true, assumes the newly placed vault can clobber existing // items and monsters (items may be destroyed, monsters may be // teleported). -bool dgn_place_map(int map, bool generating_level, bool clobber, - bool make_no_exits, const coord_def &where) +bool dgn_place_map(int map, bool clobber, bool make_no_exits, + const coord_def &where) { const dgn_colour_override_manager colour_man; @@ -4408,12 +4407,12 @@ bool dgn_place_map(int map, bool generating_level, bool clobber, bool did_map = false; bool fixup = false; - if (mdef->orient == MAP_ENCOMPASS && !generating_level) + if (mdef->orient == MAP_ENCOMPASS && !Generating_Level) { if (clobber) { // For encompass maps, clear the entire level. - generating_level = true; + unwind_bool levgen(Generating_Level, true); fixup = true; _reset_level(); dungeon_events.clear(); @@ -4430,8 +4429,8 @@ bool dgn_place_map(int map, bool generating_level, bool clobber, if (mdef->is_minivault()) { - did_map = _build_minivaults(you.your_level, map, generating_level, - clobber, make_no_exits, where); + did_map = _build_minivaults(you.your_level, map, clobber, + make_no_exits, where); } else { @@ -4439,12 +4438,11 @@ bool dgn_place_map(int map, bool generating_level, bool clobber, if (mdef->has_tag_suffix("_entry")) rune_subst = _dgn_find_rune_subst_tags(mdef->tags); did_map = _build_secondary_vault(you.your_level, map, rune_subst, - generating_level, clobber, - make_no_exits, where); + clobber, make_no_exits, where); } // Activate any markers within the map. - if (did_map && !generating_level) + if (did_map && !Generating_Level) { const vault_placement &vp = Level_Vaults[Level_Vaults.size() - 1]; for (int y = vp.pos.y; y < vp.pos.y + vp.size.y; ++y) @@ -4469,7 +4467,7 @@ bool dgn_place_map(int map, bool generating_level, bool clobber, you_teleport_now(false, false); } - if (fixup || !generating_level) + if (fixup || !Generating_Level) setup_environment_effects(); return (did_map); @@ -4478,13 +4476,12 @@ bool dgn_place_map(int map, bool generating_level, bool clobber, // Places a vault somewhere in an already built level if possible. // Returns true if the vault was successfully placed. static bool _build_secondary_vault(int level_number, int vault, - int rune_subst, bool generating_level, - bool clobber, bool no_exits, - const coord_def &where) + int rune_subst, bool clobber, + bool no_exits, const coord_def &where) { dgn_zones = _dgn_count_disconnected_zones(false); - if (_build_vaults(level_number, vault, rune_subst, true, true, - generating_level, clobber, no_exits, where)) + if (_build_vaults(level_number, vault, rune_subst, true, !clobber, + no_exits, where)) { const vault_placement &vp = Level_Vaults[ Level_Vaults.size() - 1 ]; _connect_vault(vp); @@ -4496,7 +4493,6 @@ static bool _build_secondary_vault(int level_number, int vault, static bool _build_vaults(int level_number, int force_vault, int rune_subst, bool build_only, bool check_collisions, - bool generating_level, bool clobber, bool make_no_exits, const coord_def &where) { FixedVector < char, 10 > stair_exist; @@ -4515,7 +4511,7 @@ static bool _build_vaults(int level_number, int force_vault, int rune_subst, place.pos = where; const int gluggy = vault_main(vgrid, place, force_vault, - check_collisions, clobber); + check_collisions); if (gluggy == MAP_NONE || !gluggy) return (false); @@ -4534,7 +4530,7 @@ static bool _build_vaults(int level_number, int force_vault, int rune_subst, const dungeon_feature_type oldgrid = grd(*ri); _vault_grid( place, vgrid[ri->y][ri->x], *ri, target_connections ); - if (!generating_level) + if (!Generating_Level) { // Have to link items each square at a time, or // dungeon_terrain_changed could blow up. diff --git a/crawl-ref/source/dungeon.h b/crawl-ref/source/dungeon.h index ece814c54f..7ea0f06b6f 100644 --- a/crawl-ref/source/dungeon.h +++ b/crawl-ref/source/dungeon.h @@ -310,8 +310,7 @@ bool builder(int level_number, int level_type); void dgn_set_colours_from_monsters(); void dgn_set_grid_colour_at(const coord_def &c, int colour); -bool dgn_place_map(int map, bool generating_level, bool clobber, - bool make_no_exits, +bool dgn_place_map(int map, bool clobber, bool make_no_exits, const coord_def &pos = coord_def(-1, -1)); void level_clear_vault_memory(); void level_welcome_messages(); diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc index d08fa2af11..c0b3120456 100644 --- a/crawl-ref/source/maps.cc +++ b/crawl-ref/source/maps.cc @@ -32,12 +32,12 @@ static int write_vault(map_def &mdef, map_type mt, vault_placement &, - bool check_place, bool clobber); + bool check_place); static int apply_vault_definition( map_def &def, map_type map, vault_placement &, - bool check_place, bool clobber); + bool check_place); static bool resolve_map(map_def &def, const map_def &original); @@ -60,8 +60,7 @@ static map_vector vdefs; int vault_main( map_type vgrid, vault_placement &place, int which_vault, - bool check_place, - bool clobber) + bool check_place) { #ifdef DEBUG_DIAGNOSTICS mprf(MSGCH_DIAGNOSTICS, "Generating level: %s (%d,%d)", @@ -85,13 +84,12 @@ int vault_main( map_type vgrid, // Return value of zero forces dungeon.cc to regenerate the level, except // for branch entry vaults where dungeon.cc just rejects the vault and // places a vanilla entry. - return (write_vault( vdefs[which_vault], vgrid, place, - check_place, clobber )); + return (write_vault( vdefs[which_vault], vgrid, place, check_place )); } static int write_vault(map_def &mdef, map_type map, vault_placement &place, - bool check_place, bool clobber) + bool check_place) { mdef.load(); @@ -110,7 +108,7 @@ static int write_vault(map_def &mdef, map_type map, continue; place.orient = apply_vault_definition(place.map, map, - place, check_place, clobber); + place, check_place); if (place.orient != MAP_NONE) break; @@ -214,7 +212,7 @@ void fit_region_into_map_bounds(coord_def &pos, const coord_def &size) static bool apply_vault_grid(map_def &def, map_type map, vault_placement &place, - bool check_place, bool clobber) + bool check_place) { const map_lines &ml = def.map; const int orient = def.orient; @@ -261,7 +259,7 @@ static bool apply_vault_grid(map_def &def, map_type map, start = def.float_place(); } - if (check_place && !clobber && bad_map_place(def, start, size)) + if (check_place && bad_map_place(def, start, size)) { #ifdef DEBUG_DIAGNOSTICS mprf(MSGCH_DIAGNOSTICS, "Bad vault place: (%d,%d) dim (%d,%d)", @@ -292,10 +290,9 @@ static int apply_vault_definition( map_def &def, map_type map, vault_placement &place, - bool check_place, - bool clobber) + bool check_place) { - if (!apply_vault_grid(def, map, place, check_place, clobber)) + if (!apply_vault_grid(def, map, place, check_place)) return (MAP_NONE); int orient = def.orient; diff --git a/crawl-ref/source/maps.h b/crawl-ref/source/maps.h index 677956a25e..b729c3b36c 100644 --- a/crawl-ref/source/maps.h +++ b/crawl-ref/source/maps.h @@ -42,8 +42,7 @@ struct vault_placement int vault_main(map_type vgrid, vault_placement &vp, int vault_force, - bool check_place = false, - bool clobber = false); + bool check_place = false); // Given a rectangular region, slides it to fit into the map. size must be // smaller than (GXM,GYM). |