From 532d8dccff760d21593d5db61275e1d00a6af25b Mon Sep 17 00:00:00 2001 From: zelgadis Date: Wed, 24 Dec 2008 00:34:10 +0000 Subject: Fix re-do/repeat command not working with commands that targetted a monster. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7926 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/directn.cc | 22 +++++++++++----------- crawl-ref/source/state.cc | 12 ++++++++++++ crawl-ref/source/state.h | 2 ++ 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index f07d04864c..335ce7d016 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -370,25 +370,25 @@ static void _direction_again(dist& moves, targeting_type restricts, { moves.isCancel = true; - crawl_state.cancel_cmd_repeat("You can no longer see the dungeon " - "square you previously targeted."); + crawl_state.cancel_cmd_all("You can no longer see the dungeon " + "square you previously targeted."); return; } else if (you.prev_grd_targ == you.pos()) { moves.isCancel = true; - crawl_state.cancel_cmd_repeat("You are now standing on your " - "previously targeted dungeon " - "square."); + crawl_state.cancel_cmd_all("You are now standing on your " + "previously targeted dungeon " + "square."); return; } else if (!_is_target_in_range(you.prev_grd_targ, range)) { moves.isCancel = true; - crawl_state.cancel_cmd_repeat("Your previous target is now out of " - "range."); + crawl_state.cancel_cmd_all("Your previous target is now out of " + "range."); return; } @@ -416,16 +416,16 @@ static void _direction_again(dist& moves, targeting_type restricts, { moves.isCancel = true; - crawl_state.cancel_cmd_repeat("Your target is gone."); + crawl_state.cancel_cmd_all("Your target is gone."); return; } - else if (!_is_target_in_range(you.prev_grd_targ, range)) + else if (!_is_target_in_range(montarget->pos(), range)) { moves.isCancel = true; - crawl_state.cancel_cmd_repeat("Your previous target is now out of " - "range."); + crawl_state.cancel_cmd_all("Your previous target is now out of " + "range."); return; } diff --git a/crawl-ref/source/state.cc b/crawl-ref/source/state.cc index 91845abd51..f6eafa288b 100644 --- a/crawl-ref/source/state.cc +++ b/crawl-ref/source/state.cc @@ -112,6 +112,12 @@ void game_state::cancel_cmd_again(std::string reason) mpr(reason.c_str()); } +void game_state::cancel_cmd_all(std::string reason) +{ + cancel_cmd_repeat(reason); + cancel_cmd_again(reason); +} + void game_state::cant_cmd_repeat(std::string reason) { if (reason.empty()) @@ -128,6 +134,12 @@ void game_state::cant_cmd_again(std::string reason) cancel_cmd_again(reason); } +void game_state::cant_cmd_any(std::string reason) +{ + cant_cmd_repeat(reason); + cant_cmd_again(reason); +} + // The method is called to prevent the "no repeating zero turns // commands" message that input() generates (in the absence of // cancelling the repeition) for a repeated command that took no diff --git a/crawl-ref/source/state.h b/crawl-ref/source/state.h index 6e4847bf65..24c4fc45b8 100644 --- a/crawl-ref/source/state.h +++ b/crawl-ref/source/state.h @@ -88,9 +88,11 @@ public: void cancel_cmd_repeat(std::string reason = ""); void cancel_cmd_again(std::string reason = ""); + void cancel_cmd_all(std::string reason = ""); void cant_cmd_repeat(std::string reason = ""); void cant_cmd_again(std::string reason = ""); + void cant_cmd_any(std::string reason = ""); void zero_turns_taken(); -- cgit v1.2.3-54-g00ecf