From f3f1124befa2ffde517aa01f713f96536b3aeb49 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Wed, 31 Jul 2024 18:09:51 -0500 Subject: [PATCH] record and replay dropping items --- src/game/boe.actions.cpp | 14 ++++++++++++-- src/game/boe.main.cpp | 9 ++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/game/boe.actions.cpp b/src/game/boe.actions.cpp index 352ea52c..ce7feeae 100644 --- a/src/game/boe.actions.cpp +++ b/src/game/boe.actions.cpp @@ -644,7 +644,13 @@ static void handle_target_space(location destination, bool& did_something, bool& put_item_screen(stat_window); } -static void handle_drop_item(location destination, bool& need_redraw) { +void handle_drop_item(location destination, bool& need_redraw) { + if(recording){ + std::ostringstream sstr; + sstr << destination; + record_action("handle_drop_item_location", sstr.str()); + } + if(overall_mode == MODE_DROP_COMBAT) { if(!adjacent(univ.current_pc().combat_pos,destination)) add_string_to_buf("Drop: must be adjacent."); @@ -825,7 +831,11 @@ static void handle_give_item(short item_hit, bool& did_something, bool& need_red take_ap(1); } -static void handle_drop_item(short item_hit, bool& need_redraw) { +void handle_drop_item(short item_hit, bool& need_redraw) { + if(recording){ + record_action("handle_drop_item_id", std::to_string(item_hit)); + } + if(overall_mode == MODE_DROP_TOWN || overall_mode == MODE_DROP_COMBAT) { add_string_to_buf("Drop item: Cancelled"); overall_mode = is_town() ? MODE_TOWN : MODE_COMBAT; diff --git a/src/game/boe.main.cpp b/src/game/boe.main.cpp index 6fbfcbd8..3e96df2b 100644 --- a/src/game/boe.main.cpp +++ b/src/game/boe.main.cpp @@ -130,6 +130,8 @@ void handle_town_wait(bool& need_redraw, bool& need_reprint); void handle_combat_switch(bool& did_something, bool& need_redraw, bool& need_reprint); void handle_missile(bool& need_redraw, bool& need_reprint); void handle_get_items(bool& did_something, bool& need_redraw, bool& need_reprint); +void handle_drop_item(short item_hit, bool& need_redraw); +void handle_drop_item(location destination, bool& need_redraw); #ifdef __APPLE__ eMenuChoice menuChoice=eMenuChoice::MENU_CHOICE_NONE; @@ -307,8 +309,13 @@ void replay_next_action() { handle_missile(need_redraw, need_reprint); }else if(t == "handle_get_items"){ handle_get_items(did_something, need_redraw, need_reprint); + }else if(t == "handle_drop_item_id"){ + short item_hit = short_from_action(next_action); + handle_drop_item(item_hit, need_redraw); + }else if(t == "handle_drop_item_location"){ + location destination = location_from_action(next_action); + handle_drop_item(destination, need_redraw); } - // void handle_drop_item(short item_hit, bool& need_redraw); advance_time(did_something, need_redraw, need_reprint); }