summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/items.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-15 19:34:20 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-15 19:34:20 +0000
commitc27083cc4fd8a776f61e2863f07eefa56b183ac5 (patch)
tree828ceb22ea4da6a42089ac0c6f9859b7c4ee6fd6 /crawl-ref/source/items.cc
parent0f86ce15938f85206bcdec48e65b6f21ff2c0259 (diff)
downloadcrawl-ref-c27083cc4fd8a776f61e2863f07eefa56b183ac5.tar.gz
crawl-ref-c27083cc4fd8a776f61e2863f07eefa56b183ac5.zip
Produce a proper prompt when dropping 15 of 25 arrows inscribed with !d.
This is an evil hack; we might be better off without it... Fixes 1853852. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5859 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/items.cc')
-rw-r--r--crawl-ref/source/items.cc23
1 files changed, 21 insertions, 2 deletions
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index a3ffa4a1cb..60a6e39bf8 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -2099,8 +2099,27 @@ void drop(void)
// over to items_for_multidrop
items_for_multidrop.clear();
for ( unsigned int i = 0; i < tmp_items.size(); ++i )
- if ( check_warning_inscriptions( *(tmp_items[i].item), OPER_DROP))
- items_for_multidrop.push_back(tmp_items[i]);
+ {
+ SelItem& si(tmp_items[i]);
+
+ const int item_quant = si.item->quantity;
+
+ // EVIL HACK: fix item quantity to match the quantity we will drop,
+ // in order to prevent misleading messages when dropping
+ // 15 of 25 arrows inscribed with {!d}.
+ if ( si.quantity && si.quantity != item_quant )
+ const_cast<item_def*>(si.item)->quantity = si.quantity;
+
+ // Check if we can add it to the multidrop list
+ bool warning_ok = check_warning_inscriptions(*(si.item), OPER_DROP);
+
+ // Restore the item quantity if we mangled it
+ if ( item_quant != si.item->quantity )
+ const_cast<item_def*>(si.item)->quantity = item_quant;
+
+ if ( warning_ok )
+ items_for_multidrop.push_back(si);
+ }
if ( items_for_multidrop.empty() ) // only one item
{