From f0b1c25fa937388e6fc235e181f430ccac601435 Mon Sep 17 00:00:00 2001 From: Matthew Cline Date: Wed, 11 Nov 2009 14:19:00 -0800 Subject: Place arbitrarily sized main temple The main Temple (temple branch) can now have an arbitrary number of altars, decided at new-game initialization time. Vaults with differing numbers of altars can be given the tag "temple_main_N", with N being the number of altars. --- crawl-ref/source/dat/temple.des | 13 +++++++++++-- crawl-ref/source/dungeon.cc | 27 ++++++++++++++++++++------- crawl-ref/source/maps.cc | 4 ++-- 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/crawl-ref/source/dat/temple.des b/crawl-ref/source/dat/temple.des index bd8f5d3c05..bc5074f36b 100644 --- a/crawl-ref/source/dat/temple.des +++ b/crawl-ref/source/dat/temple.des @@ -382,6 +382,12 @@ ENDMAP # Temple maps ############################################################################## +# To make a main temple (Ecumenical Temple branch) vault with an +# arbitrary number of altars, give it the tag "temple_main_N", where +# N is the number of altars. If no vaults are found for the specific +# number of altars, then the game will pick a random vault for +# "PLACE: Temple". + ########################################################################## # Circular temple (David Ploog). 12 = 1 x 12 @@ -898,11 +904,14 @@ ENDMAP # Overflow temples ############################################################################## +# To make an overflow temple for N altars, give it the tag +# "temple_overflow_N". + ############################################################################## -# Overflow temples with one altar, must have tag "overflow_temple_1" +# Overflow temples with one altar, must have tag "temple_overflow_1" # NAME: overflow_temple_1_a -TAGS: overflow_temple_1 allow_dup +TAGS: temple_overflow_1 allow_dup MAP B ENDMAP diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 13ceeba164..763dbe7066 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -1635,7 +1635,7 @@ static void _dgn_verify_connectivity(unsigned nvaults) // * The cell of the previous vector is a hash table, containing the // list of gods for the overflow temple and (optionally) the name of // the vault to use for the temple. If no map name is supplied, -// it will randomly pick from vaults tagged "overflow_vault_num", +// it will randomly pick from vaults tagged "temple_overflow_num", // where "num" is the number of gods in the temple. Gods are listed // in the order their altars are placed. static void _build_overflow_temples(int level_number) @@ -1668,9 +1668,6 @@ static void _build_overflow_temples(int level_number) can_create_vault = true; } - mprf(MSGCH_DIAGNOSTICS, "Placing %lu overflow temples", - temples.size()); - for (unsigned int i = 0; i < temples.size(); i++) { CrawlHashTable &temple = temples[i].get_table(); @@ -1694,7 +1691,7 @@ static void _build_overflow_temples(int level_number) else { std::string vault_tag = - make_stringf("overflow_temple_%d", num_gods); + make_stringf("temple_overflow_%d", num_gods); vault = random_map_for_tag(vault_tag, true); if (vault == NULL) @@ -2608,8 +2605,24 @@ static bool _place_portal_vault(int stair, const std::string &tag, int dlevel) 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, minivault); + const map_def *vault = NULL; + + if (!minivault && player_in_branch(BRANCH_ECUMENICAL_TEMPLE)) + { + // Try to place a main Temple vault with the exact number + // of altars needed. + std::string tag + = make_stringf("temple_main_%lu", + _temple_altar_list.size()); + vault = random_map_for_tag(tag); + + if (vault != NULL) + return (vault); + } + + const level_id lid = level_id::current(); + + vault = random_map_for_place(lid, minivault); // Disallow entry vaults for tutorial (only complicates things). if (!vault diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc index 7f6e304902..bc2139681d 100644 --- a/crawl-ref/source/maps.cc +++ b/crawl-ref/source/maps.cc @@ -507,7 +507,7 @@ bool map_selector::accept(const map_def &mapdef) const && mapdef.place == place && !mapdef.has_tag("layout") && !mapdef.has_tag("place_unique") - && !mapdef.has_tag_prefix("overflow_temple_") + && !mapdef.has_tag_prefix("temple_") && map_matches_layout_type(mapdef) && vault_unforbidden(mapdef)); case DEPTH: @@ -523,7 +523,7 @@ bool map_selector::accept(const map_def &mapdef) const && !mapdef.has_tag("bazaar") && !mapdef.has_tag("layout") && !mapdef.has_tag("place_unique") - && !mapdef.has_tag_prefix("overflow_temple_") + && !mapdef.has_tag_prefix("temple_") && (!check_layout || map_matches_layout_type(mapdef)) && vault_unforbidden(mapdef)); case TAG: -- cgit v1.2.3-54-g00ecf