diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-25 22:13:03 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-25 22:13:03 +0000 |
commit | 1069ff1d4ca0ce6c09a9290a3b5af728901dc661 (patch) | |
tree | 462555ee48395cf4be705facdb00d683d8c18fb7 /crawl-ref | |
parent | 537d8cfed4159774f91ad8aa3b4d0f221b6f767d (diff) | |
download | crawl-ref-1069ff1d4ca0ce6c09a9290a3b5af728901dc661.tar.gz crawl-ref-1069ff1d4ca0ce6c09a9290a3b5af728901dc661.zip |
Implement [2383585]: picking up part of a stack (e.g. 3 of 6 bread
rations) marks the rest of the stack as dropped, so that greedy
autoexplore and autopickup won't try to take it.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8751 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/items.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 07377e47b6..767e1eebba 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -821,6 +821,7 @@ static void _pickup_menu(int item_link) item_link = mitm[j].link; int num_to_take = selected[i].quantity; + const bool take_all = (num_to_take == mitm[j].quantity); unsigned long oldflags = mitm[j].flags; mitm[j].flags &= ~(ISFLAG_THROWN | ISFLAG_DROPPED); int result = move_item_to_player( j, num_to_take ); @@ -840,7 +841,14 @@ static void _pickup_menu(int item_link) mitm[j].flags = oldflags; } else + { n_did_pickup++; + // If we deliberately chose to take only part of a + // pile, we consider the rest to have been + // "dropped." + if (!take_all && is_valid_item(mitm[j])) + mitm[j].flags |= ISFLAG_DROPPED; + } } } |