record and replay debug give item

This commit is contained in:
2024-08-27 15:30:03 -05:00
committed by Celtic Minstrel
parent 9166e5b0e1
commit 1a0dcb2b37
3 changed files with 18 additions and 8 deletions

View File

@@ -1775,6 +1775,20 @@ void toggle_debug_mode() {
print_buf();
}
void debug_give_item() {
if(recording){
record_action("debug_give_item", "");
}
int i = get_num_response(0, univ.scenario.scen_items.size()-1, "Which item?");
int j = univ.scenario.scen_items[i].ident;
univ.scenario.scen_items[i].ident = true;
univ.party.give_item(univ.scenario.scen_items[i], true);
univ.scenario.scen_items[i].ident = j;
print_buf();
put_item_screen(stat_window);
put_pc_screen(); // In case the item was food or gold
}
bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){
bool are_done = false;
location pass_point; // TODO: This isn't needed
@@ -2085,14 +2099,7 @@ bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){
case 'I':
if(univ.debug_mode) {
int i = get_num_response(0, univ.scenario.scen_items.size()-1, "Which item?");
int j = univ.scenario.scen_items[i].ident;
univ.scenario.scen_items[i].ident = true;
univ.party.give_item(univ.scenario.scen_items[i], true);
univ.scenario.scen_items[i].ident = j;
print_buf();
put_item_screen(stat_window);
put_pc_screen(); // In case the item was food or gold
debug_give_item();
}
break;

View File

@@ -71,5 +71,6 @@ void handle_use_space_select(bool& need_reprint);
void handle_use_space(location destination, bool& did_something, bool& need_redraw);
void show_inventory();
void toggle_debug_mode();
void debug_give_item();
#endif

View File

@@ -481,6 +481,8 @@ static void replay_next_action() {
give_help(help1, help2);
}else if(t == "toggle_debug_mode"){
toggle_debug_mode();
}else if(t == "debug_give_item"){
debug_give_item();
}
// TODO some of these actions shouldn't call advance_time(). They should return