mirror of https://github.com/OpenTTD/OpenTTD.git
Fix: [Emscripten] config not saved on exit game (#11248)
When changing a Game Option and pressing Exit Game, the changes were not actually stored. This because the post-mainloop code was never executed for Emscripten.
This commit is contained in:
parent
2f96ccc18a
commit
502414b567
|
@ -459,6 +459,22 @@ struct AfterNewGRFScan : NewGRFScanCallback {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void PostMainLoop()
|
||||||
|
{
|
||||||
|
WaitTillSaved();
|
||||||
|
|
||||||
|
/* only save config if we have to */
|
||||||
|
if (_save_config) {
|
||||||
|
SaveToConfig();
|
||||||
|
SaveHotkeysToConfig();
|
||||||
|
WindowDesc::SaveToConfig();
|
||||||
|
SaveToHighScore();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Reset windowing system, stop drivers, free used memory, ... */
|
||||||
|
ShutdownGame();
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(UNIX)
|
#if defined(UNIX)
|
||||||
extern void DedicatedFork();
|
extern void DedicatedFork();
|
||||||
#endif
|
#endif
|
||||||
|
@ -785,18 +801,7 @@ int openttd_main(int argc, char *argv[])
|
||||||
|
|
||||||
VideoDriver::GetInstance()->MainLoop();
|
VideoDriver::GetInstance()->MainLoop();
|
||||||
|
|
||||||
WaitTillSaved();
|
PostMainLoop();
|
||||||
|
|
||||||
/* only save config if we have to */
|
|
||||||
if (_save_config) {
|
|
||||||
SaveToConfig();
|
|
||||||
SaveHotkeysToConfig();
|
|
||||||
WindowDesc::SaveToConfig();
|
|
||||||
SaveToHighScore();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Reset windowing system, stop drivers, free used memory, ... */
|
|
||||||
ShutdownGame();
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -607,6 +607,9 @@ void VideoDriver_SDL_Base::LoopOnce()
|
||||||
* normally done at the end of the main loop for non-Emscripten.
|
* normally done at the end of the main loop for non-Emscripten.
|
||||||
* After that, Emscripten just halts, and the HTML shows a nice
|
* After that, Emscripten just halts, and the HTML shows a nice
|
||||||
* "bye, see you next time" message. */
|
* "bye, see you next time" message. */
|
||||||
|
extern void PostMainLoop();
|
||||||
|
PostMainLoop();
|
||||||
|
|
||||||
emscripten_cancel_main_loop();
|
emscripten_cancel_main_loop();
|
||||||
emscripten_exit_pointerlock();
|
emscripten_exit_pointerlock();
|
||||||
/* In effect, the game ends here. As emscripten_set_main_loop() caused
|
/* In effect, the game ends here. As emscripten_set_main_loop() caused
|
||||||
|
|
Loading…
Reference in New Issue