diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-09-19 22:56:46 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-09-19 22:56:46 +0000 |
commit | 7b52c20fd2613f4597a5b429c604369d393367ec (patch) | |
tree | b955c5b143a0210879141bb8ad3258cf819b35fb /crawl-ref/source/state.cc | |
parent | 5e4ca0912ae656b9e2a55b95027ebc6f483a01a6 (diff) | |
download | crawl-ref-7b52c20fd2613f4597a5b429c604369d393367ec.tar.gz crawl-ref-7b52c20fd2613f4597a5b429c604369d393367ec.zip |
Input buffer needs to be flushed if the first iteration of command
repetition is canceled.
Repetitions of searching and go-nowhere weren't being interrupted.
Wasn't generating activity interrupts for AI_FULL_MP and AI_FULL_HP.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2150 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/state.cc')
-rw-r--r-- | crawl-ref/source/state.cc | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/crawl-ref/source/state.cc b/crawl-ref/source/state.cc index a664a3464b..41c4837dff 100644 --- a/crawl-ref/source/state.cc +++ b/crawl-ref/source/state.cc @@ -63,7 +63,7 @@ void game_state::cancel_cmd_repeat(std::string reason) if (!is_repeating_cmd()) return; - if (is_replaying_keys()) + if (is_replaying_keys() || cmd_repeat_start) flush_input_buffer(FLUSH_KEY_REPLAY_CANCEL); if (is_processing_macro()) @@ -124,14 +124,6 @@ bool interrupt_cmd_repeat( activity_interrupt_type ai, if (crawl_state.cmd_repeat_start) return false; - // If command repitition is being used to immitate the rest command, - // then everything interrupts it. - if (crawl_state.repeat_cmd == CMD_MOVE_NOWHERE - || crawl_state.repeat_cmd == CMD_SEARCH) - { - return true; - } - if (crawl_state.repeat_cmd == CMD_WIZARD) return false; @@ -192,6 +184,20 @@ bool interrupt_cmd_repeat( activity_interrupt_type ai, return true; } + // If command repitition is being used to immitate the rest command, + // then everything interrupts it. + if (crawl_state.repeat_cmd == CMD_MOVE_NOWHERE + || crawl_state.repeat_cmd == CMD_SEARCH) + { + if (ai == AI_FULL_MP) + crawl_state.cancel_cmd_repeat("Magic restored."); + else if (ai = AI_FULL_HP) + crawl_state.cancel_cmd_repeat("HP restored."); + else + crawl_state.cancel_cmd_repeat("Command repetition interrupted."); + return true; + } + if (crawl_state.cmd_repeat_started_unsafe) return false; |