Skip to content

Commit

Permalink
Merge pull request #1235 from Nivaturimika/newgamescave
Browse files Browse the repository at this point in the history
When a savefile fails to load, load a new game from a scenario as a fallback
  • Loading branch information
schombert authored Apr 7, 2024
2 parents f33848c + 41ee60f commit 3d5c094
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/gui/gui_nation_picker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,22 @@ class select_save_game : public button_element_base {
if(i->is_new_game) {
if(!sys::try_read_scenario_as_save_file(state, state.loaded_scenario_file)) {
auto msg = std::string("Scenario file ") + simple_fs::native_to_utf8(state.loaded_scenario_file) + " could not be loaded.";
ui::popup_error_window(state, "Save Error", msg);
ui::popup_error_window(state, "Scenario Error", msg);
} else {
loaded = true;
}
} else {
if(!sys::try_read_save_file(state, i->file_name)) {
auto msg = std::string("Save file ") + simple_fs::native_to_utf8(i->file_name) + " could not be loaded.";
ui::popup_error_window(state, "Save Error", msg);
state.save_list_updated.store(true, std::memory_order::release); //update savefile list
//try loading save from scenario so we atleast have something to work on
if(!sys::try_read_scenario_as_save_file(state, state.loaded_scenario_file)) {
auto msg2 = std::string("Scenario file ") + simple_fs::native_to_utf8(state.loaded_scenario_file) + " could not be loaded.";
ui::popup_error_window(state, "Scenario Error", msg2);
} else {
loaded = true;
}
} else {
loaded = true;
}
Expand Down

0 comments on commit 3d5c094

Please sign in to comment.