diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-05-20 11:47:37 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-05-20 11:47:37 +0000 |
commit | 6052fa93471180670f18d1abad16b2a12cdcf1dc (patch) | |
tree | c6eab06e95c6c8d643990cb4e660b5fccd08c9cd /crawl-ref/source/shopping.cc | |
parent | b926fb5cd10ca674313c3b8aa2bf99d6233db143 (diff) | |
download | crawl-ref-6052fa93471180670f18d1abad16b2a12cdcf1dc.tar.gz crawl-ref-6052fa93471180670f18d1abad16b2a12cdcf1dc.zip |
Finally fix 1868761: Books in shops being noted as identified over and
over again (when searching stashes).
Also remove my recently added NOTE_FOUND_ORB_OR_RUNES in favour of the
previously existing NOTE_GET_ITEM. Also I've noticed that this is
probably already listed in the "milestones" - but what on earth are they?
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5150 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/shopping.cc')
-rw-r--r-- | crawl-ref/source/shopping.cc | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc index 631cace5ca..fb9c1975c6 100644 --- a/crawl-ref/source/shopping.cc +++ b/crawl-ref/source/shopping.cc @@ -154,12 +154,13 @@ static int _shop_get_item_value(const item_def& item, int greed, bool id) static std::string _shop_print_stock( const std::vector<int>& stock, const shop_struct& shop ) { - ShopInfo &si = StashTrack.get_shop(shop.x, shop.y); + ShopInfo &si = StashTrack.get_shop(shop.x, shop.y); const bool id = shoptype_identifies_stock(shop.type); std::string purchasable; for (unsigned int i = 0; i < stock.size(); ++i) { - const int gp_value = _shop_get_item_value(mitm[stock[i]], shop.greed, id); + const int gp_value = _shop_get_item_value(mitm[stock[i]], shop.greed, + id); const bool can_afford = (you.gold >= gp_value); cgotoxy(1, i+1, GOTO_CRT); @@ -200,7 +201,7 @@ static void _in_a_shop( int shopidx ) std::vector<int> stock = _shop_get_stock(shopidx); clrscr(); - if ( stock.empty() ) + if (stock.empty()) { _shop_print("I'm sorry, my shop is empty now.", 1); _shop_more(); @@ -248,7 +249,7 @@ static void _in_a_shop( int shopidx ) bool is_ok = true; ft = get_ch(); - if ( !isalpha(ft) ) + if (!isalpha(ft)) { is_ok = false; } @@ -259,7 +260,7 @@ static void _in_a_shop( int shopidx ) is_ok = false; } - if ( !is_ok ) + if (!is_ok) { _shop_print("Huh?", 1); _shop_more(); @@ -275,16 +276,18 @@ static void _in_a_shop( int shopidx ) // noted when you buy it. item_def& item = mitm[stock[ft]]; const unsigned long old_flags = item.flags; - if ( id_stock ) + if (id_stock) + { item.flags |= (ISFLAG_IDENT_MASK | ISFLAG_NOTED_ID | ISFLAG_NOTED_GET); + } describe_item(item); - if ( id_stock ) + if (id_stock) item.flags = old_flags; } else if (ft == '?' || ft == '*') invent(-1, false); - else if ( !isalpha(ft) ) + else if (!isalpha(ft)) { _shop_print("Huh?", 1); _shop_more(); @@ -323,10 +326,9 @@ static void _in_a_shop( int shopidx ) bool shoptype_identifies_stock(shop_type type) { - return - type != SHOP_WEAPON_ANTIQUE && - type != SHOP_ARMOUR_ANTIQUE && - type != SHOP_GENERAL_ANTIQUE; + return (type != SHOP_WEAPON_ANTIQUE + && type != SHOP_ARMOUR_ANTIQUE + && type != SHOP_GENERAL_ANTIQUE); } static void _purchase( int shop, int item_got, int cost, bool id ) @@ -353,15 +355,16 @@ static void _purchase( int shop, int item_got, int cost, bool id ) if (num < quant) { snprintf( info, INFO_SIZE, "I'll put %s outside for you.", - (quant == 1) ? "it" : - (num > 0) ? "the rest" : "these" ); + (quant == 1) ? "it" : + (num > 0) ? "the rest" + : "these" ); _shop_print(info, 1); _shop_more(); move_item_to_grid( &item_got, env.shop[shop].x, env.shop[shop].y ); } -} // end purchase() +} // This probably still needs some work. Rings used to be the only // artefacts which had a change in price, and that value corresponds |