summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/items.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/items.cc')
-rw-r--r--crawl-ref/source/items.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index a37e4a812a..abed66ac49 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -2973,6 +2973,29 @@ static void autopickup(void)
if (!(mitm[o].flags & ISFLAG_THROWN))
unthrown++;
+ int num_to_take = mitm[o].quantity;
+ if ( Options.autopickup_no_burden && item_mass(mitm[o]) != 0)
+ {
+ int num_can_take =
+ (carrying_capacity(you.burden_state) - you.burden) /
+ item_mass(mitm[o]);
+
+ if ( num_can_take < num_to_take )
+ {
+ if (!tried_pickup)
+ mpr("You can't pick everything up without burdening "
+ "yourself.");
+ tried_pickup = true;
+ num_to_take = num_can_take;
+ }
+
+ if ( num_can_take == 0 )
+ {
+ o = next;
+ continue;
+ }
+ }
+
mitm[o].flags &= ~(ISFLAG_THROWN | ISFLAG_DROPPED);
result = move_item_to_player( o, mitm[o].quantity);