summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/docs/develop/levels/syntax.txt3
-rw-r--r--crawl-ref/source/dungeon.cc5
-rw-r--r--crawl-ref/source/mapdef.cc16
3 files changed, 19 insertions, 5 deletions
diff --git a/crawl-ref/docs/develop/levels/syntax.txt b/crawl-ref/docs/develop/levels/syntax.txt
index 1a1f7aff5d..337580013d 100644
--- a/crawl-ref/docs/develop/levels/syntax.txt
+++ b/crawl-ref/docs/develop/levels/syntax.txt
@@ -519,6 +519,9 @@ MONS: (list of monsters)
colour. Use this *very* sparingly:
MONS: col:darkgrey fungus
+ The colour "any" can be given, in which case a random colour
+ will be chosen when the monster is placed.
+
Note that 8, 9, 0 also place monsters (see the table).
If you want to place a random monster suitable for the level
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 294944dba5..381eb18982 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -19,6 +19,7 @@
#include "branch.h"
#include "chardump.h"
#include "cloud.h"
+#include "colour.h"
#include "defines.h"
#include "effects.h"
#include "enum.h"
@@ -4852,6 +4853,10 @@ int dgn_place_monster(mons_spec &mspec,
mg.colour = mspec.colour;
mg.mname = mspec.monname;
+ // XXX: hack.
+ if (mg.colour == BLACK)
+ mg.colour = random_colour();
+
coord_def place(where);
if (!force_pos && monster_at(place)
&& (mg.cls < NUM_MONSTERS || mg.cls == RANDOM_MONSTER))
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index ebafae76e2..c295cc5394 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -2576,12 +2576,18 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec)
std::string colour = strip_tag_prefix(mon_str, "col:");
if (!colour.empty())
{
- mspec.colour = str_to_colour(colour, BLACK);
- if (mspec.colour == BLACK)
+ if (colour == "any")
+ // XXX: Hack
+ mspec.colour = BLACK;
+ else
{
- error = make_stringf("bad monster colour \"%s\" in \"%s\"",
- colour.c_str(), specs[i].c_str());
- return (slot);
+ mspec.colour = str_to_colour(colour, BLACK);
+ if (mspec.colour == BLACK)
+ {
+ error = make_stringf("bad monster colour \"%s\" in \"%s\"",
+ colour.c_str(), specs[i].c_str());
+ return (slot);
+ }
}
}