summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/delay.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-06 21:29:32 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-06 21:29:32 +0000
commit6aceeffe99753798bc8927e11a6cf75b85466cde (patch)
tree20f6fb2e19153b5a2856b4bc2bdd5e816e7d5d80 /crawl-ref/source/delay.cc
parent2d1f69be59f5a799300ba47eeb2cf7f42c76b181 (diff)
downloadcrawl-ref-6aceeffe99753798bc8927e11a6cf75b85466cde.tar.gz
crawl-ref-6aceeffe99753798bc8927e11a6cf75b85466cde.zip
BR 1972213: Move "Corpse x no longer valid!" into #DEBUG_DIAGNOSTICS
and print "The corpse you are butchering rises to attack you." where that is the case. BR 1945387: Don't allow summoning earth elementals from walls near the edge of the map (that can't get destroyed that way). Just seems more consistent. There's an error message, but it doesn't cost a turn. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5505 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/delay.cc')
-rw-r--r--crawl-ref/source/delay.cc40
1 files changed, 25 insertions, 15 deletions
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index 151fa3947e..c78e73dce3 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -542,13 +542,11 @@ void stop_butcher_delay()
}
bool you_are_delayed( void )
-/**************************/
{
return (!you.delay_queue.empty());
}
delay_type current_delay_action( void )
-/******************************/
{
return (you_are_delayed() ? you.delay_queue.front().type
: DELAY_NOT_DELAYED);
@@ -559,16 +557,26 @@ bool is_run_delay(int delay)
return (delay == DELAY_RUN || delay == DELAY_REST || delay == DELAY_TRAVEL);
}
-bool is_being_butchered(const item_def &item)
+bool is_being_butchered(const item_def &item, bool just_first)
{
if (!you_are_delayed())
return (false);
- const delay_queue_item &delay = you.delay_queue.front();
- if (delay.type == DELAY_BUTCHER || delay.type == DELAY_BOTTLE_BLOOD)
+ for (unsigned int i = 0; i < you.delay_queue.size(); i++)
{
- const item_def &corpse = mitm[ delay.parm1 ];
- return (&corpse == &item);
+ if (you.delay_queue[i].type == DELAY_BUTCHER
+ || you.delay_queue[i].type == DELAY_BOTTLE_BLOOD
+ || you.delay_queue[i].type == DELAY_OFFER_CORPSE)
+ {
+ const item_def &corpse = mitm[ you.delay_queue[i].parm1 ];
+ if (&corpse == &item)
+ return (true);
+
+ if (just_first)
+ break;
+ }
+ else
+ break;
}
return (false);
@@ -583,10 +591,10 @@ bool is_vampire_feeding()
return (delay.type == DELAY_FEED_VAMPIRE);
}
-// check whether there are monsters who might be influenced by Recite
-// return 0, if no monsters found
-// return 1, if eligible audience found
-// return -1, if entire audience already affected or too dumb to understand
+// Check whether there are monsters who might be influenced by Recite
+// returns 0, if no monsters found
+// returns 1, if eligible audience found
+// returns -1, if entire audience already affected or too dumb to understand.
int check_recital_audience()
{
int mid;
@@ -607,7 +615,7 @@ int check_recital_audience()
if (!found_monsters)
found_monsters = true;
- // can not be affected in these states
+ // Can not be affected in these states.
if (recite_mons_useless(mons))
continue;
@@ -621,7 +629,7 @@ int check_recital_audience()
mprf(MSGCH_DIAGNOSTICS, "No sensible audience found!");
#endif
- // no use preaching to the choir, nor to common animals
+ // No use preaching to the choir, nor to common animals.
if (found_monsters)
return (-1);
@@ -795,8 +803,10 @@ void handle_delay( void )
}
else if (delay.type == DELAY_OFFER_CORPSE)
{
+#ifdef DEBUG_DIAGNOSTICS
mprf("Corpse %d no longer valid!", delay.parm1);
- // don't attempt to offer an invalid item
+#endif
+ // Don't attempt to offer an invalid item.
pop_delay();
// Chain onto the next delay.
@@ -805,7 +815,7 @@ void handle_delay( void )
}
else
{
- // corpse is no longer valid! End the butchering normally
+ // Corpse is no longer valid! End the butchering normally
// instead of using stop_delay(), so that the player
// switches back to their main weapon if necessary.
delay.duration = 0;