From 752b66f301b0bfbc911f3c7f42fcef1d64f7d9ed Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Thu, 22 Jan 2009 18:36:03 +0000 Subject: Commit patch by castamir: * allow placement of fixedarts and damaged/cursed items in vaults git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8699 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/mapdef.cc | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'crawl-ref/source/mapdef.cc') diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc index 532161e44c..98e41ce51d 100644 --- a/crawl-ref/source/mapdef.cc +++ b/crawl-ref/source/mapdef.cc @@ -33,6 +33,7 @@ REVISION("$Rev$"); #include "monplace.h" #include "mon-util.h" #include "place.h" +#include "randart.h" #include "stuff.h" #include "tags.h" @@ -2843,6 +2844,8 @@ item_spec item_list::parse_single_spec(std::string s) return (result); } + std::string fixed_str = strip_tag_prefix(s, "fixed:"); + if (strip_tag(s, "good_item")) result.level = MAKE_GOOD_ITEM; else @@ -2850,7 +2853,8 @@ item_spec item_list::parse_single_spec(std::string s) int number = strip_number_tag(s, "level:"); if (number != TAG_UNFOUND) { - if (number <= 0 && number != ISPEC_GOOD && number != ISPEC_SUPERB) + if (number <= 0 && number != ISPEC_GOOD && number != ISPEC_SUPERB + && number != ISPEC_DAMAGED && number != ISPEC_BAD) { error = make_stringf("Bad item level: %d", number); return (result); @@ -2860,6 +2864,17 @@ item_spec item_list::parse_single_spec(std::string s) } } + if (s.find("damaged ") == 0) + { + result.level = ISPEC_DAMAGED; + s = s.substr(8); + } + if (s.find("cursed ") == 0) + { + result.level = ISPEC_BAD; // damaged + cursed, actually + s = s.substr(7); + } + if (strip_tag(s, "no_uniq")) result.allow_uniques = 0; if (strip_tag(s, "allow_uniq")) @@ -2932,7 +2947,21 @@ item_spec item_list::parse_single_spec(std::string s) error.clear(); parse_raw_name(s, result); - if (!error.empty() || ego_str.empty()) + if (!error.empty()) + return (result); + + if (!fixed_str.empty()) + { + result.ego = get_fixedart_num(fixed_str.c_str()); + if (result.ego == SPWPN_NORMAL) + { + error = make_stringf("Unknown fixed art: %s", fixed_str.c_str()); + return result; + } + return result; + } + + if (ego_str.empty()) return (result); if (result.base_type != OBJ_WEAPONS -- cgit v1.2.3-54-g00ecf