From a21b44c238f8c245c69194c920aab1968de6329a Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Wed, 25 Sep 2024 11:57:33 -0500 Subject: [PATCH] fix more advance_time cases --- src/game/boe.actions.cpp | 19 +++++++++++-------- src/game/boe.actions.hpp | 6 +++--- src/game/boe.main.cpp | 6 +++--- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/game/boe.actions.cpp b/src/game/boe.actions.cpp index 96d919b4..d5f04c38 100644 --- a/src/game/boe.actions.cpp +++ b/src/game/boe.actions.cpp @@ -1253,7 +1253,7 @@ void screen_shift(int dx, int dy, bool& need_redraw) { need_redraw = true; } -void handle_print_pc_hp(int which_pc) { +void handle_print_pc_hp(int which_pc, bool& need_reprint) { if(recording){ record_action("handle_print_pc_hp", boost::lexical_cast(which_pc)); } @@ -1262,9 +1262,10 @@ void handle_print_pc_hp(int which_pc) { str << pc.name << " has "; str << pc.cur_health << " health out of " << pc.max_health << '.'; add_string_to_buf(str.str()); + need_reprint = true; } -void handle_print_pc_sp(int which_pc) { +void handle_print_pc_sp(int which_pc, bool& need_reprint) { if(recording){ record_action("handle_print_pc_sp", boost::lexical_cast(which_pc)); } @@ -1273,9 +1274,10 @@ void handle_print_pc_sp(int which_pc) { str << pc.name << " has "; str << pc.cur_sp << " spell pts. out of " << pc.max_sp << '.'; add_string_to_buf(str.str()); + need_reprint = true; } -void handle_trade_places(int which_pc) { +void handle_trade_places(int which_pc, bool& need_reprint) { if(recording){ record_action("handle_trade_places", boost::lexical_cast(which_pc)); } @@ -1286,6 +1288,7 @@ void handle_trade_places(int which_pc) { else { switch_pc(which_pc); } + need_reprint = true; } void show_item_info(short item_hit) { @@ -1533,22 +1536,22 @@ bool handle_action(const sf::Event& event, cFramerateLimiter& fps_limiter) { handle_switch_pc(i, need_redraw, need_reprint); break; case PCBTN_HP: - handle_print_pc_hp(i); + handle_print_pc_hp(i, need_reprint); break; case PCBTN_SP: - handle_print_pc_sp(i); + handle_print_pc_sp(i, need_reprint); break; case PCBTN_INFO: give_pc_info(i); - break; + // don't call advance_time + return false; case PCBTN_TRADE: - handle_trade_places(i); + handle_trade_places(i, need_reprint); break; case MAX_ePlayerButton: break; // Not a button } } - need_reprint = true; put_pc_screen(); put_item_screen(stat_window); if(overall_mode == MODE_SHOPPING) { diff --git a/src/game/boe.actions.hpp b/src/game/boe.actions.hpp index e1cf9953..30105560 100644 --- a/src/game/boe.actions.hpp +++ b/src/game/boe.actions.hpp @@ -91,9 +91,9 @@ void debug_increase_age(); void debug_towns_forget(); void debug_heal_plus_extra(); void debug_heal(); -void handle_print_pc_hp(int which_pc); -void handle_print_pc_sp(int which_pc); -void handle_trade_places(int which_pc); +void handle_print_pc_hp(int which_pc, bool& need_reprint); +void handle_print_pc_sp(int which_pc, bool& need_reprint); +void handle_trade_places(int which_pc, bool& need_reprint); void handle_begin_talk(bool& need_reprint); void handle_talk(location destination, bool& did_something, bool& need_redraw, bool& need_reprint); void give_help_and_record(short help1, short help2); diff --git a/src/game/boe.main.cpp b/src/game/boe.main.cpp index 9e0bb0e2..0ab4f42b 100644 --- a/src/game/boe.main.cpp +++ b/src/game/boe.main.cpp @@ -551,14 +551,14 @@ static void replay_next_action() { debug_heal_plus_extra(); return; }else if(t == "handle_print_pc_hp"){ - handle_print_pc_hp(boost::lexical_cast(next_action.GetText())); + handle_print_pc_hp(boost::lexical_cast(next_action.GetText()), need_reprint); }else if(t == "handle_print_pc_sp"){ - handle_print_pc_sp(boost::lexical_cast(next_action.GetText())); + handle_print_pc_sp(boost::lexical_cast(next_action.GetText()), need_reprint); }else if(t == "give_pc_info"){ give_pc_info(boost::lexical_cast(next_action.GetText())); return; }else if(t == "handle_trade_places"){ - handle_trade_places(boost::lexical_cast(next_action.GetText())); + handle_trade_places(boost::lexical_cast(next_action.GetText()), need_reprint); }else if(t == "handle_begin_talk"){ handle_begin_talk(need_reprint); }else if(t == "handle_talk"){