summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_you.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/l_you.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/l_you.cc')
-rw-r--r--crawl-ref/source/l_you.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/crawl-ref/source/l_you.cc b/crawl-ref/source/l_you.cc
index 110de0734c..b8396e101d 100644
--- a/crawl-ref/source/l_you.cc
+++ b/crawl-ref/source/l_you.cc
@@ -174,7 +174,7 @@ LUARET1(you_constricting, boolean, you.is_constricting())
static int l_you_genus(lua_State *ls)
{
bool plural = lua_toboolean(ls, 1);
- std::string genus = species_name(you.species, true);
+ string genus = species_name(you.species, true);
lowercase(genus);
if (plural)
genus = pluralise(genus);
@@ -229,7 +229,7 @@ static int l_you_abils(lua_State *ls)
{
lua_newtable(ls);
- std::vector<const char *>abils = get_ability_names();
+ vector<const char *>abils = get_ability_names();
for (int i = 0, size = abils.size(); i < size; ++i)
{
lua_pushstring(ls, abils[i]);
@@ -245,7 +245,7 @@ static int l_you_abil_letters(lua_State *ls)
char buf[2];
buf[1] = 0;
- std::vector<talent> talents = your_talents(false);
+ vector<talent> talents = your_talents(false);
for (int i = 0, size = talents.size(); i < size; ++i)
{
buf[0] = talents[i].hotkey;
@@ -276,7 +276,7 @@ LUAFN(you_caught)
LUAFN(you_mutation)
{
- std::string mutname = luaL_checkstring(ls, 1);
+ string mutname = luaL_checkstring(ls, 1);
for (int i = 0; i < NUM_MUTATIONS; ++i)
{
mutation_type mut = static_cast<mutation_type>(i);
@@ -288,19 +288,19 @@ LUAFN(you_mutation)
PLUARET(integer, you.mutation[mut]);
}
- std::string err = make_stringf("No such mutation: '%s'.", mutname.c_str());
+ string err = make_stringf("No such mutation: '%s'.", mutname.c_str());
return luaL_argerror(ls, 1, err.c_str());
}
LUAFN(you_is_level_on_stack)
{
- std::string levname = luaL_checkstring(ls, 1);
+ string levname = luaL_checkstring(ls, 1);
level_id lev;
try
{
lev = level_id::parse_level_id(levname);
}
- catch (const std::string &err)
+ catch (const string &err)
{
return luaL_argerror(ls, 1, err.c_str());
}
@@ -320,7 +320,7 @@ LUAFN(you_train_skill)
skill_type sk = str_to_skill(luaL_checkstring(ls, 1));
if (lua_gettop(ls) >= 2 && you.can_train[sk])
{
- you.train[sk] = std::min(std::max(luaL_checkint(ls, 2), 0), 2);
+ you.train[sk] = min(max(luaL_checkint(ls, 2), 0), 2);
reset_training();
}
@@ -519,7 +519,7 @@ static int _you_gold(lua_State *ls)
{
const int new_gold = luaL_checkint(ls, 1);
const int old_gold = you.gold;
- you.set_gold(std::max(new_gold, 0));
+ you.set_gold(max(new_gold, 0));
if (new_gold > old_gold)
you.attribute[ATTR_GOLD_FOUND] += new_gold - old_gold;
else if (old_gold > new_gold)
@@ -534,7 +534,7 @@ static int _you_piety(lua_State *ls)
{
if (lua_gettop(ls) >= 1)
{
- const int new_piety = std::min(std::max(luaL_checkint(ls, 1), 0), MAX_PIETY);
+ const int new_piety = min(max(luaL_checkint(ls, 1), 0), MAX_PIETY);
while (new_piety > you.piety)
gain_piety(new_piety - you.piety, 1, true, false);
lose_piety(you.piety - new_piety);
@@ -556,7 +556,7 @@ LUAFN(you_in_branch)
{
if (br != NUM_BRANCHES)
{
- std::string err = make_stringf(
+ string err = make_stringf(
"'%s' matches both branch '%s' and '%s'",
name, branches[br].abbrevname,
branches[i].abbrevname);
@@ -568,7 +568,7 @@ LUAFN(you_in_branch)
if (br == NUM_BRANCHES)
{
- std::string err = make_stringf("'%s' matches no branches.", name);
+ string err = make_stringf("'%s' matches no branches.", name);
return luaL_argerror(ls, 1, err.c_str());
}
@@ -624,7 +624,7 @@ LUAWRAP(you_gain_exp, gain_exp(luaL_checkint(ls, 1)))
*/
LUAFN(you_init)
{
- const std::string combo = luaL_checkstring(ls, 1);
+ const string combo = luaL_checkstring(ls, 1);
newgame_def ng;
ng.type = GAME_TYPE_NORMAL;
ng.species = get_species_by_abbrev(combo.substr(0, 2).c_str());