summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mapdef.h
diff options
context:
space:
mode:
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;