summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/branch.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/branch.cc')
-rw-r--r--crawl-ref/source/branch.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/crawl-ref/source/branch.cc b/crawl-ref/source/branch.cc
index 2df448e731..1aef71e6a9 100644
--- a/crawl-ref/source/branch.cc
+++ b/crawl-ref/source/branch.cc
@@ -34,6 +34,27 @@ branch_type str_to_branch(const std::string &branch, branch_type err)
return (err);
}
+static const char *level_type_names[] =
+{
+ "D", "Lab", "Abyss", "Pan", "Port"
+};
+
+const char *level_area_type_name(int level_type)
+{
+ if (level_type >= 0 && level_type < NUM_LEVEL_AREA_TYPES)
+ return level_type_names[level_type];
+ return ("");
+}
+
+level_area_type str_to_level_area_type(const std::string &s)
+{
+ for (int i = 0; i < NUM_LEVEL_AREA_TYPES; ++i)
+ if (s == level_type_names[i])
+ return (static_cast<level_area_type>(i));
+
+ return (LEVEL_DUNGEON);
+}
+
bool set_branch_flags(unsigned long flags, bool silent,
branch_type branch)
{