mirror of https://github.com/OpenTTD/OpenTTD.git
Fix: abort GRFFileScanner on exiting the game as soon as possible
This prevents the window from "freezing" when you close it during the scanning of NewGRFs, as it first would continue the action.
This commit is contained in:
parent
b349ef6e71
commit
5426cb3baf
|
@ -603,6 +603,9 @@ public:
|
|||
|
||||
bool GRFFileScanner::AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename)
|
||||
{
|
||||
/* Abort if the user stopped the game during a scan. */
|
||||
if (_exit_game) return false;
|
||||
|
||||
GRFConfig *c = new GRFConfig(filename.c_str() + basepath_length);
|
||||
|
||||
bool added = true;
|
||||
|
@ -702,7 +705,7 @@ void DoScanNewGRFFiles(NewGRFScanCallback *callback)
|
|||
/* Yes... these are the NewGRF windows */
|
||||
InvalidateWindowClassesData(WC_SAVELOAD, 0, true);
|
||||
InvalidateWindowData(WC_GAME_OPTIONS, WN_GAME_OPTIONS_NEWGRF_STATE, GOID_NEWGRF_RESCANNED, true);
|
||||
if (callback != nullptr) callback->OnNewGRFsScanned();
|
||||
if (!_exit_game && callback != nullptr) callback->OnNewGRFsScanned();
|
||||
|
||||
DeleteWindowByClass(WC_MODAL_PROGRESS);
|
||||
SetModalProgress(false);
|
||||
|
|
|
@ -1469,6 +1469,8 @@ void GameLoop()
|
|||
ScanNewGRFFiles(_request_newgrf_scan_callback);
|
||||
_request_newgrf_scan = false;
|
||||
_request_newgrf_scan_callback = nullptr;
|
||||
/* In case someone closed the game during our scan, don't do anything else. */
|
||||
if (_exit_game) return;
|
||||
}
|
||||
|
||||
ProcessAsyncSaveFinish();
|
||||
|
|
Loading…
Reference in New Issue