summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/shopping.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-22 20:43:21 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-22 20:43:21 +0000
commit18c9b72d36397231a8fb81a3d9cb999f0e60a5f9 (patch)
treec2cb950ff03a2fa3aeb6b89b1d0ef1f7b746a5c6 /crawl-ref/source/shopping.cc
parent4b12be556b44d07ce75816c125960d5311e9e719 (diff)
downloadcrawl-ref-18c9b72d36397231a8fb81a3d9cb999f0e60a5f9.tar.gz
crawl-ref-18c9b72d36397231a8fb81a3d9cb999f0e60a5f9.zip
Remove message about which items you bought in a shop as that's
automatically noted now. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7539 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/shopping.cc')
-rw-r--r--crawl-ref/source/shopping.cc41
1 files changed, 13 insertions, 28 deletions
diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc
index be23d980cd..7df3d83fef 100644
--- a/crawl-ref/source/shopping.cc
+++ b/crawl-ref/source/shopping.cc
@@ -38,7 +38,6 @@
#include "stuff.h"
#include "view.h"
-static void _in_a_shop(int shopidx);
static bool _purchase( int shop, int item_got, int cost, bool id);
static void _shop_print( const char *shoppy, int line )
@@ -230,7 +229,7 @@ static std::string _shop_print_stock( const std::vector<int>& stock,
// For the ? key, the text should read:
// [?] switch to examination mode
// [?] switch to selection mode
-static void _in_a_shop( int shopidx )
+static bool _in_a_shop( int shopidx )
{
const shop_struct& shop = env.shop[shopidx];
@@ -244,6 +243,7 @@ static void _in_a_shop( int shopidx )
const bool id_stock = shoptype_identifies_stock(shop.type);
std::vector<bool> selected;
+ bool bought_something = false;
while (true)
{
StashTrack.get_shop(shop.pos).reset();
@@ -273,7 +273,7 @@ static void _in_a_shop( int shopidx )
{
_shop_print("I'm sorry, my shop is empty now.", 1);
_shop_more();
- return;
+ return (bought_something);
}
const std::string purchasable = _shop_print_stock(stock, selected, shop,
@@ -315,14 +315,12 @@ static void _in_a_shop( int shopidx )
if (first)
{
first = false;
- snprintf( info, INFO_SIZE, "%s What would you like to %s? ",
- hello.c_str(),
- purchasable.length() ? "purchase" : "do");
+ snprintf( info, INFO_SIZE, "%s What would you like to do? ",
+ hello.c_str() );
}
else
{
- snprintf( info, INFO_SIZE, "What would you like to %s? ",
- purchasable.length() ? "purchase" : "do");
+ snprintf( info, INFO_SIZE, "What would you like to do? ");
}
textcolor(CYAN);
@@ -355,14 +353,12 @@ static void _in_a_shop( int shopidx )
if ( yesno(NULL, true, 'n', false, false, true) )
{
- std::vector<std::string> purchases;
int num_items = 0, outside_items = 0, quant;
for (int i = selected.size() - 1; i >= 0; --i)
{
if (selected[i])
{
item_def& item = mitm[stock[i]];
- purchases.push_back(item.name(DESC_NOCAP_A));
const int gp_value = _shop_get_item_value(item,
shop.greed, id_stock);
@@ -390,22 +386,6 @@ static void _in_a_shop( int shopidx )
}
}
- // Hack to make sure the lines are empty for the mpr().
- for (int i = 0; i < 5; i++)
- _shop_print("\n", i);
-
- if (purchases.size() > 1)
- {
- // FIXME: If you buy several items of the same type
- // they are not merged in the listing.
- mprf("You bought %s for a total of %d gold piece%s.",
- comma_separated_line(purchases.begin(),
- purchases.end(),
- ", and ", ", ").c_str(),
- total_cost,
- total_cost > 1 ? "s" : "");
- }
-
if (outside_items)
{
mprf( "I'll put %s outside for you.",
@@ -413,6 +393,7 @@ static void _in_a_shop( int shopidx )
num_items == outside_items ? "them"
: "part of them" );
}
+ bought_something = true;
}
}
_shop_more();
@@ -488,6 +469,7 @@ static void _in_a_shop( int shopidx )
total_cost -= gp_value;
}
}
+ return (bought_something);
}
bool shoptype_identifies_stock(shop_type type)
@@ -1684,10 +1666,13 @@ void shop()
return;
}
- _in_a_shop(i);
+ const bool bought_something = _in_a_shop(i);
burden_change();
redraw_screen();
-} // end shop()
+
+ if (bought_something)
+ mprf("Thank you for shopping at %s!", shop_name(env.shop[i].pos).c_str());
+}
shop_struct *get_shop(const coord_def& where)
{