summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tilereg-inv.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/tilereg-inv.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/tilereg-inv.cc')
-rw-r--r--crawl-ref/source/tilereg-inv.cc26
1 files changed, 12 insertions, 14 deletions
diff --git a/crawl-ref/source/tilereg-inv.cc b/crawl-ref/source/tilereg-inv.cc
index 1d8f7f3bf7..b9c418947c 100644
--- a/crawl-ref/source/tilereg-inv.cc
+++ b/crawl-ref/source/tilereg-inv.cc
@@ -227,9 +227,8 @@ static bool _can_use_item(const item_def &item, bool equipped)
return true;
}
-static void _handle_wield_tip(std::string &tip, std::vector<command_type> &cmd,
- const std::string prefix = "",
- bool unwield = false)
+static void _handle_wield_tip(string &tip, vector<command_type> &cmd,
+ const string prefix = "", bool unwield = false)
{
tip += prefix;
if (unwield)
@@ -239,7 +238,7 @@ static void _handle_wield_tip(std::string &tip, std::vector<command_type> &cmd,
cmd.push_back(CMD_WIELD_WEAPON);
}
-bool InventoryRegion::update_tab_tip_text(std::string &tip, bool active)
+bool InventoryRegion::update_tab_tip_text(string &tip, bool active)
{
const char *prefix1 = active ? "" : "[L-Click] ";
const char *prefix2 = active ? "" : " ";
@@ -251,7 +250,7 @@ bool InventoryRegion::update_tab_tip_text(std::string &tip, bool active)
return true;
}
-bool InventoryRegion::update_tip_text(std::string& tip)
+bool InventoryRegion::update_tip_text(string& tip)
{
if (m_cursor == NO_CURSOR)
return false;
@@ -268,7 +267,7 @@ bool InventoryRegion::update_tip_text(std::string& tip)
&& mouse_control::current_mode() == MOUSE_MODE_COMMAND);
// TODO enne - should the command keys here respect keymaps?
- std::vector<command_type> cmd;
+ vector<command_type> cmd;
if (m_items[item_idx].flag & TILEI_FLAG_FLOOR)
{
const item_def &item = mitm[idx];
@@ -340,8 +339,8 @@ bool InventoryRegion::update_tip_text(std::string& tip)
if (_can_use_item(item, equipped))
{
- std::string tip_prefix = "\n[L-Click] ";
- std::string tmp = "";
+ string tip_prefix = "\n[L-Click] ";
+ string tmp = "";
if (equipped)
{
if (wielded && !item_is_evokable(item))
@@ -530,7 +529,7 @@ bool InventoryRegion::update_tip_text(std::string& tip)
return true;
}
-bool InventoryRegion::update_alt_text(std::string &alt)
+bool InventoryRegion::update_alt_text(string &alt)
{
if (m_cursor == NO_CURSOR)
return false;
@@ -653,9 +652,9 @@ void InventoryRegion::update()
num_ground++;
// If the inventory is full, show at least one row of the ground.
- int min_ground = std::min(num_ground, mx);
- max_pack_items = std::min(max_pack_items, mx * my - min_ground);
- max_pack_items = std::min(ENDOFPACK, max_pack_items);
+ int min_ground = min(num_ground, mx);
+ max_pack_items = min(max_pack_items, mx * my - min_ground);
+ max_pack_items = min(ENDOFPACK, max_pack_items);
ucs_t c;
const char *tp = Options.tile_show_items.c_str();
@@ -737,8 +736,7 @@ void InventoryRegion::update()
}
// Add extra rows, if needed.
- unsigned int ground_rows =
- std::max((num_ground-1) / mx + 1, 1);
+ unsigned int ground_rows = max((num_ground-1) / mx + 1, 1);
while ((int)(m_items.size() / mx + ground_rows) < my
&& ((int)m_items.size()) < max_pack_items)