summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mapdef.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-23 12:43:59 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-23 12:43:59 +0000
commitf3b465a2e3fa4d16eaf9ff89065fa3a67c2775ea (patch)
tree988c8b7c4e77c20af69a351f1c474b46bfe3987f /crawl-ref/source/mapdef.cc
parent7bb02de9ea841f515a3a037435c07099f5165aea (diff)
downloadcrawl-ref-f3b465a2e3fa4d16eaf9ff89065fa3a67c2775ea.tar.gz
crawl-ref-f3b465a2e3fa4d16eaf9ff89065fa3a67c2775ea.zip
Fixed nsubst restricting counts to single digits (dpeg).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7548 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mapdef.cc')
-rw-r--r--crawl-ref/source/mapdef.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index 1203d6d483..fbb2dc5880 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -80,10 +80,13 @@ std::string mapdef_split_key_item(const std::string &s,
*key = trimmed_string(s.substr(0, sep));
std::string substitute = trimmed_string(s.substr(sep + 1));
- if (key->empty() || (int) key->length() > key_max_len)
+ if (key->empty() ||
+ (key_max_len != -1 && (int) key->length() > key_max_len))
+ {
return make_stringf(
- "selector '%s' must be exactly one character in '%s'",
- key->c_str(), s.c_str());
+ "selector '%s' must be <= %d characters in '%s'",
+ key->c_str(), key_max_len, s.c_str());
+ }
if (substitute.empty())
return make_stringf("no substitute defined in '%s'",
@@ -596,7 +599,7 @@ std::string map_lines::parse_nsubst_spec(const std::string &s,
{
std::string key, arg;
int sep;
- std::string err = mapdef_split_key_item(s, &key, &sep, &arg);
+ std::string err = mapdef_split_key_item(s, &key, &sep, &arg, -1);
if (!err.empty())
return err;
const int keyval = key == "*"? -1 : atoi(key.c_str());