summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-07-15 13:45:52 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-07-15 13:45:52 +0000
commitcaf27fb755b20d52479d033582a6b368eba66608 (patch)
treec9e63f0593f8bf18b832b085582de93f9270e423
parent9238257d62cb6c167f91e9d9cf60dd7fa229c040 (diff)
downloadcrawl-ref-caf27fb755b20d52479d033582a6b368eba66608.tar.gz
crawl-ref-caf27fb755b20d52479d033582a6b368eba66608.zip
Fix gloved butchery, using part of evktalo's patch plus a minor hack to
ensure that the gloves are removed exactly when they should be. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10224 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/delay.cc8
-rw-r--r--crawl-ref/source/delay.h1
-rw-r--r--crawl-ref/source/food.cc20
3 files changed, 22 insertions, 7 deletions
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index c0f0c88c8b..a0f5b03c5a 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -753,7 +753,7 @@ void clear_macro_process_key_delay()
_pop_delay();
}
-void handle_delay( void )
+void handle_delay()
{
if (!you_are_delayed())
return;
@@ -1418,6 +1418,12 @@ static void _finish_delay(const delay_queue_item &delay)
#endif
}
+void finish_last_delay()
+{
+ delay_queue_item &delay = you.delay_queue.front();
+ _finish_delay(delay);
+}
+
void armour_wear_effects(const int item_slot)
{
const unsigned int old_talents = your_talents(false).size();
diff --git a/crawl-ref/source/delay.h b/crawl-ref/source/delay.h
index edc2868df0..03749a14fb 100644
--- a/crawl-ref/source/delay.h
+++ b/crawl-ref/source/delay.h
@@ -72,6 +72,7 @@ bool you_are_delayed();
delay_type current_delay_action();
int check_recital_audience();
void handle_delay();
+void finish_last_delay();
bool is_run_delay(int delay);
bool is_being_butchered(const item_def &item, bool just_first = true);
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index ce71b5caa3..e056390a20 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -319,17 +319,22 @@ static bool _prepare_butchery(bool can_butcher, bool removed_gloves,
if (can_butcher)
return (true);
- // At least one of these has to be true, else what are we doing here?
+ // At least one of these has to be true, else what are we doing
+ // here?
ASSERT(removed_gloves || wpn_switch);
// If you can butcher by taking off your gloves, don't prompt.
if (removed_gloves)
{
- // Actually take off the gloves; this creates a
- // delay. We assume later on that gloves have a 1-turn
- // takeoff delay!
+ // Actually take off the gloves; this creates a delay. We
+ // assume later on that gloves have a 1-turn takeoff delay!
if (!takeoff_armour(you.equip[EQ_GLOVES]))
return (false);
+
+ // Ensure that the gloves are taken off by now by finishing the
+ // DELAY_ARMOUR_OFF delay started by takeoff_armour() above.
+ // FIXME: get rid of this hack!
+ finish_last_delay();
}
if (wpn_switch)
@@ -558,8 +563,11 @@ bool butchery(int which_corpse)
if (!can_butcher)
{
// Try to find a butchering implement.
- if (!_find_butchering_implement(butcher_tool))
- return (false);
+ if (!gloved_butcher)
+ {
+ if (!_find_butchering_implement(butcher_tool))
+ return (false);
+ }
if (butcher_tool == -1 && gloved_butcher)
removed_gloves = true;