call advance_time for cancel_item_target

This commit is contained in:
2024-09-26 11:02:31 -05:00
committed by Celtic Minstrel
parent 058e5ebe61
commit a455f5ec6e
3 changed files with 8 additions and 5 deletions

View File

@@ -2138,7 +2138,7 @@ void close_map(bool record) {
mainPtr.setActive();
}
void cancel_item_target() {
void cancel_item_target(bool& did_something, bool& need_redraw, bool& need_reprint) {
if(recording){
record_action("cancel_item_target", "");
}
@@ -2148,6 +2148,9 @@ void cancel_item_target() {
ASB("Recharge: Finished");
overall_mode = MODE_TOWN;
stat_screen_mode = MODE_INVEN;
// Time passes because a spell was cast. Redraw happens because item names
// in the inventory can change. Reprint happens because of the buffer print
did_something = need_redraw = need_reprint = true;
}
bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){
@@ -2308,7 +2311,8 @@ bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){
spell_cast_hit_return();
else if(overall_mode == MODE_ITEM_TARGET) {
// Cancel choosing items
cancel_item_target();
cancel_item_target(did_something, need_redraw, need_reprint);
advance_time(did_something, need_redraw, need_reprint);
} 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,7 +99,7 @@ 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();
void cancel_item_target(bool& did_something, bool& need_redraw, bool& need_reprint);
void update_item_stats_area(bool& need_reprint);
#endif

View File

@@ -615,8 +615,7 @@ static void replay_next_action() {
handle_monster_info_menu(boost::lexical_cast<int>(next_action.GetText()));
return;
}else if(t == "cancel_item_target"){
cancel_item_target();
return;
cancel_item_target(did_something, need_redraw, need_reprint);
}else if(t == "advance_time"){
throw std::string { "Replay system internal error! advance_time() was supposed to be called by the last action, but wasn't: " } + _last_action_type;
}else{