Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Bugfixes "Restored quickload to working order"
Purpose of change
This PR fixes the quickload function (currently crashes) and enables it in release builds under the debug menu, and adds the same warning as the "Quit without saving" option. This would also be especially helpful for development.
This also happens to fix #38557.
Describe the solution
Rather than attempting to call the functions to load the game directly, as the current implementation does, this simply loads the world as if the user exited to the menu and immediately loaded the world again. This means the cleanup code from exiting will also run, unlike the current implementation which is missing some.
For this PR, on quickloading, the current world and player save is queued to load the next time the main menu is entered. Then the game exits to the main menu but loads the world immediately. Because of this the data files still need to go through the loading/validating process, but this is also the case for the current implementation.
The cli option
--world
has also been changed to use this queue rather than being part of the main loop as an if statement.Describe alternatives you've considered
Loading the world again without simulating exiting and loading the world from nothing would be best, but is infeasible. I could not get it to work. This would also likely add a lot of duplicated code from the necessary cleanup.
Before using the main menu, I also tried using the current implementation of the cli
--world
option's method to load the world (g->load
in the main loop before menu) after running cleanup code. This worked, but segfaulted after a couple of quickloads. This also implies that there may be some problem with the current implementation of the cli--world
option.Testing
Tested only on Linux.
--world
option.Additional context