summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/ng-init.cc
diff options
context:
space:
mode:
authorSteve Melenchuk <smelenchuk@gmail.com>2014-05-15 17:14:04 -0600
committerSteve Melenchuk <smelenchuk@gmail.com>2014-05-15 17:14:04 -0600
commit727b7af61c0367653a2afc1bd4fd77390cb0e282 (patch)
treec42d681783218a5367d27815dbf0ab9fe0c1c15f /crawl-ref/source/ng-init.cc
parent95e49122495968d9e27de598940d9c8e56d71202 (diff)
downloadcrawl-ref-727b7af61c0367653a2afc1bd4fd77390cb0e282.tar.gz
crawl-ref-727b7af61c0367653a2afc1bd4fd77390cb0e282.zip
Support for variable-altar-count Temples.
Based on a note about wanting corrupted_temple to support a variable number of altars; it can now do 6-9. (I left the lower limit at 6 because that's currently the smallest any temple is.) Inspired by a couple of temple designs I'll probably add shortly.
Diffstat (limited to 'crawl-ref/source/ng-init.cc')
-rw-r--r--crawl-ref/source/ng-init.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/crawl-ref/source/ng-init.cc b/crawl-ref/source/ng-init.cc
index 26e53f5017..b03fb08fcc 100644
--- a/crawl-ref/source/ng-init.cc
+++ b/crawl-ref/source/ng-init.cc
@@ -139,12 +139,43 @@ void initialise_temples()
map_def *main_temple = NULL;
for (int i = 0; i < 10; i++)
{
+ int altar_count = 0;
+
main_temple
= const_cast<map_def*>(random_map_for_place(ecumenical, false));
if (main_temple == NULL)
end(1, false, "No temples?!");
+ if (main_temple->has_tag("temple_variable"))
+ {
+ vector<int> sizes;
+ vector<string> tag_list = main_temple->get_tags();
+ for (unsigned int j = 0; j < tag_list.size(); j++)
+ {
+ if (starts_with(tag_list[j], "temple_altars_"))
+ {
+ sizes.push_back(
+ atoi(
+ strip_tag_prefix(
+ tag_list[j], "temple_altars_").c_str()));
+ }
+ }
+ if (sizes.empty())
+ {
+ mprf(MSGCH_ERROR,
+ "Temple %s set as variable but has no sizes.",
+ main_temple->name.c_str());
+ main_temple = NULL;
+ continue;
+ }
+ altar_count =
+ you.props[TEMPLE_SIZE_KEY].get_int() =
+ sizes[random2(sizes.size())];
+ }
+
+ dgn_map_parameters mp(make_stringf("temple_altars_%d", altar_count));
+
// Without all this find_glyph() returns 0.
string err;
main_temple->load();
@@ -156,6 +187,7 @@ void initialise_temples()
mprf(MSGCH_ERROR, "Temple %s: %s", main_temple->name.c_str(),
err.c_str());
main_temple = NULL;
+ you.props.erase(TEMPLE_SIZE_KEY);
continue;
}
@@ -167,6 +199,7 @@ void initialise_temples()
mprf(MSGCH_ERROR, "Temple %s: %s", main_temple->name.c_str(),
err.c_str());
main_temple = NULL;
+ you.props.erase(TEMPLE_SIZE_KEY);
continue;
}
break;