From 7b52c20fd2613f4597a5b429c604369d393367ec Mon Sep 17 00:00:00 2001 From: zelgadis Date: Wed, 19 Sep 2007 22:56:46 +0000 Subject: 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 --- crawl-ref/source/state.cc | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'crawl-ref/source/state.cc') 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; -- cgit v1.2.3-54-g00ecf