summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dbg-maps.cc
diff options
context:
space:
mode:
authorRaphael Langella <raphael.langella@gmail.com>2012-08-26 22:50:06 +0200
committerRaphael Langella <raphael.langella@gmail.com>2012-08-26 23:06:30 +0200
commit770bcbd1844b97b671d0e47ea8313cdf2c74c5ea (patch)
treee030cf61afce9ca69b74bb38eb73734bf10f633e /crawl-ref/source/dbg-maps.cc
parenta6c16c7f2066c854a01f25e9e6c3d8e44282a638 (diff)
downloadcrawl-ref-770bcbd1844b97b671d0e47ea8313cdf2c74c5ea.tar.gz
crawl-ref-770bcbd1844b97b671d0e47ea8313cdf2c74c5ea.zip
Use std namespace.
I had to rename distance() (in coord.h) to distance2() because it conflicts with the STL function to compare 2 iterators. Not a bad change given how it returns the square of the distance anyway. I also had to rename the message global variable (in message.cc) to buffer. I tried to fix and improve the coding style has much as I could, but I probably missed a few given how huge and tedious it is. I also didn't touch crawl-gdb.py, and the stuff in prebuilt, rltiles/tool and util/levcomp.*, because I have no clue about those.
Diffstat (limited to 'crawl-ref/source/dbg-maps.cc')
-rw-r--r--crawl-ref/source/dbg-maps.cc79
1 files changed, 38 insertions, 41 deletions
diff --git a/crawl-ref/source/dbg-maps.cc b/crawl-ref/source/dbg-maps.cc
index 739dd21ebc..56d3dd9513 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;
@@ -111,7 +111,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())
@@ -140,9 +140,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)
{
@@ -158,7 +158,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)
{
@@ -211,7 +211,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;
}
@@ -221,10 +221,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());
@@ -237,7 +237,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);
@@ -254,15 +254,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)
@@ -285,7 +285,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);
@@ -299,20 +299,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;
@@ -331,15 +330,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 += ", ";
@@ -359,19 +357,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)
+ multimap<int, string> usedmaps;
+ for (map<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));
+ 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());
@@ -384,13 +381,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());