From b134ff6ce032256b6ac491e144b811ae6651e668 Mon Sep 17 00:00:00 2001 From: zelgadis Date: Mon, 17 Sep 2007 05:43:59 +0000 Subject: If an item selected for multi-drop is inscribed with "!d" or "!*", and the user answers "no" when asked if they're sure about it, that item is removed from the list of items to drop, rather than cancelling the entire multi-drop. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2125 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/items.cc | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'crawl-ref/source/items.cc') diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index ec95804282..bad4a28d7a 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -1832,16 +1832,13 @@ void drop(void) return; } - items_for_multidrop = prompt_invent_items( "Drop what?", - MT_DROP, - -1, - drop_menu_title, - true, true, 0, - &Options.drop_filter, - drop_selitem_text, - &items_for_multidrop ); + std::vector tmp_items; + tmp_items = prompt_invent_items( "Drop what?", MT_DROP, -1, + drop_menu_title, true, true, 0, + &Options.drop_filter, drop_selitem_text, + &items_for_multidrop ); - if (items_for_multidrop.empty()) + if (tmp_items.empty()) { canned_msg( MSG_OK ); return; @@ -1851,18 +1848,20 @@ void drop(void) // dropping a worn robe before a cloak (old behaviour: remove // cloak, remove robe, wear cloak, drop robe, remove cloak, drop // cloak). - std::sort( items_for_multidrop.begin(), items_for_multidrop.end(), - drop_item_order ); + std::sort( tmp_items.begin(), tmp_items.end(), drop_item_order ); - for ( unsigned int i = 0; i < items_for_multidrop.size(); ++i ) + // If the user answers "no" to an item an with a warning inscription, + // then remove it from the list of items to drop by not copying it + // 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]); + + if ( items_for_multidrop.empty() ) // only one item { - if ( !check_warning_inscriptions( *(items_for_multidrop[i].item), - OPER_DROP)) - { - canned_msg( MSG_OK ); - items_for_multidrop.clear(); - return; - } + canned_msg( MSG_OK ); + return; } if ( items_for_multidrop.size() == 1 ) // only one item -- cgit v1.2.3-54-g00ecf