diff --git a/src/game/boe.actions.cpp b/src/game/boe.actions.cpp index e574567b..47ed2a9e 100644 --- a/src/game/boe.actions.cpp +++ b/src/game/boe.actions.cpp @@ -2091,6 +2091,18 @@ void close_map(bool record) { mainPtr.setActive(); } +void cancel_item_target() { + if(recording){ + record_action("cancel_item_target", ""); + } + if(stat_screen_mode == MODE_IDENTIFY) + ASB("Identify: Finished"); + else if(stat_screen_mode == MODE_RECHARGE) + ASB("Recharge: Finished"); + overall_mode = MODE_TOWN; + stat_screen_mode = MODE_INVEN; +} + bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){ bool are_done = false; location pass_point; // TODO: This isn't needed @@ -2248,12 +2260,8 @@ bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){ // Rotate a force wall spell_cast_hit_return(); else if(overall_mode == MODE_ITEM_TARGET) { - if(stat_screen_mode == MODE_IDENTIFY) - ASB("Identify: Finished"); - else if(stat_screen_mode == MODE_RECHARGE) - ASB("Recharge: Finished"); - overall_mode = MODE_TOWN; - stat_screen_mode = MODE_INVEN; + // Cancel choosing items + cancel_item_target(); } else if(overall_mode == MODE_TOWN || overall_mode == MODE_COMBAT || overall_mode == MODE_OUTDOORS) { // Pause (skip turn) handle_pause(did_something, need_redraw); diff --git a/src/game/boe.actions.hpp b/src/game/boe.actions.hpp index ae6a7a1f..c4bc787c 100644 --- a/src/game/boe.actions.hpp +++ b/src/game/boe.actions.hpp @@ -99,5 +99,6 @@ void handle_talk(location destination, bool& did_something, bool& need_redraw, b void give_help_and_record(short help1, short help2); void show_item_info(short item_hit); void close_map(bool record = false); +void cancel_item_target(); #endif diff --git a/src/game/boe.main.cpp b/src/game/boe.main.cpp index 8446a7c6..7a2c8acf 100644 --- a/src/game/boe.main.cpp +++ b/src/game/boe.main.cpp @@ -533,6 +533,8 @@ static void replay_next_action() { handle_parry(did_something, need_redraw, need_reprint); }else if(t == "handle_monster_info_menu"){ handle_monster_info_menu(boost::lexical_cast(next_action.GetText())); + }else if(t == "cancel_item_target"){ + cancel_item_target(); }else{ std::ostringstream sstr; sstr << "Couldn't replay action: " << next_action;