record and replay dropping items

This commit is contained in:
2024-07-31 18:09:51 -05:00
committed by Celtic Minstrel
parent 43350e4e09
commit f3f1124bef
2 changed files with 20 additions and 3 deletions

View File

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

View File

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