record and replay toggling debug mode

This commit is contained in:
2024-08-27 15:23:19 -05:00
committed by Celtic Minstrel
parent 482b35d121
commit 9166e5b0e1
3 changed files with 18 additions and 8 deletions

View File

@@ -1761,6 +1761,20 @@ static void give_help_and_record(short help1, short help2) {
give_help(help1, help2);
}
void toggle_debug_mode() {
if(recording){
record_action("toggle_debug_mode", "");
}
if(univ.debug_mode) {
univ.debug_mode = false;
ASB("Debug mode OFF.");
} else {
univ.debug_mode = true;
ASB("Debug mode ON.");
}
print_buf();
}
bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){
bool are_done = false;
location pass_point; // TODO: This isn't needed
@@ -1929,14 +1943,7 @@ bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){
case 'D':
if(univ.debug_mode) {
univ.debug_mode = false;
ASB("Debug mode OFF.");
} else {
univ.debug_mode = true;
ASB("Debug mode ON.");
}
print_buf();
toggle_debug_mode();
break;
case 'z':
show_inventory();

View File

@@ -70,5 +70,6 @@ void handle_bash_pick(location destination, bool& did_something, bool& need_redr
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();
#endif

View File

@@ -479,6 +479,8 @@ static void replay_next_action() {
short help1 = boost::lexical_cast<short>(info["help1"]);
short help2 = boost::lexical_cast<short>(info["help2"]);
give_help(help1, help2);
}else if(t == "toggle_debug_mode"){
toggle_debug_mode();
}
// TODO some of these actions shouldn't call advance_time(). They should return