summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mapdef.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-22 18:36:03 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-22 18:36:03 +0000
commit752b66f301b0bfbc911f3c7f42fcef1d64f7d9ed (patch)
tree0941572143127178147551f551d751e442f2b295 /crawl-ref/source/mapdef.cc
parent461b3e21bdc62c92c0237ac61960489771579fbb (diff)
downloadcrawl-ref-752b66f301b0bfbc911f3c7f42fcef1d64f7d9ed.tar.gz
crawl-ref-752b66f301b0bfbc911f3c7f42fcef1d64f7d9ed.zip
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
Diffstat (limited to 'crawl-ref/source/mapdef.cc')
-rw-r--r--crawl-ref/source/mapdef.cc33
1 files changed, 31 insertions, 2 deletions
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