summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/describe.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-12 20:42:42 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-12 20:42:42 +0000
commit6bb8ebbe1d9b86ce5cb492bd0a59cd8b29e831ef (patch)
treea03f43abc8a2fca032968b7792c6ac6da31fe989 /crawl-ref/source/describe.cc
parentd2037387cfc89ae80196bcbd816a76c910312e7d (diff)
downloadcrawl-ref-6bb8ebbe1d9b86ce5cb492bd0a59cd8b29e831ef.tar.gz
crawl-ref-6bb8ebbe1d9b86ce5cb492bd0a59cd8b29e831ef.zip
Added KFEAT:, KITEM: and KMONS: map directives to allow placing specific
monsters, terrain (named altars, traps, shops) and items all on the same square. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1028 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/describe.cc')
-rw-r--r--crawl-ref/source/describe.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 3929106b4e..20a66edbce 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -332,11 +332,31 @@ static const char *trap_names[] =
const char *trap_name(trap_type trap)
{
+ ASSERT(NUM_TRAPS == sizeof(trap_names) / sizeof(*trap_names));
+
if (trap >= TRAP_DART && trap < NUM_TRAPS)
return trap_names[ static_cast<int>( trap ) ];
return (NULL);
}
+int str_to_trap(const std::string &s)
+{
+ ASSERT(NUM_TRAPS == sizeof(trap_names) / sizeof(*trap_names));
+
+ if (s == "random")
+ return (TRAP_RANDOM);
+ else if (s == "suitable")
+ return (TRAP_INDEPTH);
+
+ for (int i = 0; i < NUM_TRAPS; ++i)
+ {
+ if (trap_names[i] == s)
+ return (i);
+ }
+
+ return (-1);
+}
+
//---------------------------------------------------------------
//
// describe_demon