summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/food.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-11 15:50:46 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-11 15:50:46 +0000
commit6f8e75f0aaf3f8f4c038bc4765a60dcf48fe57ca (patch)
tree4bc32a2e87d8f7d7648a1059710a3cff82d1e4fe /crawl-ref/source/food.cc
parent670cdde1fae7896c45aeaed440dcfd2d19470f3e (diff)
downloadcrawl-ref-6f8e75f0aaf3f8f4c038bc4765a60dcf48fe57ca.tar.gz
crawl-ref-6f8e75f0aaf3f8f4c038bc4765a60dcf48fe57ca.zip
Fix 2041934: auto-swapping rings and amulets was taking twice as long
as manually swapping (two double-speed turns plus one bogus normal-speed turn.) This also applied to weapon swapping after butchery. This fix is rather hackish, better solutions appreciated. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7213 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/food.cc')
-rw-r--r--crawl-ref/source/food.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index e42bb09e33..0bb334ea60 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -131,7 +131,7 @@ void weapon_switch( int targ )
if (targ == -1) // Unarmed Combat.
{
// Already unarmed?
- if (you.equip[EQ_WEAPON] == -1)
+ if (!you.weapon())
return;
mpr( "You switch back to your bare hands." );
@@ -156,7 +156,7 @@ void weapon_switch( int targ )
// Well yeah, but that's because interacting with the wielding
// code is a mess... this whole function's purpose was to
// isolate this hack until there's a proper way to do things. -- bwr
- if (you.equip[EQ_WEAPON] != -1)
+ if (you.weapon())
unwield_item(false);
you.equip[EQ_WEAPON] = targ;
@@ -168,13 +168,25 @@ void weapon_switch( int targ )
if (Options.chunks_autopickup || you.species == SP_VAMPIRE)
autopickup();
+ // Same amount of time as normal wielding.
+ // FIXME: this duplicated code is begging for a bug.
+ if (you.weapon())
+ {
+ you.time_taken /= 2;
+ }
+ else // swapping to empty hands is faster
+ {
+ you.time_taken *= 3;
+ you.time_taken /= 10;
+ }
+
you.turn_is_over = true;
}
// Look for a butchering implement. If fallback is true,
// prompt the user if no obvious options exist.
// Returns whether a weapon was switched.
-static int _find_butchering_implement(int &butcher_tool)
+static bool _find_butchering_implement(int &butcher_tool)
{
// When berserk, you can't change weapons. Sanity check!
if (!can_wield(NULL, true))