summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_debug.cc
diff options
context:
space:
mode:
authorDarshan Shaligram <dshaligram@users.sourceforge.net>2010-01-09 01:21:44 +0530
committerDarshan Shaligram <dshaligram@users.sourceforge.net>2010-01-09 01:47:09 +0530
commit9841ce45ea91c1ad394d706fd748ffc1fd9d9de0 (patch)
tree047cbb69276a6b8c55d9b22c1e01442a8bd7d173 /crawl-ref/source/l_debug.cc
parent915b92e5527c1300fa701a31e3dcbc070b48d177 (diff)
downloadcrawl-ref-9841ce45ea91c1ad394d706fd748ffc1fd9d9de0.tar.gz
crawl-ref-9841ce45ea91c1ad394d706fd748ffc1fd9d9de0.zip
Add -script option to Crawl to run a Lua script. Scripts are similar to tests, but can be parameterised.
Add a script to generate 150 level at a named place and report on all the monsters generated there.
Diffstat (limited to 'crawl-ref/source/l_debug.cc')
-rw-r--r--crawl-ref/source/l_debug.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/crawl-ref/source/l_debug.cc b/crawl-ref/source/l_debug.cc
index f500b631ce..8fef92b954 100644
--- a/crawl-ref/source/l_debug.cc
+++ b/crawl-ref/source/l_debug.cc
@@ -9,6 +9,7 @@
#include "l_libs.h"
#include "beam.h"
+#include "branch.h"
#include "chardump.h"
#include "coordit.h"
#include "dungeon.h"
@@ -24,16 +25,31 @@
#include "wiz-dgn.h"
// WARNING: This is a very low-level call.
+//
+// Usage: goto_place("placename", <bind_entrance>)
+// "placename" is the name of the place as used in maps, such as "Lair:2",
+// "Vault:$", etc.
+//
+// If <bind_entrance> is specified, the entrance point of
+// the branch specified in place_name is bound to the given level in the
+// parent branch (the entrance level should be 1-based). This can be helpful
+// when testing scenarios that depend on the absolute depth of the current
+// place.
LUAFN(debug_goto_place)
{
try
{
const level_id id = level_id::parse_level_id(luaL_checkstring(ls, 1));
+ const int bind_entrance =
+ lua_isnumber(ls, 2)? luaL_checkint(ls, 2) : -1;
you.level_type = id.level_type;
if (id.level_type == LEVEL_DUNGEON)
{
you.where_are_you = static_cast<branch_type>(id.branch);
you.your_level = absdungeon_depth(id.branch, id.depth);
+
+ if (bind_entrance != -1)
+ branches[you.where_are_you].startdepth = bind_entrance;
}
}
catch (const std::string &err)