summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/ng-init.cc
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2013-06-19 18:45:50 -0400
committerNeil Moore <neil@s-z.org>2013-06-19 19:45:24 -0400
commit4b7eaaa9b969fdafc2c1a56eec0082f18bc5127a (patch)
tree3bf0a2d5df896633a4e8ce169a005be1aed30afd /crawl-ref/source/ng-init.cc
parente2abcdf359957255d34955dcd3ca583df77ae047 (diff)
downloadcrawl-ref-4b7eaaa9b969fdafc2c1a56eec0082f18bc5127a.tar.gz
crawl-ref-4b7eaaa9b969fdafc2c1a56eec0082f18bc5127a.zip
Enable large overflow temples.
There are currently only three possible maps (one each of sizes 3, 5, and 6), so the 10% chance might be too high. On the other hand, given how many times we see general_overflow_altar, maybe 10% is fine. Only one multi-god overflow temple will be used per game. Changing that is possible but avoiding duplicates is notrivial, particularly when there is only a single map for a given size. The selection of overflow temple size should eventually be improved to take map weights into account; currently it chooses uniformly from among the possible overflow temple sizes.
Diffstat (limited to 'crawl-ref/source/ng-init.cc')
-rw-r--r--crawl-ref/source/ng-init.cc25
1 files changed, 23 insertions, 2 deletions
diff --git a/crawl-ref/source/ng-init.cc b/crawl-ref/source/ng-init.cc
index 4f45545bcb..02f9ee4cce 100644
--- a/crawl-ref/source/ng-init.cc
+++ b/crawl-ref/source/ng-init.cc
@@ -196,7 +196,7 @@ void initialise_temples()
// altar; they can contain any number of altars, so long as there's
// at least one vault definition with the tag "overflow_temple_num"
// (where "num" is the number of altars).
- for (unsigned int i = 0; i < overflow_gods.size(); i++)
+ for (unsigned int i = 0, size = overflow_gods.size(); i < size; i++)
{
const unsigned int level = random_range(2, MAX_OVERFLOW_LEVEL);
@@ -209,9 +209,30 @@ void initialise_temples()
CrawlVector &gods
= temple[TEMPLE_GODS_KEY].new_vector(SV_BYTE);
- // Only single-altar overflow temples for now.
+ // At least one god.
gods.push_back((char) overflow_gods[i]);
+ // Maybe place a larger overflow temple.
+ if (i == 0 && size > 1 && one_chance_in(10))
+ {
+ unsigned int num_gods = 1;
+
+ // Randomly choose from the sizes which have maps.
+ // FIXME: it would be better to take weights into account.
+ int chance = 0;
+ for (unsigned int j = 2; j <= size; j++)
+ {
+ string mapname = make_stringf("temple_overflow_%d", j);
+ if (!find_maps_for_tag(mapname).empty())
+ if (one_chance_in(++chance))
+ num_gods = j;
+ }
+
+ // Add any extra gods (the first was added already).
+ for (; i < num_gods - 1; i++)
+ gods.push_back((char) overflow_gods[i + 1]);
+ }
+
level_temples.push_back(temple);
}
}