summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/items.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-17 05:43:59 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-17 05:43:59 +0000
commitb134ff6ce032256b6ac491e144b811ae6651e668 (patch)
treec332796b3b9b32aeb3c520ff239f1f636bbcff0c /crawl-ref/source/items.cc
parent429ed8cf12825bfb9ceb80229df3f410c24c5186 (diff)
downloadcrawl-ref-b134ff6ce032256b6ac491e144b811ae6651e668.tar.gz
crawl-ref-b134ff6ce032256b6ac491e144b811ae6651e668.zip
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
Diffstat (limited to 'crawl-ref/source/items.cc')
-rw-r--r--crawl-ref/source/items.cc37
1 files changed, 18 insertions, 19 deletions
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<SelItem> 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