From c27083cc4fd8a776f61e2863f07eefa56b183ac5 Mon Sep 17 00:00:00 2001 From: haranp Date: Sun, 15 Jun 2008 19:34:20 +0000 Subject: 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 --- crawl-ref/source/items.cc | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'crawl-ref') 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(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(si.item)->quantity = item_quant; + + if ( warning_ok ) + items_for_multidrop.push_back(si); + } if ( items_for_multidrop.empty() ) // only one item { -- cgit v1.2.3-54-g00ecf