summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mapdef.cc
diff options
context:
space:
mode:
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());