summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mapdef.cc
diff options
context:
space:
mode:
authorJude Brown <bookofjude@users.sourceforge.net>2009-12-10 17:58:53 +1000
committerJude Brown <bookofjude@users.sourceforge.net>2009-12-10 18:20:18 +1000
commitc06a6dcbe24d55c008a4179fc28892ad67ab073e (patch)
tree5e4fa6b3bfd5b788513613f9f4b199702663325b /crawl-ref/source/mapdef.cc
parent2c6f84f7b21882feeded0a197803acd612afe659 (diff)
downloadcrawl-ref-c06a6dcbe24d55c008a4179fc28892ad67ab073e.tar.gz
crawl-ref-c06a6dcbe24d55c008a4179fc28892ad67ab073e.zip
Overriding monster tiles in vault definitions.
It is now possible to specify a tile for monsters when specifying monsters in vault definitions. The syntax is "tile:<tile name>". All tiles that don't start with "mons_" will have this prefixed, therefore "tile:giant_bat" will become "tile:mons_giant_bat", but "tile:mons_rat" will remain unchanged.
Diffstat (limited to 'crawl-ref/source/mapdef.cc')
-rw-r--r--crawl-ref/source/mapdef.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index 4a9162cadd..76dc38c452 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -3160,6 +3160,23 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec)
}
}
+ std::string tile = strip_tag_prefix(mon_str, "tile:");
+#ifdef USE_TILE
+ if (!tile.empty())
+ {
+ // Modify the string to prevent them from using non-mons tiles.
+ if (tile.find("mons_") == std::string::npos)
+ tile = std::string("mons_" + tile);
+ unsigned int index;
+ if (!tile_player_index(tile.c_str(), index))
+ {
+ error = make_stringf("bad tile name: \"%s\".", tile.c_str());
+ return (slot);
+ }
+ mspec.props["monster_tile"] = short(index);
+ }
+#endif
+
std::string name = strip_tag_prefix(mon_str, "name:");
if (!name.empty())
{