diff options
author | Raphael Langella <raphael.langella@gmail.com> | 2012-08-26 22:50:06 +0200 |
---|---|---|
committer | Raphael Langella <raphael.langella@gmail.com> | 2012-08-26 23:06:30 +0200 |
commit | 770bcbd1844b97b671d0e47ea8313cdf2c74c5ea (patch) | |
tree | e030cf61afce9ca69b74bb38eb73734bf10f633e /crawl-ref/source/l_item.cc | |
parent | a6c16c7f2066c854a01f25e9e6c3d8e44282a638 (diff) | |
download | crawl-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_item.cc')
-rw-r--r-- | crawl-ref/source/l_item.cc | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/crawl-ref/source/l_item.cc b/crawl-ref/source/l_item.cc index aa0775ffc3..ec53132742 100644 --- a/crawl-ref/source/l_item.cc +++ b/crawl-ref/source/l_item.cc @@ -255,7 +255,7 @@ static int l_item_do_class(lua_State *ls) if (lua_isboolean(ls, 1)) terse = lua_toboolean(ls, 1); - std::string s = item_class_name(item->base_type, terse); + string s = item_class_name(item->base_type, terse); lua_pushstring(ls, s.c_str()); } else @@ -392,7 +392,7 @@ IDEF(worn) return 2; } -static std::string _item_name(lua_State *ls, item_def* item) +static string _item_name(lua_State *ls, item_def* item) { description_level_type ndesc = DESC_PLAIN; if (lua_isstring(ls, 1)) @@ -422,11 +422,11 @@ static int l_item_do_name_coloured(lua_State *ls) if (item) { - std::string name = _item_name(ls, item); - int col = menu_colour(name, menu_colour_item_prefix(*item)); - std::string colstr = colour_to_str(col); + string name = _item_name(ls, item); + int col = menu_colour(name, menu_colour_item_prefix(*item)); + string colstr = colour_to_str(col); - std::ostringstream out; + ostringstream out; out << "<" << colstr << ">" << name << "</" << colstr << ">"; @@ -712,17 +712,17 @@ static int l_item_do_inc_quantity(lua_State *ls) IDEFN(inc_quantity, do_inc_quantity) -static iflags_t _str_to_item_status_flags(std::string flag) +static iflags_t _str_to_item_status_flags(string flag) { iflags_t flags = 0; - if (flag.find("curse") != std::string::npos) + if (flag.find("curse") != string::npos) flags &= ISFLAG_KNOW_CURSE; // type is dealt with using item_type_known. - //if (flag.find("type") != std::string::npos) + //if (flag.find("type") != string::npos) // flags &= ISFLAG_KNOW_TYPE; - if (flag.find("pluses") != std::string::npos) + if (flag.find("pluses") != string::npos) flags &= ISFLAG_KNOW_PLUSES; - if (flag.find("properties") != std::string::npos) + if (flag.find("properties") != string::npos) flags &= ISFLAG_KNOW_PROPERTIES; if (flag == "any") flags = ISFLAG_IDENT_MASK; @@ -745,7 +745,7 @@ static int l_item_do_identified(lua_State *ls) bool known_status = false; if (lua_isstring(ls, 1)) { - std::string flags = luaL_checkstring(ls, 1); + string flags = luaL_checkstring(ls, 1); if (trimmed_string(flags).empty()) known_status = item_ident(*item, ISFLAG_IDENT_MASK); else @@ -1012,9 +1012,9 @@ static int l_item_get_items_at(lua_State *ls) lua_newtable(ls); - const std::vector<item_def> items = item_list_in_stash(p); + const vector<item_def> items = item_list_in_stash(p); int index = 0; - for (std::vector<item_def>::const_iterator i = items.begin(); + for (vector<item_def>::const_iterator i = items.begin(); i != items.end(); ++i) { _clua_push_item_temp(ls, *i); |