record and replay File->Abort

This commit is contained in:
2024-08-24 11:49:39 -05:00
committed by Celtic Minstrel
parent 8b05b5be9a
commit 99565b5cef
3 changed files with 21 additions and 10 deletions

View File

@@ -2280,6 +2280,21 @@ void do_save(short mode) {
redraw_screen(REFRESH_TEXT);
}
void do_abort() {
if(recording){
record_action("do_abort", "");
}
if(overall_mode != MODE_STARTUP) {
std::string choice = cChoiceDlog("abort-game",{"okay","cancel"}).show();
if (choice=="cancel") return;
reload_startup();
overall_mode = MODE_STARTUP;
}
party_in_memory = false;
draw_startup(0);
menu_activate();
}
void do_rest(long length, int hp_restore, int mp_restore) {
unsigned long age_before = univ.party.age;
univ.party.age += length;

View File

@@ -21,6 +21,7 @@ bool handle_scroll(const sf::Event& event);
void do_load();
void post_load();
void do_save(short mode);
void do_abort();
void increase_age();
void handle_hunting();
void switch_pc(short which);

View File

@@ -342,8 +342,12 @@ static void replay_next_action() {
new_party();
}else if(t == "pick_preferences"){
pick_preferences();
}else if(t == "do_abort"){
do_abort();
}
// TODO some of these actions shouldn't call advance_time(). They should return
// from the function early
advance_time(did_something, need_redraw, need_reprint);
}
@@ -658,16 +662,7 @@ void handle_menu_choice(eMenu item_hit) {
new_party();
break;
case eMenu::FILE_ABORT:
// TODO record and replay
if(overall_mode != MODE_STARTUP) {
std::string choice = cChoiceDlog("abort-game",{"okay","cancel"}).show();
if (choice=="cancel") return;
reload_startup();
overall_mode = MODE_STARTUP;
}
party_in_memory = false;
draw_startup(0);
menu_activate();
do_abort();
break;
case eMenu::PREFS:
pick_preferences();