diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-12-07 23:44:02 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-12-07 23:44:02 +0000 |
commit | cdd74d0b4618ad1f8f02ee18036283c6c2214b3d (patch) | |
tree | 10aad41074679ccdf7d78a953171482e81bc53a8 /crawl-ref/source/shopping.cc | |
parent | f4d7abfdc292ea48cc3fcd1a8c98e0f22abd28f6 (diff) | |
download | crawl-ref-cdd74d0b4618ad1f8f02ee18036283c6c2214b3d.tar.gz crawl-ref-cdd74d0b4618ad1f8f02ee18036283c6c2214b3d.zip |
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
Diffstat (limited to 'crawl-ref/source/shopping.cc')
-rw-r--r-- | crawl-ref/source/shopping.cc | 17 |
1 files changed, 8 insertions, 9 deletions
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) |