summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/maps.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-07-08 20:59:26 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-07-08 20:59:26 +0000
commitccd8ab9d731d18d9fa3d6c29ed6bb9c8ab220c5d (patch)
tree50445a3689cc911f1d28ea535a2a5a049b314e71 /crawl-ref/source/maps.cc
parenteb6bb5f5ee6d07cdfb1b3239b155e8b252e98ae6 (diff)
downloadcrawl-ref-ccd8ab9d731d18d9fa3d6c29ed6bb9c8ab220c5d.tar.gz
crawl-ref-ccd8ab9d731d18d9fa3d6c29ed6bb9c8ab220c5d.zip
Added debugging code to generate multiple dungeons (all branches and levels)
and gather statistics on maps used and Lua errors encountered. To use it, run "crawl -mapstat" with a full-debug build. Output will be mapgen.log in the current directory. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1805 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/maps.cc')
-rw-r--r--crawl-ref/source/maps.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc
index d2d63f6eef..a71392ce46 100644
--- a/crawl-ref/source/maps.cc
+++ b/crawl-ref/source/maps.cc
@@ -63,6 +63,8 @@ int vault_main(
#ifdef DEBUG_DIAGNOSTICS
mprf(MSGCH_DIAGNOSTICS, "Generating level: %s",
vdefs[which_vault].name.c_str());
+ if (crawl_state.map_stat_gen)
+ mapgen_report_map_try(vdefs[which_vault]);
#endif
// first, fill in entirely with walls and null-terminate {dlb}:
@@ -78,7 +80,14 @@ int vault_main(
// Return value of zero forces dungeon.cc to regenerate the level, except
// for branch entry vaults where dungeon.cc just rejects the vault and
// places a vanilla entry.
- return write_vault( vdefs[which_vault], vgrid, place, avoid );
+ const int result = write_vault( vdefs[which_vault], vgrid, place, avoid );
+
+#ifdef DEBUG_DIAGNOSTICS
+ if (crawl_state.map_stat_gen && result > 0)
+ mapgen_report_map_use(vdefs[which_vault]);
+#endif
+
+ return (result);
}
static int write_vault(map_def &mdef, map_type map,
@@ -117,6 +126,10 @@ static bool resolve_map(map_def &map, const map_def &original)
std::string err = map.run_lua(true);
if (!err.empty())
{
+#ifdef DEBUG_DIAGNOSTICS
+ if (crawl_state.map_stat_gen)
+ mapgen_report_error(map, err);
+#endif
mprf(MSGCH_WARN, "Lua error: %s", err.c_str());
return (false);
}