From 6c99170d8941c25c6aac7f131f0d55df52caa63a Mon Sep 17 00:00:00 2001 From: dshaligram Date: Fri, 8 Dec 2006 12:28:30 +0000 Subject: 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 --- crawl-ref/source/mapdef.h | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'crawl-ref/source/mapdef.h') 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 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_list; + +class item_list { +public: + item_list() : items() { } + + void clear(); + const std::vector &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 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; -- cgit v1.2.3-54-g00ecf