diff options
author | Adam Borowski <kilobyte@angband.pl> | 2012-12-20 13:28:23 +0100 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2012-12-20 13:28:23 +0100 |
commit | 44fe2a6941259afb9229f87c8d1f91f060375fc5 (patch) | |
tree | 0e1d527c66cfbb05353500b666fe956d41ebd42b /crawl-ref/source/uncancel.cc | |
parent | 63f7441749507362286a5f66d55f2183d2fd7ec6 (diff) | |
download | crawl-ref-44fe2a6941259afb9229f87c8d1f91f060375fc5.tar.gz crawl-ref-44fe2a6941259afb9229f87c8d1f91f060375fc5.zip |
Fix a game-killing bug with recursive uncancellables.
Like, getting a Genie acquirement from Triple Draw.
Diffstat (limited to 'crawl-ref/source/uncancel.cc')
-rw-r--r-- | crawl-ref/source/uncancel.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crawl-ref/source/uncancel.cc b/crawl-ref/source/uncancel.cc index dfd1b19c73..fc76f8c3f9 100644 --- a/crawl-ref/source/uncancel.cc +++ b/crawl-ref/source/uncancel.cc @@ -11,14 +11,22 @@ #include "player.h" #include "state.h" #include "uncancel.h" +#include "unwind.h" void add_uncancel(uncancellable_type kind, int arg) { you.uncancel.push_back(pair<uncancellable_type, int>(kind, arg)); } +static bool running = false; + void run_uncancels() { + // Run uncancels iteratively rather than recursively. + if (running) + return; + unwind_var<bool> run(running, true); + while (!you.uncancel.empty() && !crawl_state.seen_hups) { // changed to -1 if we pop prematurely @@ -29,6 +37,7 @@ void run_uncancels() // was no HUP, it's due to some other reason. int arg = you.uncancel[act].second; + dprf("Running uncancel type=%d arg=%d", you.uncancel[act].first, arg); switch (you.uncancel[act].first) { |