Skip to content

Commit

Permalink
call advance_time for cancel_item_target
Browse files Browse the repository at this point in the history
  • Loading branch information
NQNStudios committed Sep 26, 2024
1 parent 24f49c7 commit bea9ee1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/game/boe.actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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", "");
}
Expand All @@ -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){
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions src/game/boe.main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit bea9ee1

Please sign in to comment.