summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/view.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/view.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/view.cc')
-rw-r--r--crawl-ref/source/view.cc50
1 files changed, 25 insertions, 25 deletions
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index f3926199d6..13f69c62e8 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -70,7 +70,7 @@
crawl_view_geometry crawl_view;
-bool handle_seen_interrupt(monster* mons, std::vector<std::string>* msgs_buf)
+bool handle_seen_interrupt(monster* mons, vector<string>* msgs_buf)
{
activity_interrupt_data aid(mons);
if (mons->seen_context)
@@ -163,14 +163,14 @@ void seen_monsters_react()
}
}
-static std::string _desc_mons_type_map(std::map<monster_type, int> types)
+static string _desc_mons_type_map(map<monster_type, int> types)
{
- std::string message;
+ string message;
unsigned int count = 1;
- for (std::map<monster_type, int>::iterator it = types.begin();
+ for (map<monster_type, int>::iterator it = types.begin();
it != types.end(); ++it)
{
- std::string name;
+ string name;
description_level_type desc;
if (it->second == 1)
desc = DESC_A;
@@ -203,12 +203,12 @@ static std::string _desc_mons_type_map(std::map<monster_type, int> types)
* @param types monster types and the number of monster for each type.
* @param genera monster genera and the number of monster for each genus.
*/
-static void _genus_factoring(std::map<monster_type, int> &types,
- std::map<monster_type, int> &genera)
+static void _genus_factoring(map<monster_type, int> &types,
+ map<monster_type, int> &genera)
{
monster_type genus = MONS_NO_MONSTER;
int num = 0;
- std::map<monster_type, int>::iterator it;
+ map<monster_type, int>::iterator it;
// Find the most represented genus.
for (it = genera.begin(); it != genera.end(); ++it)
if (it->second > num)
@@ -250,8 +250,8 @@ void update_monsters_in_view()
{
const unsigned int max_msgs = 4;
int num_hostile = 0;
- std::vector<std::string> msgs;
- std::vector<monster*> monsters;
+ vector<string> msgs;
+ vector<monster*> monsters;
for (monster_iterator mi; mi; ++mi)
{
@@ -289,8 +289,8 @@ void update_monsters_in_view()
if (!msgs.empty())
{
unsigned int size = monsters.size();
- std::map<monster_type, int> types;
- std::map<monster_type, int> genera; // This is the plural for genus!
+ map<monster_type, int> types;
+ map<monster_type, int> genera; // This is the plural for genus!
for (unsigned int i = 0; i < size; ++i)
{
monster_type type;
@@ -313,7 +313,7 @@ void update_monsters_in_view()
}
bool warning = false;
- std::string warning_msg = "Ashenzari warns you:";
+ string warning_msg = "Ashenzari warns you:";
warning_msg += " ";
for (unsigned int i = 0; i < size; ++i)
{
@@ -328,7 +328,7 @@ void update_monsters_in_view()
else
warning = true;
- std::string monname;
+ string monname;
if (size == 1)
monname = mon->pronoun(PRONOUN_SUBJECTIVE);
else if (mon->type == MONS_DANCING_WEAPON)
@@ -403,11 +403,11 @@ static const FixedArray<uint8_t, GXM, GYM>& _tile_difficulties(bool random)
return cache;
}
-static std::auto_ptr<FixedArray<bool, GXM, GYM> > _tile_detectability()
+static auto_ptr<FixedArray<bool, GXM, GYM> > _tile_detectability()
{
- std::auto_ptr<FixedArray<bool, GXM, GYM> > map(new FixedArray<bool, GXM, GYM>);
+ auto_ptr<FixedArray<bool, GXM, GYM> > map(new FixedArray<bool, GXM, GYM>);
- std::vector<coord_def> flood_from;
+ vector<coord_def> flood_from;
for (int x = X_BOUND_1; x <= X_BOUND_2; ++x)
for (int y = Y_BOUND_1; y <= Y_BOUND_2; ++y)
@@ -482,7 +482,7 @@ bool magic_mapping(int map_radius, int proportion, bool suppress_msg,
const FixedArray<uint8_t, GXM, GYM>& difficulty =
_tile_difficulties(!deterministic);
- std::auto_ptr<FixedArray<bool, GXM, GYM> > detectable;
+ auto_ptr<FixedArray<bool, GXM, GYM> > detectable;
if (!deterministic)
detectable = _tile_detectability();
@@ -494,7 +494,7 @@ bool magic_mapping(int map_radius, int proportion, bool suppress_msg,
{
int threshold = proportion;
- const int dist = distance(you.pos(), *ri);
+ const int dist = distance2(you.pos(), *ri);
if (dist > very_far)
threshold = threshold / 3;
@@ -576,7 +576,7 @@ bool magic_mapping(int map_radius, int proportion, bool suppress_msg,
else
canned_msg(MSG_DISORIENTED);
- std::vector<std::string> sensed;
+ vector<string> sensed;
if (num_altars > 0)
{
@@ -653,13 +653,13 @@ bool mon_enemies_around(const monster* mons)
// Returns a string containing a representation of the map. Leading and
// trailing spaces are trimmed from each line. Leading and trailing empty
// lines are also snipped.
-std::string screenshot()
+string screenshot()
{
- std::vector<std::string> lines(crawl_view.viewsz.y);
+ vector<string> lines(crawl_view.viewsz.y);
unsigned int lsp = GXM;
for (int y = 0; y < crawl_view.viewsz.y; y++)
{
- std::string line;
+ string line;
for (int x = 0; x < crawl_view.viewsz.x; x++)
{
// in grid coords
@@ -693,7 +693,7 @@ std::string screenshot()
while (!lines.empty() && lines.back().empty())
lines.pop_back(); // then from the bottom
- std::ostringstream ss;
+ ostringstream ss;
unsigned int y = 0;
for (y = 0; y < lines.size() && lines[y].empty(); y++)
; // ... and from the top
@@ -912,7 +912,7 @@ static int player_view_update_at(const coord_def &gc)
static void player_view_update()
{
- std::vector<coord_def> update_excludes;
+ vector<coord_def> update_excludes;
bool need_update = false;
for (radius_iterator ri(you.get_los()); ri; ++ri)
{