From 4ec1ab4e076a371dccb54072a220b7d4000021c6 Mon Sep 17 00:00:00 2001 From: Matthew Cline Date: Thu, 12 Nov 2009 02:52:05 -0800 Subject: Randomly placed overflow temples Specialized single-altar overflow temples which also have the tag "uniq_altar_GODNAME" can be placed randomly even if that altar has been chosen at new-game time to be an overflow temple on a specific level, and if it's randomly placed before being generated specifically then it will only be placed once, rather than also being placed a second time at the location chosen at new-game time. --- crawl-ref/source/dat/altar.des | 8 ++++++-- crawl-ref/source/dungeon.cc | 23 ++++++++++++++++++----- crawl-ref/source/maps.cc | 6 ++++-- 3 files changed, 28 insertions(+), 9 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/dat/altar.des b/crawl-ref/source/dat/altar.des index af1979eb5e..4f3c2ea3ee 100644 --- a/crawl-ref/source/dat/altar.des +++ b/crawl-ref/source/dat/altar.des @@ -273,6 +273,10 @@ ENDMAP # III Special altars ###################################### +# NOTE: A vault tagged with only temple_overflow_FOO will only ever be used +# for overflow temples, but one tagged with both temple_overflow_FOO and +# uniq_altar_FOO can be generated either randomly or as an overflow temple. + # XXX - The WEIGHTs and PLACE of these Fedhas vaults are temporary. # Remove once the Ecumenical Temple is updated to cater for # more than 12 gods. @@ -480,7 +484,7 @@ ENDMAP NAME: lemuel_blue_sif_altar DEPTH: D:2-18, Elf, Vault -TAGS: no_monster_gen mini_float temple_overflow_sif_muna +TAGS: no_monster_gen mini_float temple_overflow_sif_muna uniq_altar_sif_muna COLOUR: . = blue FTILE: . = floor_hall, C = floor_hall, @ = floor_hall, + = floor_hall KFEAT: _ = altar_sif_muna @@ -634,7 +638,7 @@ ENDMAP ############################################################################### # Blood-stained Trog altar! NAME: bloody_trog -TAGS: uniq_bloody_trog temple_overflow_trog +TAGS: uniq_altar_trog temple_overflow_trog DEPTH: D:2-20, Orc, Vault KPROP: . = bloody / nothing KFEAT: _ = altar_trog diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 9ace2a865e..b42e2b1f82 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -1702,17 +1702,30 @@ static void _build_overflow_temples(int level_number) { CrawlVector &god_vec = temple[TEMPLE_GODS_KEY]; god_type god = (god_type) god_vec[0].get_byte(); + + std::string name = god_name(god); + name = replace_all(name, " ", "_"); + lowercase(name); - vault_tag = make_stringf("temple_overflow_%s", - god_name(god).c_str()); - vault_tag = replace_all(vault_tag, " ", "_"); - lowercase(vault_tag); + if (you.uniq_map_tags.find("uniq_altar_" + name) + != you.uniq_map_tags.end()) + { + // We've already placed a specialized temple for this + // god, so do nothing. +#ifdef DEBUG_DIAGNOSTICS + mprf(MSGCH_DIAGNOSTICS, "Already placed specialized " + "single-altar temple for %s", name.c_str()); +#endif + continue; + } + + vault_tag = make_stringf("temple_overflow_%s", name.c_str()); vault = random_map_for_tag(vault_tag, true); #ifdef DEBUG_DIAGNOSTICS if (vault == NULL) mprf(MSGCH_DIAGNOSTICS, "Couldn't find overflow temple " - "for god %s", god_name(god).c_str()); + "for god %s", name.c_str()); #endif } diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc index 0eced70f21..cbe4922382 100644 --- a/crawl-ref/source/maps.cc +++ b/crawl-ref/source/maps.cc @@ -507,7 +507,8 @@ 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("temple_") + && (!mapdef.has_tag_prefix("temple_") + || mapdef.has_tag_prefix("uniq_altar_")) && map_matches_layout_type(mapdef) && vault_unforbidden(mapdef)); case DEPTH: @@ -523,7 +524,8 @@ 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("temple_") + && (!mapdef.has_tag_prefix("temple_") + || mapdef.has_tag_prefix("uniq_altar_")) && (!check_layout || map_matches_layout_type(mapdef)) && vault_unforbidden(mapdef)); case TAG: -- cgit v1.2.3-54-g00ecf