summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/items.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-11-23 16:10:21 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-11-23 16:10:21 +0000
commitaef49cb2fba2d6707c1d2d591ffbe3f35cd6e939 (patch)
tree8a033ef4e7a4d4699b25381a0090c8feb75fea63 /crawl-ref/source/items.cc
parent0972c8f8f69fd5e355f6f3ca32838851cf5ef893 (diff)
downloadcrawl-ref-aef49cb2fba2d6707c1d2d591ffbe3f35cd6e939.tar.gz
crawl-ref-aef49cb2fba2d6707c1d2d591ffbe3f35cd6e939.zip
Implemented 1601227, pickup_mode.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@484 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/items.cc')
-rw-r--r--crawl-ref/source/items.cc23
1 files changed, 15 insertions, 8 deletions
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 678c94fa82..d0d9310494 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -697,13 +697,15 @@ static bool invisible_to_player( const item_def& item ) {
return strstr(item.inscription.c_str(), "=k") != 0;
}
-static bool has_nonsquelched_items( int obj ) {
- while ( obj != NON_ITEM ) {
+static int count_nonsquelched_items( int obj ) {
+ int result = 0;
+ while ( obj != NON_ITEM )
+ {
if ( !invisible_to_player(mitm[obj]) )
- return true;
+ ++result;
obj = mitm[obj].link;
}
- return false;
+ return result;
}
/* Fill items with the items on a square.
@@ -716,7 +718,7 @@ static void item_list_on_square( std::vector<const item_def*>& items,
int obj, bool force_squelch ) {
const bool have_nonsquelched = (force_squelch ||
- has_nonsquelched_items(obj));
+ count_nonsquelched_items(obj));
/* loop through the items */
while ( obj != NON_ITEM ) {
@@ -1204,6 +1206,7 @@ void pickup()
}
int o = igrd[you.x_pos][you.y_pos];
+ const int num_nonsquelched = count_nonsquelched_items(o);
if (o == NON_ITEM)
{
@@ -1214,18 +1217,22 @@ void pickup()
// deliberately allowing the player to pick up
// a killed item here
pickup_single_item(o, mitm[o].quantity);
- } // end of if items_here
+ }
+ else if (Options.pickup_mode != -1 &&
+ num_nonsquelched >= Options.pickup_mode)
+ {
+ pickup_menu(o);
+ }
else
{
int next;
mpr("There are several objects here.");
- const bool hide_squelched = has_nonsquelched_items(o);
while ( o != NON_ITEM )
{
// must save this because pickup can destroy the item
next = mitm[o].link;
- if ( hide_squelched && invisible_to_player(mitm[o]) ) {
+ if ( num_nonsquelched && invisible_to_player(mitm[o]) ) {
o = next;
continue;
}