summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/startup.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/startup.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/startup.cc')
-rw-r--r--crawl-ref/source/startup.cc41
1 files changed, 20 insertions, 21 deletions
diff --git a/crawl-ref/source/startup.cc b/crawl-ref/source/startup.cc
index 41abed0226..06188704ab 100644
--- a/crawl-ref/source/startup.cc
+++ b/crawl-ref/source/startup.cc
@@ -252,7 +252,7 @@ static void _post_init(bool newc)
#ifdef CLUA_BINDINGS
clua.runhook("chk_startgame", "b", newc);
- std::string yname = you.your_name; // XXX: what's this for?
+ string yname = you.your_name; // XXX: what's this for?
read_init_file(true);
Options.fixup_options();
you.your_name = yname;
@@ -324,7 +324,7 @@ static void _construct_game_modes_menu(MenuScroller* menu)
#else
TextItem* tmp = NULL;
#endif
- std::string text;
+ string text;
#ifdef USE_TILE_LOCAL
tmp = new TextTileItem();
@@ -475,7 +475,7 @@ static void _construct_game_modes_menu(MenuScroller* menu)
}
static void _construct_save_games_menu(MenuScroller* menu,
- const std::vector<player_save_info>& chars)
+ const vector<player_save_info>& chars)
{
if (chars.empty())
{
@@ -483,9 +483,9 @@ static void _construct_save_games_menu(MenuScroller* menu,
return;
}
- std::string text;
+ string text;
- std::vector<player_save_info>::iterator it;
+ vector<player_save_info>::iterator it;
for (unsigned int i = 0; i < chars.size(); ++i)
{
#ifdef USE_TILE_LOCAL
@@ -508,9 +508,8 @@ static void _construct_save_games_menu(MenuScroller* menu,
}
}
-// Should probably use some std::find invocation instead.
-static int _find_save(const std::vector<player_save_info>& chars,
- const std::string& name)
+// Should probably use some find invocation instead.
+static int _find_save(const vector<player_save_info>& chars, const string& name)
{
for (int i = 0; i < static_cast<int>(chars.size()); ++i)
if (chars[i].name == name)
@@ -539,7 +538,7 @@ static void _show_startup_menu(newgame_def* ng_choice,
const newgame_def& defaults)
{
again:
- std::vector<player_save_info> chars = find_all_saved_characters();
+ vector<player_save_info> chars = find_all_saved_characters();
const int num_saves = chars.size();
const int num_modes = NUM_GAME_TYPE;
static int type = GAME_TYPE_UNSPECIFIED;
@@ -550,13 +549,13 @@ again:
const int max_col = get_number_of_cols();
#endif
const int max_line = get_number_of_lines();
- const int help_start = std::min(GAME_MODES_START_Y + num_to_lines(num_saves + num_modes) + 2,
- max_line - NUM_MISC_LINES + 1);
+ const int help_start = min(GAME_MODES_START_Y + num_to_lines(num_saves + num_modes) + 2,
+ max_line - NUM_MISC_LINES + 1);
const int help_end = help_start + NUM_HELP_LINES + 1;
const int game_mode_bottom = GAME_MODES_START_Y + num_to_lines(num_modes);
- const int game_save_top = help_start - 2 - num_to_lines(std::min(2, num_saves));
- const int save_games_start_y = std::min<int>(game_mode_bottom, game_save_top);
+ const int game_save_top = help_start - 2 - num_to_lines(min(2, num_saves));
+ const int save_games_start_y = min<int>(game_mode_bottom, game_save_top);
clrscr();
PrecisionMenu menu;
@@ -602,11 +601,11 @@ again:
}
tmp = new NoSelectTextItem();
- std::string text = "Use the up/down keys to select the type of game "
- "or load a character.\n"
- "You can type your name; if you leave it blank "
- "you will be asked later.\n"
- "Press Enter to start";
+ string text = "Use the up/down keys to select the type of game or load a "
+ "character.\n"
+ "You can type your name; if you leave it blank you will be "
+ "asked later.\n"
+ "Press Enter to start";
// TODO: this should include a description of that character.
if (_game_defined(defaults))
text += ", Tab to repeat the last game's choice";
@@ -647,7 +646,7 @@ again:
// Draw legal info etc
opening_screen();
- std::string input_string = defaults.name;
+ string input_string = defaults.name;
// If the game filled in a complete name, the user will
// usually want to enter a new name instead of adding
@@ -791,7 +790,7 @@ again:
}
}
// we had a significant action!
- std::vector<MenuItem*> selected = menu.get_selected_items();
+ vector<MenuItem*> selected = menu.get_selected_items();
if (selected.empty())
{
// Uninteresting action, poll a new key
@@ -880,7 +879,7 @@ static void _choose_arena_teams(newgame_def* choice,
bool startup_step()
{
- std::string name;
+ string name;
_initialize();