From ccd8ab9d731d18d9fa3d6c29ed6bb9c8ab220c5d Mon Sep 17 00:00:00 2001 From: dshaligram Date: Sun, 8 Jul 2007 20:59:26 +0000 Subject: 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 --- crawl-ref/source/maps.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'crawl-ref/source/maps.cc') 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); } -- cgit v1.2.3-54-g00ecf