diff options
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/dat/lair.des | 10 | ||||
-rw-r--r-- | crawl-ref/source/dungeon.cc | 18 | ||||
-rw-r--r-- | crawl-ref/source/luadgn.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/mapdef.cc | 14 | ||||
-rw-r--r-- | crawl-ref/source/maps.cc | 30 | ||||
-rw-r--r-- | crawl-ref/source/maps.h | 2 |
6 files changed, 58 insertions, 19 deletions
diff --git a/crawl-ref/source/dat/lair.des b/crawl-ref/source/dat/lair.des index d4994ded9f..c9b870c43a 100644 --- a/crawl-ref/source/dat/lair.des +++ b/crawl-ref/source/dat/lair.des @@ -773,6 +773,7 @@ ENDMAP # NAME: Shoal_1 PLACE: Shoal:5 +TAGS: water_ok WEIGHT: 0 MONS: cyclops, yaktaur, yaktaur captain MAP @@ -812,6 +813,7 @@ ENDMAP # NAME: Shoal_2 PLACE: Shoal:5 +TAGS: water_ok WEIGHT: 0 MONS: cyclops,stone giant SUBST: 1 = 1. @@ -850,6 +852,7 @@ ENDMAP # NAME: Shoal_3 PLACE: Shoal:5 +TAGS: water_ok WEIGHT: 0 KMONS: x : ice statue / orange crystal statue / silver statue KFEAT: x : O @@ -864,6 +867,7 @@ ENDMAP # NAME: Shoal_4 PLACE: Shoal:5 +TAGS: water_ok WEIGHT: 0 KFEAT: O = w ### KITEM: O = liquid rune of Zot @@ -888,7 +892,7 @@ ENDMAP # # Shoal:$ is hand-hacked to force lots of minivaults. NAME: shoalhut_rune -TAGS: shoal_rune +TAGS: shoal_rune water_ok SHUFFLE: ABCD SUBST: A:x, B:x, C:x=, D=+ LROCKTILE: wall_vines @@ -907,8 +911,8 @@ ENDMAP # # Shoal:$ is hand-hacked to force lots of minivaults. NAME: shoalhut_norune -PLACE: Shoal:$ -TAGS: allow_dup +DEPTH: Shoal:$ +TAGS: allow_dup water_ok shoal SHUFFLE: ABCD SUBST: A:x, B:x, C:x=, D=+ MAP diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index b5ef022f55..07ac4028ff 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -205,7 +205,7 @@ static void _vault_grid( vault_placement &, const coord_def& where, bool recursive = false); -static const map_def *_dgn_random_map_for_place(); +static const map_def *_dgn_random_map_for_place(bool minivault); static void _dgn_load_colour_grid(); static void _dgn_map_colour_fixup(); @@ -2110,7 +2110,7 @@ static void _prepare_shoals(int level_number) { // Place (non-rune) minivaults on the other islands do - vault = _dgn_random_map_for_place(); + vault = random_map_for_tag("shoal"); while (!vault); _build_secondary_vault(level_number, vault, -1, false, true, @@ -2374,7 +2374,7 @@ static void _portal_vault_level(int level_number) const char* level_name = trimmed_name.c_str(); - const map_def *vault = random_map_for_place(level_id::current()); + const map_def *vault = random_map_for_place(level_id::current(), false); #ifdef WIZARD if (!vault && you.wizard && map_count_for_tag(level_name, false) > 1) @@ -2451,10 +2451,10 @@ static bool _place_portal_vault(int stair, const std::string &tag, int dlevel) return _build_secondary_vault(dlevel, vault, stair); } -static const map_def *_dgn_random_map_for_place() +static const map_def *_dgn_random_map_for_place(bool minivault) { const level_id lid = level_id::current(); - const map_def *vault = random_map_for_place(lid); + const map_def *vault = random_map_for_place(lid, minivault); // Disallow entry vaults for tutorial (only complicates things). if (!vault @@ -2472,7 +2472,7 @@ static const map_def *_dgn_random_map_for_place() // otherwise. static builder_rc_type _builder_by_branch(int level_number) { - const map_def *vault = _dgn_random_map_for_place(); + const map_def *vault = _dgn_random_map_for_place(false); if (vault) { @@ -2530,6 +2530,10 @@ static void _place_minivaults(const std::string &tag, int lo, int hi, if (use_random_maps) { const map_def *vault = NULL; + + if ((vault = random_map_for_place(level_id::current(), true))) + _build_secondary_vault(you.your_level, vault); + do { vault = random_map_in_depth(level_id::current(), true); @@ -2549,7 +2553,7 @@ static builder_rc_type _builder_normal(int level_number, char level_type, UNUSED( level_type ); bool skipped = false; - const map_def *vault = _dgn_random_map_for_place(); + const map_def *vault = _dgn_random_map_for_place(false); // Can't have vaults on you.where_are_you != BRANCH_MAIN_DUNGEON levels. if (!vault && use_random_maps && can_create_vault) diff --git a/crawl-ref/source/luadgn.cc b/crawl-ref/source/luadgn.cc index c62198de72..a0a965b738 100644 --- a/crawl-ref/source/luadgn.cc +++ b/crawl-ref/source/luadgn.cc @@ -2691,7 +2691,8 @@ LUAFN(dgn_map_in_depth) LUAFN(dgn_map_by_place) { const level_id lid = _lua_level_id(ls, 1); - return _lua_push_map(ls, random_map_for_place(lid)); + const bool mini = _lua_boolean(ls, 2, false); + return _lua_push_map(ls, random_map_for_place(lid, mini)); } LUAFN(_dgn_place_map) diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc index 8d9e7408af..b9df39c83f 100644 --- a/crawl-ref/source/mapdef.cc +++ b/crawl-ref/source/mapdef.cc @@ -192,6 +192,14 @@ void level_range::set(const std::string &br, int s, int d) shallowest = s; deepest = d; + if (branch != NUM_BRANCHES) + { + if (shallowest == -1) + shallowest = branches[branch].depth; + if (deepest == -1) + deepest = branches[branch].depth; + } + if (deepest < shallowest) throw make_stringf("Level-range %s:%d-%d is malformed", br.c_str(), s, d); @@ -245,6 +253,12 @@ void level_range::parse_depth_range(const std::string &s, int *l, int *h) return; } + if (s == "$") + { + *l = *h = -1; + return; + } + std::string::size_type hy = s.find('-'); if (hy == std::string::npos) { diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc index b3614b7782..ef9c3e949a 100644 --- a/crawl-ref/source/maps.cc +++ b/crawl-ref/source/maps.cc @@ -279,10 +279,25 @@ static coord_def _find_minivault_place( random_range( margin, GYM - margin - place.size.y )); if (check_place && !map_place_valid(place.map, v1, place.size)) + { +#ifdef DEBUG_DIAGNOSTICS + mprf(MSGCH_DIAGNOSTICS, + "Skipping (%d,%d): not safe to place map", + v1.x, v1.y); +#endif continue; + } - if (_connected_minivault_place(v1, place)) - return (v1); + if (!_connected_minivault_place(v1, place)) + { +#ifdef DEBUG_DIAGNOSTICS + mprf(MSGCH_DIAGNOSTICS, + "Skipping (%d,%d): not a good minivault place (tags: %s)", + v1.x, v1.y, place.map.tags.c_str()); +#endif + continue; + } + return (v1); } return (coord_def(-1, -1)); } @@ -445,9 +460,9 @@ public: return (sel == TAG || place.is_valid()); } - static map_selector by_place(const level_id &place) + static map_selector by_place(const level_id &place, bool mini) { - return map_selector(map_selector::PLACE, place, "", false, false); + return map_selector(map_selector::PLACE, place, "", mini, false); } static map_selector by_depth(const level_id &place, bool mini) @@ -490,7 +505,8 @@ bool map_selector::accept(const map_def &mapdef) const switch (sel) { case PLACE: - return (mapdef.place == place + return (mapdef.is_minivault() == mini + && mapdef.place == place && !mapdef.has_tag("layout") && map_matches_layout_type(mapdef) && vault_unforbidden(mapdef)); @@ -680,9 +696,9 @@ static const map_def *_random_map_by_selector(const map_selector &sel) } // Returns a map for which PLACE: matches the given place. -const map_def *random_map_for_place(const level_id &place) +const map_def *random_map_for_place(const level_id &place, bool minivault) { - return _random_map_by_selector(map_selector::by_place(place)); + return _random_map_by_selector(map_selector::by_place(place, minivault)); } const map_def *random_map_in_depth(const level_id &place, bool want_minivault) diff --git a/crawl-ref/source/maps.h b/crawl-ref/source/maps.h index 753413957a..6f3d07615a 100644 --- a/crawl-ref/source/maps.h +++ b/crawl-ref/source/maps.h @@ -30,7 +30,7 @@ int map_count(); int map_count_for_tag(const std::string &tag, bool check_depth = false); const map_def *find_map_by_name(const std::string &name); -const map_def *random_map_for_place(const level_id &place); +const map_def *random_map_for_place(const level_id &place, bool minivault); const map_def *random_map_in_depth(const level_id &lid, bool want_minivault = false); const map_def *random_map_for_tag(const std::string &tag, |