summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/delay.cc14
-rw-r--r--crawl-ref/source/delay.h7
-rw-r--r--crawl-ref/source/externs.h8
-rw-r--r--crawl-ref/source/food.cc18
-rw-r--r--crawl-ref/source/transfor.cc16
-rw-r--r--crawl-ref/source/transfor.h1
6 files changed, 46 insertions, 18 deletions
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index fc016121d2..5f4d8877db 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -53,7 +53,7 @@ static void finish_delay(const delay_queue_item &delay);
// other delays can be spawned while this delay is running. If is_parent_delay
// returns true, new delays will be pushed immediately to the front of the
// delay in question, rather than at the end of the queue.
-static bool is_parent_delay(int delay)
+static bool is_parent_delay(delay_type delay)
{
// Interlevel travel can do upstairs/downstairs delays.
// Lua macros can in theory perform any of the other delays,
@@ -99,7 +99,7 @@ static void clear_pending_delays()
}
}
-void start_delay( int type, int turns, int parm1, int parm2 )
+void start_delay( delay_type type, int turns, int parm1, int parm2 )
/***********************************************************/
{
delay_queue_item delay;
@@ -253,13 +253,19 @@ void stop_delay( void )
update_turn_count();
}
+void stop_butcher_delay()
+{
+ if (current_delay_action() == DELAY_BUTCHER)
+ stop_delay();
+}
+
bool you_are_delayed( void )
/**************************/
{
return (!you.delay_queue.empty());
}
-int current_delay_action( void )
+delay_type current_delay_action( void )
/******************************/
{
return (you_are_delayed() ? you.delay_queue.front().type
@@ -828,6 +834,8 @@ static void handle_run_delays(const delay_queue_item &delay)
case DELAY_TRAVEL:
cmd = travel();
break;
+ default:
+ break;
}
if (cmd != CMD_NO_CMD)
diff --git a/crawl-ref/source/delay.h b/crawl-ref/source/delay.h
index ed496aa9cc..c45d5a0b2b 100644
--- a/crawl-ref/source/delay.h
+++ b/crawl-ref/source/delay.h
@@ -14,14 +14,15 @@
#include "enum.h"
-void start_delay( int type, int turns, int parm1 = 0, int parm2 = 0 );
-void stop_delay( void );
+void start_delay( delay_type type, int turns, int parm1 = 0, int parm2 = 0 );
+void stop_delay( void );
bool you_are_delayed( void );
-int current_delay_action( void );
+delay_type current_delay_action( void );
void handle_delay( void );
bool is_run_delay(int delay);
bool is_being_butchered(const item_def &item);
+void stop_butcher_delay();
const char *activity_interrupt_name(activity_interrupt_type ai);
activity_interrupt_type get_activity_interrupt(const std::string &);
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index af1681dab9..09be639e3a 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -478,10 +478,10 @@ struct run_check_dir
struct delay_queue_item
{
- int type;
- int duration;
- int parm1;
- int parm2;
+ delay_type type;
+ int duration;
+ int parm1;
+ int parm2;
};
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index 776b47d945..8e3d770342 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -44,6 +44,7 @@
#include "skills2.h"
#include "spells2.h"
#include "stuff.h"
+#include "transfor.h"
#include "tutorial.h"
static int determine_chunk_effect(int which_chunk_type, bool rotten_chunk);
@@ -188,13 +189,16 @@ bool butchery(void)
bool new_cursed = false;
int old_weapon = you.equip[EQ_WEAPON];
- bool barehand_butcher = (you.equip[ EQ_GLOVES ] == -1)
- && (you.attribute[ATTR_TRANSFORMATION] == TRAN_BLADE_HANDS ||
- you.attribute[ATTR_TRANSFORMATION] == TRAN_DRAGON ||
- (you.attribute[ATTR_TRANSFORMATION] == TRAN_NONE &&
- (you.species == SP_TROLL ||
- you.species == SP_GHOUL ||
- you.mutation[MUT_CLAWS])));
+ const transformation_type transform =
+ static_cast<transformation_type>(you.attribute[ATTR_TRANSFORMATION]);
+
+ bool barehand_butcher =
+ (you.equip[ EQ_GLOVES ] == -1
+ && (transform_can_butcher_barehanded(transform)
+ || (transform == TRAN_NONE
+ && (you.species == SP_TROLL
+ || you.species == SP_GHOUL
+ || you.mutation[MUT_CLAWS]))));
bool gloved_butcher = (you.species == SP_TROLL ||
you.species == SP_GHOUL ||
diff --git a/crawl-ref/source/transfor.cc b/crawl-ref/source/transfor.cc
index d90b73667b..fd97820d64 100644
--- a/crawl-ref/source/transfor.cc
+++ b/crawl-ref/source/transfor.cc
@@ -20,6 +20,7 @@
#include "externs.h"
+#include "delay.h"
#include "it_use2.h"
#include "itemprop.h"
#include "items.h"
@@ -367,6 +368,11 @@ bool transform(int pow, transformation_type which_trans)
return (false);
} // end transform()
+bool transform_can_butcher_barehanded(transformation_type tt)
+{
+ return (tt == TRAN_BLADE_HANDS || tt == TRAN_DRAGON);
+}
+
void untransform(void)
{
FixedVector < char, 8 > rem_stuff;
@@ -382,7 +388,9 @@ void untransform(void)
you.colour = LIGHTGREY;
// must be unset first or else infinite loops might result -- bwr
- const int old_form = you.attribute[ ATTR_TRANSFORMATION ];
+ const transformation_type old_form =
+ static_cast<transformation_type>(you.attribute[ ATTR_TRANSFORMATION ]);
+
you.attribute[ ATTR_TRANSFORMATION ] = TRAN_NONE;
you.duration[ DUR_TRANSFORMATION ] = 0;
@@ -456,8 +464,14 @@ void untransform(void)
modify_stat(STAT_STRENGTH, -13, true);
hp_downscale = 17;
break;
+
+ default:
+ break;
}
+ if (transform_can_butcher_barehanded(old_form))
+ stop_butcher_delay();
+
// If nagas wear boots while transformed, they fall off again afterwards:
// I don't believe this is currently possible, and if it is we
// probably need something better to cover all possibilities. -bwr
diff --git a/crawl-ref/source/transfor.h b/crawl-ref/source/transfor.h
index 8d62f730c7..45d0904bad 100644
--- a/crawl-ref/source/transfor.h
+++ b/crawl-ref/source/transfor.h
@@ -17,6 +17,7 @@
#include "FixVec.h"
#include "enum.h"
+bool transform_can_butcher_barehanded(transformation_type tt);
// last updated 12may2000 {dlb}
/* ***********************************************************************