summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/shopping.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2009-12-17 12:48:02 +0100
committerAdam Borowski <kilobyte@angband.pl>2009-12-17 12:48:02 +0100
commit1ab177757bec9eb28482785f75fd8a4fb8a1313c (patch)
tree4b1c8babcca442dc8b91a624b842bc5f30013747 /crawl-ref/source/shopping.cc
parentc266f14414471d5252130c70bafa0c60f85a265c (diff)
downloadcrawl-ref-1ab177757bec9eb28482785f75fd8a4fb8a1313c.tar.gz
crawl-ref-1ab177757bec9eb28482785f75fd8a4fb8a1313c.zip
Replace static snprintf() with make_sprintf() where the result is immediately cast
to std::string.
Diffstat (limited to 'crawl-ref/source/shopping.cc')
-rw-r--r--crawl-ref/source/shopping.cc15
1 files changed, 5 insertions, 10 deletions
diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc
index d117dc9238..1aac684a98 100644
--- a/crawl-ref/source/shopping.cc
+++ b/crawl-ref/source/shopping.cc
@@ -124,7 +124,6 @@ static void _list_shop_keys(const std::string &purchasable, bool viewing,
{
ASSERT(total_stock > 0);
- char buf[200];
const int numlines = get_number_of_lines();
cgotoxy(1, numlines - 1, GOTO_CRT);
@@ -159,7 +158,7 @@ static void _list_shop_keys(const std::string &purchasable, bool viewing,
pkeys = "[" + pkeys + "] Select Item to "
+ (viewing ? "Examine" : "Buy");
}
- snprintf(buf, sizeof buf,
+ formatted_string fs = formatted_string::parse_string(make_stringf(
"[<w>x</w>/<w>Esc</w>"
#ifdef USE_TILE
"/<w>R-Click</w>"
@@ -167,9 +166,8 @@ static void _list_shop_keys(const std::string &purchasable, bool viewing,
"] exit [<w>!</w>] %s %s%s",
(viewing ? "to select items " : "to examine items"),
pkeys.c_str(),
- shop_list.c_str());
+ shop_list.c_str()));
- formatted_string fs = formatted_string::parse_string(buf);
fs.cprintf("%*s", get_number_of_cols() - fs.length() - 1, "");
fs.display();
cgotoxy(1, numlines, GOTO_CRT);
@@ -2526,12 +2524,9 @@ void ShoppingListMenu::draw_title()
const char *verb = menu_action == ACT_EXECUTE ? "travel" :
menu_action == ACT_EXAMINE ? "examine" :
"delete";
- char buf[200];
- snprintf(buf, 200,
- "<lightgrey> [<w>a-z</w>: %s <w>?</w>/<w>!</w>: change action]",
- verb);
-
- draw_title_suffix(formatted_string::parse_string(buf), false);
+ draw_title_suffix(formatted_string::parse_string(make_stringf(
+ "<lightgrey> [<w>a-z</w>: %s <w>?</w>/<w>!</w>: change action]",
+ verb)), false);
}
}