summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mapdef.h
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-12-13 20:19:13 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-12-13 20:19:13 +0000
commitbf516ccc1f22f3449c9dce1c7828d97747f247d2 (patch)
tree96dd532b044dcaec47349a70db8bc91a9694fa8b /crawl-ref/source/mapdef.h
parentc4752d24d70640b0e57a7ed227d40ec4e6a617e2 (diff)
downloadcrawl-ref-bf516ccc1f22f3449c9dce1c7828d97747f247d2.tar.gz
crawl-ref-bf516ccc1f22f3449c9dce1c7828d97747f247d2.zip
mapdef/vault items can now have their race type and ego explicitly set.
mapdef/vault monsters can now be given an explicit list of items. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3055 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mapdef.h')
-rw-r--r--crawl-ref/source/mapdef.h128
1 files changed, 66 insertions, 62 deletions
diff --git a/crawl-ref/source/mapdef.h b/crawl-ref/source/mapdef.h
index 451e088e93..fe06561cd0 100644
--- a/crawl-ref/source/mapdef.h
+++ b/crawl-ref/source/mapdef.h
@@ -325,6 +325,69 @@ private:
bool solid_checked;
};
+enum item_spec_type
+{
+ ISPEC_GOOD = -2,
+ ISPEC_SUPERB = -3
+};
+
+struct item_spec
+{
+ int genweight;
+
+ object_class_type base_type;
+ int sub_type;
+ int ego;
+ int allow_uniques;
+ int level;
+ int race;
+ int qty;
+
+ item_spec() : genweight(10), base_type(OBJ_RANDOM), sub_type(OBJ_RANDOM),
+ ego(0), allow_uniques(1), level(-1), race(MAKE_ITEM_RANDOM_RACE),
+ qty(0)
+ {
+ }
+};
+typedef std::vector<item_spec> item_spec_list;
+
+class item_list
+{
+public:
+ item_list() : items() { }
+
+ void clear();
+
+ item_spec get_item(int index);
+ size_t size() const { return items.size(); }
+
+ std::string add_item(const std::string &spec, bool fix = false);
+ std::string set_item(int index, const std::string &spec);
+
+private:
+ struct item_spec_slot
+ {
+ item_spec_list ilist;
+ bool fix_slot;
+
+ item_spec_slot() : ilist(), fix_slot(false)
+ {
+ }
+ };
+
+private:
+ item_spec item_by_specifier(const std::string &spec);
+ item_spec_slot 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);
+ item_spec pick_item(item_spec_slot &slot);
+
+private:
+ std::vector<item_spec_slot> items;
+ std::string error;
+};
+
struct mons_spec
{
int mid;
@@ -335,11 +398,13 @@ struct mons_spec
bool generate_awake;
int colour;
+ item_list items;
+
mons_spec(int id = RANDOM_MONSTER, int num = 250,
int gw = 10, int ml = 0,
bool _fixmons = false, bool awaken = false)
: mid(id), monnum(num), genweight(gw), mlevel(ml), fix_mons(_fixmons),
- generate_awake(awaken), colour(BLACK)
+ generate_awake(awaken), colour(BLACK), items()
{
}
};
@@ -394,67 +459,6 @@ private:
std::string error;
};
-enum item_spec_type
-{
- ISPEC_GOOD = -2,
- ISPEC_SUPERB = -3
-};
-
-struct item_spec
-{
- int genweight;
-
- object_class_type base_type;
- int sub_type;
- int allow_uniques;
- int level;
- int race;
- int qty;
-
- item_spec() : genweight(10), base_type(OBJ_RANDOM), sub_type(OBJ_RANDOM),
- allow_uniques(1), level(-1), race(MAKE_ITEM_RANDOM_RACE), qty(0)
- {
- }
-};
-typedef std::vector<item_spec> item_spec_list;
-
-class item_list
-{
-public:
- item_list() : items() { }
-
- void clear();
-
- item_spec get_item(int index);
- size_t size() const { return items.size(); }
-
- std::string add_item(const std::string &spec, bool fix = false);
- std::string set_item(int index, const std::string &spec);
-
-private:
- struct item_spec_slot
- {
- item_spec_list ilist;
- bool fix_slot;
-
- item_spec_slot() : ilist(), fix_slot(false)
- {
- }
- };
-
-private:
- item_spec item_by_specifier(const std::string &spec);
- item_spec_slot 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);
- item_spec pick_item(item_spec_slot &slot);
-
-private:
- std::vector<item_spec_slot> items;
- std::string error;
-};
-
struct feature_spec
{
int genweight;