diff options
author | Adam Borowski <kilobyte@angband.pl> | 2012-08-31 00:44:20 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2012-08-31 00:44:20 +0200 |
commit | a9eeb4a370e85069c25286e5cedc9682d5d04b2e (patch) | |
tree | 450c0ccd5f5353553d5b96edee2850623dffcc03 /crawl-ref/source/dbg-maps.cc | |
parent | 57aec7d2a0ae1095fb1babd8f0fcc276927bf8e5 (diff) | |
parent | 35613e094ca5d0be028ee9261afebf3e35faa563 (diff) | |
download | crawl-ref-a9eeb4a370e85069c25286e5cedc9682d5d04b2e.tar.gz crawl-ref-a9eeb4a370e85069c25286e5cedc9682d5d04b2e.zip |
Merge branch 'master' into glasnost
Yay for conflicts galore (wax removal, std:: purge, tileidx changes).
Diffstat (limited to 'crawl-ref/source/dbg-maps.cc')
-rw-r--r-- | crawl-ref/source/dbg-maps.cc | 83 |
1 files changed, 42 insertions, 41 deletions
diff --git a/crawl-ref/source/dbg-maps.cc b/crawl-ref/source/dbg-maps.cc index be3e4dc128..63266c3898 100644 --- a/crawl-ref/source/dbg-maps.cc +++ b/crawl-ref/source/dbg-maps.cc @@ -22,16 +22,16 @@ #ifdef DEBUG_DIAGNOSTICS // Map statistics generation. -static std::map<std::string, int> mapgen_try_count; -static std::map<std::string, int> mapgen_use_count; -static std::map<level_id, int> mapgen_level_mapcounts; -static std::map< level_id, std::pair<int,int> > mapgen_map_builds; -static std::map< level_id, std::set<std::string> > mapgen_level_mapsused; +static map<string, int> mapgen_try_count; +static map<string, int> mapgen_use_count; +static map<level_id, int> mapgen_level_mapcounts; +static map< level_id, pair<int,int> > mapgen_map_builds; +static map< level_id, set<string> > mapgen_level_mapsused; -typedef std::map< std::string, std::set<level_id> > mapname_place_map; +typedef map< string, set<level_id> > mapname_place_map; static mapname_place_map mapgen_map_levelsused; -static std::map<std::string, std::string> mapgen_errors; -static std::string mapgen_last_error; +static map<string, string> mapgen_errors; +static string mapgen_last_error; static int mg_levels_tried = 0, mg_levels_failed = 0; static int mg_build_attempts = 0, mg_vetoes = 0; @@ -53,7 +53,9 @@ static bool _mg_is_disconnected_level() // Don't care about non-Dungeon levels. if (!player_in_connected_branch() || (branches[you.where_are_you].branch_flags & BFLAG_ISLANDED)) + { return false; + } return dgn_count_disconnected_zones(true); } @@ -108,7 +110,7 @@ static bool mg_do_build_level(int niters) } if (_mg_is_disconnected_level()) { - std::string vaults; + string vaults; for (int j = 0, size = env.level_vaults.size(); j < size; ++j) { if (j && !vaults.empty()) @@ -137,9 +139,9 @@ static bool mg_do_build_level(int niters) return true; } -static std::vector<level_id> mg_dungeon_places() +static vector<level_id> mg_dungeon_places() { - std::vector<level_id> places; + vector<level_id> places; for (int br = BRANCH_MAIN_DUNGEON; br < NUM_BRANCHES; ++br) { @@ -155,7 +157,7 @@ static std::vector<level_id> mg_dungeon_places() static bool mg_build_dungeon() { - const std::vector<level_id> places = mg_dungeon_places(); + const vector<level_id> places = mg_dungeon_places(); for (int i = 0, size = places.size(); i < size; ++i) { @@ -208,7 +210,7 @@ void mapgen_report_map_use(const map_def &map) mapgen_map_levelsused[map.name].insert(level_id::current()); } -void mapgen_report_error(const map_def &map, const std::string &err) +void mapgen_report_error(const map_def &map, const string &err) { mapgen_last_error = err; } @@ -218,10 +220,10 @@ static void _mapgen_report_available_random_vaults(FILE *outf) you.uniq_map_tags.clear(); you.uniq_map_names.clear(); - const std::vector<level_id> places = mg_dungeon_places(); + const vector<level_id> places = mg_dungeon_places(); fprintf(outf, "\n\nRandom vaults available by dungeon level:\n"); - for (std::vector<level_id>::const_iterator i = places.begin(); + for (vector<level_id>::const_iterator i = places.begin(); i != places.end(); ++i) { fprintf(outf, "\n%s -------------\n", i->describe().c_str()); @@ -234,7 +236,7 @@ static void _mapgen_report_available_random_vaults(FILE *outf) } } -static void _check_mapless(const level_id &lid, std::vector<level_id> &mapless) +static void _check_mapless(const level_id &lid, vector<level_id> &mapless) { if (mapgen_level_mapsused.find(lid) == mapgen_level_mapsused.end()) mapless.push_back(lid); @@ -251,15 +253,15 @@ static void _write_mapgen_stats() if (!mapgen_errors.empty()) { fprintf(outf, "\n\nMap errors:\n"); - for (std::map<std::string, std::string>::const_iterator i = - mapgen_errors.begin(); i != mapgen_errors.end(); ++i) + for (map<string, string>::const_iterator i = mapgen_errors.begin(); + i != mapgen_errors.end(); ++i) { fprintf(outf, "%s: %s\n", i->first.c_str(), i->second.c_str()); } } - std::vector<level_id> mapless; + vector<level_id> mapless; for (int i = BRANCH_MAIN_DUNGEON; i < NUM_BRANCHES; ++i) { if (brdepth[i] == -1) @@ -282,7 +284,7 @@ static void _write_mapgen_stats() _mapgen_report_available_random_vaults(outf); - std::vector<std::string> unused_maps; + vector<string> unused_maps; for (int i = 0, size = map_count(); i < size; ++i) { const map_def *map = map_by_index(i); @@ -296,20 +298,19 @@ static void _write_mapgen_stats() if (mg_vetoes) { fprintf(outf, "\n\nMost vetoed levels:\n"); - std::multimap<int, level_id> sortedvetos; - for (std::map< level_id, std::pair<int, int> >::const_iterator + multimap<int, level_id> sortedvetos; + for (map< level_id, pair<int, int> >::const_iterator i = mapgen_map_builds.begin(); i != mapgen_map_builds.end(); ++i) { if (!i->second.second) continue; - sortedvetos.insert( - std::pair<int, level_id>(i->second.second, i->first)); + sortedvetos.insert(pair<int, level_id>(i->second.second, i->first)); } int count = 0; - for (std::multimap<int, level_id>::reverse_iterator + for (multimap<int, level_id>::reverse_iterator i = sortedvetos.rbegin(); i != sortedvetos.rend(); ++i) { const int vetoes = i->first; @@ -328,15 +329,14 @@ static void _write_mapgen_stats() } fprintf(outf, "\n\nMaps by level:\n\n"); - for (std::map<level_id, std::set<std::string> >::const_iterator i = + for (map<level_id, set<string> >::const_iterator i = mapgen_level_mapsused.begin(); i != mapgen_level_mapsused.end(); ++i) { - std::string line = + string line = make_stringf("%s ------------\n", i->first.describe().c_str()); - const std::set<std::string> &maps = i->second; - for (std::set<std::string>::const_iterator j = maps.begin(); - j != maps.end(); ++j) + const set<string> &maps = i->second; + for (set<string>::const_iterator j = maps.begin(); j != maps.end(); ++j) { if (j != maps.begin()) line += ", "; @@ -356,17 +356,18 @@ static void _write_mapgen_stats() } fprintf(outf, "\n\nMaps used:\n\n"); - std::multimap<int, std::string> usedmaps; - for (std::map<std::string, int>::const_iterator i = - mapgen_try_count.begin(); i != mapgen_try_count.end(); ++i) - usedmaps.insert(std::pair<int, std::string>(i->second, i->first)); + multimap<int, string> usedmaps; + for (map<string, int>::const_iterator i = mapgen_try_count.begin(); + i != mapgen_try_count.end(); ++i) + { + usedmaps.insert(pair<int, string>(i->second, i->first)); + } - for (std::multimap<int, std::string>::reverse_iterator i = - usedmaps.rbegin(); i != usedmaps.rend(); ++i) + for (multimap<int, string>::reverse_iterator i = usedmaps.rbegin(); + i != usedmaps.rend(); ++i) { const int tries = i->first; - std::map<std::string, int>::const_iterator iuse = - mapgen_use_count.find(i->second); + map<string, int>::const_iterator iuse = mapgen_use_count.find(i->second); const int uses = iuse == mapgen_use_count.end()? 0 : iuse->second; if (tries == uses) fprintf(outf, "%4d : %s\n", tries, i->second.c_str()); @@ -379,13 +380,13 @@ static void _write_mapgen_stats() i != mapgen_map_levelsused.end(); ++i) { fprintf(outf, "%s ============\n", i->first.c_str()); - std::string line; - for (std::set<level_id>::const_iterator j = i->second.begin(); + string line; + for (set<level_id>::const_iterator j = i->second.begin(); j != i->second.end(); ++j) { if (!line.empty()) line += ", "; - std::string level = j->describe(); + string level = j->describe(); if (line.length() + level.length() > 79) { fprintf(outf, "%s\n", line.c_str()); |