diff options
author | Neil Moore <neil@s-z.org> | 2014-07-01 16:58:22 -0400 |
---|---|---|
committer | Neil Moore <neil@s-z.org> | 2014-07-01 16:58:22 -0400 |
commit | 04ddf5499e56bbbd39a2de213ff850221b334ade (patch) | |
tree | 8e76b0b36456ae3385efa29d4890ffad9097d206 /crawl-ref/source/dbg-maps.cc | |
parent | 18b54c0902a98ff1fb265a16528e4beb1c44033d (diff) | |
download | crawl-ref-04ddf5499e56bbbd39a2de213ff850221b334ade.tar.gz crawl-ref-04ddf5499e56bbbd39a2de213ff850221b334ade.zip |
Include veto reasons in mapstat.log.
Diffstat (limited to 'crawl-ref/source/dbg-maps.cc')
-rw-r--r-- | crawl-ref/source/dbg-maps.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/crawl-ref/source/dbg-maps.cc b/crawl-ref/source/dbg-maps.cc index c4cf56b745..7ebaf8f55d 100644 --- a/crawl-ref/source/dbg-maps.cc +++ b/crawl-ref/source/dbg-maps.cc @@ -39,6 +39,8 @@ static string last_error; static int levels_tried = 0, levels_failed = 0; static int build_attempts = 0, level_vetoes = 0; +// Map from message to counts. +static map<string, int> veto_messages; void mapstat_report_map_build_start() { @@ -46,9 +48,10 @@ void mapstat_report_map_build_start() map_builds[level_id::current()].first++; } -void mapstat_report_map_veto() +void mapstat_report_map_veto(const string &message) { level_vetoes++; + ++veto_messages[message]; map_builds[level_id::current()].second++; } @@ -361,6 +364,20 @@ static void _write_map_stats() ++count, i->second.describe().c_str(), vetoes, tries, vetoes * 100.0 / tries); } + + fprintf(outf, "\n\nVeto reasons:\n"); + multimap<int, string> sortedreasons; + for (map<string, int>::const_iterator i = veto_messages.begin(); + i != veto_messages.end(); ++i) + { + sortedreasons.insert(pair<int, string>(i->second, i->first)); + } + + for (multimap<int, string>::reverse_iterator + i = sortedreasons.rbegin(); i != sortedreasons.rend(); ++i) + { + fprintf(outf, "%3d) %s\n", i->first, i->second.c_str()); + } } if (!unused_maps.empty() && !SysEnv.map_gen_range.get()) |