record and replay using spaces

This commit is contained in:
2024-08-27 13:58:05 -05:00
committed by Celtic Minstrel
parent aeabb6eade
commit 22727fc17f
3 changed files with 17 additions and 2 deletions

View File

@@ -757,7 +757,10 @@ void handle_drop_item(location destination, bool& need_redraw) {
put_item_screen(stat_window);
}
static void handle_use_space_select(bool& need_reprint) {
void handle_use_space_select(bool& need_reprint) {
if(recording){
record_action("handle_use_space_select", "");
}
if(overall_mode == MODE_TOWN) {
add_string_to_buf("Use: Select a space or item.");
add_string_to_buf(" (Hit button again to cancel.)");
@@ -770,7 +773,12 @@ static void handle_use_space_select(bool& need_reprint) {
}
}
static void handle_use_space(location destination, bool& did_something, bool& need_redraw) {
void handle_use_space(location destination, bool& did_something, bool& need_redraw) {
if(recording){
std::ostringstream sstr;
sstr << destination;
record_action("handle_use_space", sstr.str());
}
if(!adjacent(destination,univ.party.town_loc))
add_string_to_buf(" Must be adjacent.");
else did_something = use_space(destination);

View File

@@ -67,5 +67,7 @@ void handle_target_space(location destination, bool& did_something, bool& need_r
void handle_pause(bool& did_something, bool& need_redraw);
void handle_bash_pick_select(bool& need_reprint, bool isBash);
void handle_bash_pick(location destination, bool& did_something, bool& need_redraw, bool isBash);
void handle_use_space_select(bool& need_reprint);
void handle_use_space(location destination, bool& did_something, bool& need_redraw);
#endif

View File

@@ -467,6 +467,11 @@ static void replay_next_action() {
}else if(t == "handle_pick"){
location destination = location_from_action(next_action);
handle_bash_pick(destination, did_something, need_redraw, false);
}else if(t == "handle_use_space_select"){
handle_use_space_select(need_reprint);
}else if(t == "handle_use_space"){
location destination = location_from_action(next_action);
handle_use_space(destination, did_something, need_redraw);
}
// TODO some of these actions shouldn't call advance_time(). They should return