Fix bad error message when using "Back To Turn"

Fixes in Particular "Yes/No" being inverted in that dialog
This commit is contained in:
gfgtdf 2023-03-28 02:57:34 +02:00 committed by GitHub
parent 549b0ae31f
commit c1a9408d91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -315,7 +315,7 @@ void playsingle_controller::hotkey_handler::load_autosave(const std::string& fil
gui2::show_error_message(msg);
} else {
const int res = gui2::show_message("", msg + _("Do you want to load it anyway?"), gui2::dialogs::message::yes_no_buttons);
if(res == gui2::retval::CANCEL) {
if(res != gui2::retval::CANCEL) {
play_controller::hotkey_handler::load_autosave(filename);
}
}
@ -325,12 +325,16 @@ void playsingle_controller::hotkey_handler::load_autosave(const std::string& fil
std::string error_log;
savegame::read_save_file(filesystem::get_saves_dir(), filename, savegame, &error_log);
if(!error_log.empty() || savegame.child_or_empty("snapshot")["replay_pos"].to_int(-1) < 0 ) {
if(!error_log.empty()) {
invalid_save_file(_("The file you have tried to load is corrupt: '") + error_log);
return;
}
if(savegame.child_or_empty("snapshot")["replay_pos"].to_int(-1) < 0 ) {
invalid_save_file(_("The file you have tried to load has no replay information. "));
return;
}
if(!playsingle_controller_.get_saved_game().get_replay().is_ancestor(savegame.child_or_empty("replay"))) {
invalid_save_file(_("The file you have tried to load is not from the current session"));
invalid_save_file(_("The file you have tried to load is not from the current session."));
return;
}