summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-20 10:32:52 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-20 10:32:52 +0000
commit40d686b7f05b03bb1b63dbb062acea1c0415b1b2 (patch)
treee171511065231ff16824407bd36f672b12d04a21
parentf57fa3bedc9a99e53729c8d0d05dbbe4a6ba0216 (diff)
downloadcrawl-ref-40d686b7f05b03bb1b63dbb062acea1c0415b1b2.tar.gz
crawl-ref-40d686b7f05b03bb1b63dbb062acea1c0415b1b2.zip
Fixed KMONS not accepting comma-separated list of alternative monsters.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7291 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/docs/level_design.txt2
-rw-r--r--crawl-ref/source/mapdef.cc9
2 files changed, 8 insertions, 3 deletions
diff --git a/crawl-ref/docs/level_design.txt b/crawl-ref/docs/level_design.txt
index c5e1c66dc8..a09399129d 100644
--- a/crawl-ref/docs/level_design.txt
+++ b/crawl-ref/docs/level_design.txt
@@ -690,7 +690,6 @@ KMONS: ? = orc priest / w:3 deep elf priest
places a rat on a shallow water square for all occurrences of Z.
---- The following feature is not yet working --------------------------------
KMONS: also allows you to specify alternative monsters if the
primary monster you want to place is unavailable (because it
is a unique that was already generated). For instance, if you want
@@ -699,7 +698,6 @@ KMONS: ? = orc priest / w:3 deep elf priest
KMONS: n = Terence, Michael, Erica, human
Or if you want to pick randomly:
KMONS: n = Terence / Michael / Erica, human
------------------------------------------------------------------------------
KMASK: Z = no_monster_gen
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index 651f475253..0f9cb1f838 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -2993,7 +2993,14 @@ std::string keyed_mapspec::set_mons(const std::string &s, bool fix)
err.clear();
mons.clear();
- return (mons.add_mons(s, fix));
+ std::vector<std::string> segments = split_string(",", s);
+ for (int i = 0, size = segments.size(); i < size; ++i)
+ {
+ const std::string error = mons.add_mons(segments[i], fix);
+ if (!error.empty())
+ return (error);
+ }
+ return ("");
}
std::string keyed_mapspec::set_item(const std::string &s, bool fix)