record and replay cancelling item target mode

This commit is contained in:
2024-09-23 15:45:24 -05:00
committed by Celtic Minstrel
parent 4d908b42ea
commit 8ff38f2147
3 changed files with 17 additions and 6 deletions

View File

@@ -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);

View File

@@ -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

View File

@@ -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<int>(next_action.GetText()));
}else if(t == "cancel_item_target"){
cancel_item_target();
}else{
std::ostringstream sstr;
sstr << "Couldn't replay action: " << next_action;