summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dbg-maps.cc
diff options
context:
space:
mode:
authorgammafunk <gammafunk@gmail.com>2014-06-25 13:39:48 -0500
committergammafunk <gammafunk@gmail.com>2014-06-25 13:39:48 -0500
commit4d50fd935254d27d6ff31d0c5927c61d01553129 (patch)
tree1db304ad9cd7968b3e7809811c68b962416a9b4e /crawl-ref/source/dbg-maps.cc
parent259044d0f8f1f1a8a2724f57f50e8e1703f53110 (diff)
downloadcrawl-ref-4d50fd935254d27d6ff31d0c5927c61d01553129.tar.gz
crawl-ref-4d50fd935254d27d6ff31d0c5927c61d01553129.zip
Print some informative messages when running -mapstat
Print the numbers of levels, iterations, and branches, as well as the output file.
Diffstat (limited to 'crawl-ref/source/dbg-maps.cc')
-rw-r--r--crawl-ref/source/dbg-maps.cc29
1 files changed, 20 insertions, 9 deletions
diff --git a/crawl-ref/source/dbg-maps.cc b/crawl-ref/source/dbg-maps.cc
index 876b94c212..e77c2c1e57 100644
--- a/crawl-ref/source/dbg-maps.cc
+++ b/crawl-ref/source/dbg-maps.cc
@@ -138,15 +138,17 @@ static bool _do_build_level()
return true;
}
-static vector<level_id> _dungeon_places()
+static vector<level_id> _dungeon_places(int *num_branches = NULL)
{
vector<level_id> places;
+ if (num_branches)
+ *num_branches = 0;
for (int br = BRANCH_DUNGEON; br < NUM_BRANCHES; ++br)
{
if (brdepth[br] == -1)
continue;
-
+ bool new_branch = true;
const branch_type branch = static_cast<branch_type>(br);
for (int depth = 1; depth <= brdepth[br]; ++depth)
{
@@ -154,15 +156,18 @@ static vector<level_id> _dungeon_places()
if (SysEnv.map_gen_range.get() && !SysEnv.map_gen_range->is_usable_in(l))
continue;
places.push_back(l);
+ if (num_branches && new_branch)
+ {
+ ++(*num_branches);
+ new_branch = false;
+ }
}
}
return places;
}
-static bool _build_dungeon()
+static bool _build_dungeon(const vector<level_id> &places)
{
- const vector<level_id> places = _dungeon_places();
-
for (int i = 0, size = places.size(); i < size; ++i)
{
const level_id &lid = places[i];
@@ -177,7 +182,6 @@ static bool _build_dungeon()
you.unique_creatures.set(MONS_THE_ENCHANTRESS, false);
}
#endif
-
if (!_do_build_level())
return false;
}
@@ -186,9 +190,14 @@ static bool _build_dungeon()
static void _build_levels(int niters)
{
+ int num_branches = 0;
+ const vector<level_id> places = _dungeon_places(&num_branches);
+
clear_messages();
mpr("Generating dungeon map stats");
-
+ printf("Generating map stats for %d iteration(s) of %d level(s) over "
+ "%d branch(es).\n", niters, (int) places.size(), num_branches);
+ fflush(stdout);
for (int i = 0; i < niters; ++i)
{
clear_messages();
@@ -209,7 +218,7 @@ static void _build_levels(int niters)
you.unique_creatures.reset();
initialise_branch_depths();
init_level_connectivity();
- if (!_build_dungeon())
+ if (!_build_dungeon(places))
break;
}
}
@@ -264,7 +273,8 @@ static void _check_mapless(const level_id &lid, vector<level_id> &mapless)
static void _write_map_stats()
{
- FILE *outf = fopen("mapstat.log", "w");
+ const char *out_file = "mapstat.log";
+ FILE *outf = fopen(out_file, "w");
fprintf(outf, "Map Generation Stats\n\n");
fprintf(outf, "Levels attempted: %d, built: %d, failed: %d\n",
levels_tried, levels_tried - levels_failed,
@@ -426,6 +436,7 @@ static void _write_map_stats()
fprintf(outf, "==================\n\n");
}
fclose(outf);
+ printf("Wrote map stats to %s\n", out_file);
}
void mapstat_generate_stats()