summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-22 13:42:49 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-22 13:42:49 +0000
commitb794d555277836316ec842421c5287ff50641ff9 (patch)
tree71af9d043989c3a41d1619da84077eb35bc74b5d /crawl-ref/source
parentdfebce7241da1ef5b2506cb175b9abf5eb32e533 (diff)
downloadcrawl-ref-b794d555277836316ec842421c5287ff50641ff9.tar.gz
crawl-ref-b794d555277836316ec842421c5287ff50641ff9.zip
Added option 'autopickup_no_burden' which, if set, will prevent autopickup
from picking up items beyond the burden limit. (Partial pickup will take place if you can take some of the items for a stack, e.g., 3 of the 5 potions of healing.) Defaults to false. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@692 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/chardump.cc2
-rw-r--r--crawl-ref/source/clua.cc1
-rw-r--r--crawl-ref/source/externs.h3
-rw-r--r--crawl-ref/source/initfile.cc5
-rw-r--r--crawl-ref/source/items.cc20
-rw-r--r--crawl-ref/source/mutation.cc2
-rw-r--r--crawl-ref/source/player.cc19
-rw-r--r--crawl-ref/source/player.h2
8 files changed, 41 insertions, 13 deletions
diff --git a/crawl-ref/source/chardump.cc b/crawl-ref/source/chardump.cc
index 98744a962c..1c5d0f7167 100644
--- a/crawl-ref/source/chardump.cc
+++ b/crawl-ref/source/chardump.cc
@@ -179,6 +179,8 @@ static void sdump_burden(const std::string &, std::string &text)
case BS_ENCUMBERED:
text += "You are encumbered.\n";
break;
+ default:
+ break;
}
}
diff --git a/crawl-ref/source/clua.cc b/crawl-ref/source/clua.cc
index 18d0a92af2..20005febc9 100644
--- a/crawl-ref/source/clua.cc
+++ b/crawl-ref/source/clua.cc
@@ -1885,6 +1885,7 @@ static option_handler handlers[] =
{ "increasing_skill_progress", &Options.increasing_skill_progress, option_hboolean },
{ "confirm_self_target", &Options.confirm_self_target, option_hboolean },
{ "safe_autopickup", &Options.safe_autopickup, option_hboolean },
+ { "autopickup_no_burden", &Options.autopickup_no_burden, option_hboolean },
{ "note_skill_max", &Options.note_skill_max, option_hboolean },
{ "use_notes", &Options.use_notes, option_hboolean },
{ "delay_message_clear", &Options.delay_message_clear, option_hboolean },
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 6447ad5fec..26a0cd736c 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -461,7 +461,7 @@ struct player
FixedVector< item_def, ENDOFPACK > inv;
int burden;
- char burden_state;
+ burden_state_type burden_state;
FixedVector<unsigned char, 25> spells;
char spell_no;
unsigned char char_direction; //
@@ -810,6 +810,7 @@ public:
bool increasing_skill_progress; // skills go from 0-10 or 10-0
bool confirm_self_target; // require confirmation before selftarget
bool safe_autopickup; // don't autopickup when monsters visible
+ bool autopickup_no_burden; // don't autopickup if it changes burden
bool note_skill_max; // take note when skills reach new max
bool note_all_spells; // take note when learning any spell
bool use_notes; // take (and dump) notes
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 6705e3a084..9e761cbb7c 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -573,6 +573,7 @@ void game_options::reset_options()
hp_warning = 10;
confirm_self_target = true;
safe_autopickup = true;
+ autopickup_no_burden = false;
use_notes = true;
note_skill_max = false;
note_all_spells = false;
@@ -1688,6 +1689,10 @@ void game_options::read_option_line(const std::string &str, bool runscript)
{
safe_autopickup = read_bool( field, safe_autopickup );
}
+ else if (key == "autopickup_no_burden")
+ {
+ autopickup_no_burden = read_bool( field, autopickup_no_burden );
+ }
else if (key == "use_notes")
{
use_notes = read_bool( field, use_notes );
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 24df6761d9..1832f36a90 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -2962,12 +2962,30 @@ static void autopickup(void)
if (item_needs_autopickup(mitm[o]))
{
+
+ int num_to_take = mitm[o].quantity;
+ if ( Options.autopickup_no_burden )
+ {
+ int num_can_take =
+ (carrying_capacity(you.burden_state) - you.burden) /
+ item_mass(mitm[o]);
+
+ if ( num_can_take == 0 )
+ {
+ o = next;
+ continue;
+ }
+
+ if ( num_can_take < num_to_take )
+ num_to_take = num_can_take;
+ }
+
if (!(mitm[o].flags & ISFLAG_THROWN))
unthrown++;
mitm[o].flags &= ~(ISFLAG_THROWN | ISFLAG_DROPPED);
- result = move_item_to_player( o, mitm[o].quantity);
+ result = move_item_to_player(o, num_to_take);
if (result == 0)
{
diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc
index 03174b9b99..19358af48f 100644
--- a/crawl-ref/source/mutation.cc
+++ b/crawl-ref/source/mutation.cc
@@ -1160,7 +1160,7 @@ bool mutate(int which_mutation, bool failMsg)
}
// Undead bodies don't mutate, they fall apart. -- bwr
- // except for demonspawn in lichform -- haranp
+ // except for demonspawn (or other permamutations) in lichform -- haranp
if (you.is_undead && !demonspawn)
{
if ((!wearing_amulet(AMU_RESIST_MUTATION) && coinflip())
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index e48b343516..84f08d09bb 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -2007,10 +2007,15 @@ unsigned char player_sust_abil(bool calc_unid)
return sa;
} // end player_sust_abil()
-int carrying_capacity(void)
+int carrying_capacity( burden_state_type bs )
{
- // Originally: 1000 + you.strength * 200 + ( you.levitation ? 1000 : 0 )
- return (3500 + (you.strength * 100) + (player_is_levitating() ? 1000 : 0));
+ int cap = 3500+(you.strength * 100)+(player_is_levitating() ? 1000 : 0);
+ if ( bs == BS_UNENCUMBERED )
+ return (cap * 5) / 6;
+ else if ( bs == BS_ENCUMBERED )
+ return (cap * 11) / 12;
+ else
+ return cap;
}
int burden_change(void)
@@ -2019,8 +2024,6 @@ int burden_change(void)
you.burden = 0;
- int max_carried = carrying_capacity();
-
if (you.duration[DUR_STONEMAIL])
you.burden += 800;
@@ -2046,8 +2049,7 @@ int burden_change(void)
set_redraw_status( REDRAW_BURDEN );
// changed the burdened levels to match the change to max_carried
- if (you.burden < (max_carried * 5) / 6)
- // (you.burden < max_carried - 1000)
+ if (you.burden < carrying_capacity(BS_UNENCUMBERED))
{
you.burden_state = BS_UNENCUMBERED;
@@ -2055,8 +2057,7 @@ int burden_change(void)
if (old_burdenstate != you.burden_state)
mpr("Your possessions no longer seem quite so burdensome.");
}
- else if (you.burden < (max_carried * 11) / 12)
- // (you.burden < max_carried - 500)
+ else if (you.burden < carrying_capacity(BS_ENCUMBERED))
{
you.burden_state = BS_ENCUMBERED;
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index 088f290228..d9a964c0f9 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -86,7 +86,7 @@ int burden_change(void);
/* ***********************************************************************
* called from: items - misc
* *********************************************************************** */
-int carrying_capacity(void);
+int carrying_capacity( burden_state_type bs = BS_OVERLOADED );
/* ***********************************************************************