summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/stash.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/stash.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/stash.cc')
-rw-r--r--crawl-ref/source/stash.cc15
1 files changed, 3 insertions, 12 deletions
diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc
index cb3a461b61..147dbc67d8 100644
--- a/crawl-ref/source/stash.cc
+++ b/crawl-ref/source/stash.cc
@@ -887,21 +887,15 @@ void ShopInfo::add_item(const item_def &sitem, unsigned price)
std::string ShopInfo::shop_item_name(const shop_item &si) const
{
- char shopitem[ITEMNAME_SIZE * 2];
-
const unsigned long oldflags = si.item.flags;
if (shoptype_identifies_stock(static_cast<shop_type>(this->shoptype)))
const_cast<shop_item&>(si).item.flags |= ISFLAG_IDENT_MASK;
- const std::string itemname = Stash::stash_item_name(si.item);
- snprintf(shopitem, sizeof shopitem, "%s (%u gold)",
- itemname.c_str(), si.price);
-
if (oldflags != si.item.flags)
const_cast<shop_item&>(si).item.flags = oldflags;
- return shopitem;
+ return make_stringf("%s (%u gold)", Stash::stash_item_name(si.item).c_str(), si.price);
}
std::string ShopInfo::shop_item_desc(const shop_item &si) const
@@ -1871,12 +1865,9 @@ void StashSearchMenu::draw_title()
title->quantity > 1? "es" : "",
sort_style);
- char buf[200];
- snprintf(buf, 200,
+ draw_title_suffix(formatted_string::parse_string(make_stringf(
"<lightgrey> [<w>a-z</w>: %s <w>?</w>/<w>!</w>: change action <w>/</w>: change sort]",
- menu_action == ACT_EXECUTE ? "travel" : "examine");
-
- draw_title_suffix(formatted_string::parse_string(buf), false);
+ menu_action == ACT_EXECUTE ? "travel" : "examine")), false);
}
}