summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mapdef.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/mapdef.cc')
-rw-r--r--crawl-ref/source/mapdef.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index b9df39c83f..71f28e40f5 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -34,6 +34,7 @@ REVISION("$Rev$");
#include "monplace.h"
#include "mon-util.h"
#include "place.h"
+#include "religion.h"
#include "stuff.h"
#include "tags.h"
@@ -2823,6 +2824,15 @@ static int str_to_ego(item_spec &spec, std::string ego_str)
return 0;
}
+int item_list::parse_acquirement_source(const std::string &source)
+{
+ const std::string god_name(replace_all_of(source, "_", " "));
+ const god_type god(string_to_god(god_name.c_str(), true));
+ if (god == GOD_NO_GOD)
+ error = make_stringf("unknown god name: '%s'", god_name.c_str());
+ return (god);
+}
+
item_spec item_list::parse_single_spec(std::string s)
{
item_spec result;
@@ -2844,6 +2854,22 @@ item_spec item_list::parse_single_spec(std::string s)
if (qty != TAG_UNFOUND)
result.qty = qty;
+ const std::string acquirement_source = strip_tag_prefix(s, "acquire:");
+ if (!acquirement_source.empty() || strip_tag(s, "acquire"))
+ {
+ if (!acquirement_source.empty())
+ result.acquirement_source =
+ parse_acquirement_source(acquirement_source);
+ // If requesting acquirement, must specify item base type or
+ // "any".
+ result.level = ISPEC_ACQUIREMENT;
+ if (s == "any")
+ result.base_type = OBJ_RANDOM;
+ else
+ parse_random_by_class(s, result);
+ return (result);
+ }
+
std::string ego_str = strip_tag_prefix(s, "ego:");
std::string race_str = strip_tag_prefix(s, "race:");
lowercase(ego_str);