summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mapdef.h
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-08 12:28:30 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-08 12:28:30 +0000
commit6c99170d8941c25c6aac7f131f0d55df52caa63a (patch)
tree73993fb9a6610d14975be5239929f26f06b9fc94 /crawl-ref/source/mapdef.h
parent93de8db42745db1d85c850cb1001baa1ac55bcc0 (diff)
downloadcrawl-ref-6c99170d8941c25c6aac7f131f0d55df52caa63a.tar.gz
crawl-ref-6c99170d8941c25c6aac7f131f0d55df52caa63a.zip
Fixed bug where Pandemonium demonlords did not get their rightful runes
(Cerebov and company) - bug was introduced circa 0.1.3. [1610237] Vaults can request specific items using ITEM: declarations and the item selectors defghijk. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@596 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mapdef.h')
-rw-r--r--crawl-ref/source/mapdef.h43
1 files changed, 42 insertions, 1 deletions
diff --git a/crawl-ref/source/mapdef.h b/crawl-ref/source/mapdef.h
index 1bb4650e1d..7bf5682dd6 100644
--- a/crawl-ref/source/mapdef.h
+++ b/crawl-ref/source/mapdef.h
@@ -83,7 +83,6 @@ private:
class mons_list {
public:
- mons_list(int nids, ...);
mons_list();
void clear();
@@ -92,6 +91,8 @@ public:
// Returns false if the monster is unrecognised.
bool add_mons(const std::string &s);
+ size_t size() const { return mons_ids.size(); }
+
private:
int mons_by_name(std::string name) const;
@@ -99,6 +100,45 @@ private:
std::vector<int> mons_ids;
};
+struct item_spec {
+ int genweight;
+
+ int base_type, sub_type;
+ int allow_uniques;
+ int level;
+ int race;
+
+ item_spec() : genweight(10), base_type(OBJ_RANDOM), sub_type(OBJ_RANDOM),
+ allow_uniques(1), level(-1), race(MAKE_ITEM_RANDOM_RACE)
+ {
+ }
+};
+
+typedef std::vector<item_spec> item_spec_list;
+
+class item_list {
+public:
+ item_list() : items() { }
+
+ void clear();
+ const std::vector<item_spec_list> &get_items() const;
+
+ std::string add_item(const std::string &spec);
+
+ size_t size() const { return items.size(); }
+
+private:
+ item_spec item_by_specifier(const std::string &spec);
+ item_spec_list parse_item_spec(std::string spec);
+ item_spec parse_single_spec(std::string s);
+ void parse_raw_name(std::string name, item_spec &spec);
+ void parse_random_by_class(std::string c, item_spec &spec);
+
+private:
+ std::vector<item_spec_list> items;
+ std::string error;
+};
+
// Not providing a constructor to make life easy for C-style initialisation.
class map_def {
public:
@@ -112,6 +152,7 @@ public:
map_lines map;
mons_list mons;
+ item_list items;
std::string random_symbols;