From cdd74d0b4618ad1f8f02ee18036283c6c2214b3d Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sun, 7 Dec 2008 23:44:02 +0000 Subject: Actually replace sold out shops with the new feature DNGN_ABANDONED_SHOP. This makes comparisons much easier and also avoids giving away information about far away shops being opened/closed. (This was only an issue if a shop only held blood potions that rotted away, but still.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7775 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/shopping.cc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'crawl-ref/source/shopping.cc') diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc index 025b9ef4d8..0f211aa221 100644 --- a/crawl-ref/source/shopping.cc +++ b/crawl-ref/source/shopping.cc @@ -1668,14 +1668,11 @@ unsigned int item_value( item_def item, bool ident ) return (valued); } // end item_value() -// Returns true if a shop is out of stock. -bool shop_is_closed(const coord_def &where) +static void _delete_shop(int i) { - for (int i = 0; i < MAX_SHOPS; i++) - if (env.shop[i].pos == where) - return _shop_get_stock(i).empty(); - - return (false); + grd(you.pos()) = DNGN_ABANDONED_SHOP; +// env.shop.erase(i); + unnotice_feature(level_pos(level_id::current(), you.pos())); } void shop() @@ -1697,20 +1694,22 @@ void shop() { const shop_struct& shop = env.shop[i]; mprf("%s appears to be closed.", shop_name(shop.pos).c_str()); + _delete_shop(i); return; } const bool bought_something = _in_a_shop(i); + const std::string shopname = shop_name(env.shop[i].pos); // If the shop is now empty, erase it from the overmap. if ( _shop_get_stock(i).empty() ) - unnotice_feature(level_pos(level_id::current(), you.pos())); + _delete_shop(i); burden_change(); redraw_screen(); if (bought_something) - mprf("Thank you for shopping at %s!", shop_name(env.shop[i].pos).c_str()); + mprf("Thank you for shopping at %s!", shopname.c_str()); } shop_struct *get_shop(const coord_def& where) -- cgit v1.2.3-54-g00ecf