mirror of https://github.com/OpenTTD/OpenTTD
pull/9032/head
parent
e722ea89f0
commit
c4bccd4f70
|
@ -1351,7 +1351,9 @@ DEF_CONSOLE_CMD(ConRescanNewGRF)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
RequestNewGRFScan();
|
if (!RequestNewGRFScan()) {
|
||||||
|
IConsoleWarning("NewGRF scanning is already running. Please wait until completed to run again.");
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1450,11 +1450,15 @@ static void DoAutosave()
|
||||||
* done in the game-thread, and not in the draw-thread (which most often
|
* done in the game-thread, and not in the draw-thread (which most often
|
||||||
* triggers this request).
|
* triggers this request).
|
||||||
* @param callback Optional callback to call when NewGRF scan is completed.
|
* @param callback Optional callback to call when NewGRF scan is completed.
|
||||||
|
* @return True when the NewGRF scan was actually requested, false when the scan was already running.
|
||||||
*/
|
*/
|
||||||
void RequestNewGRFScan(NewGRFScanCallback *callback)
|
bool RequestNewGRFScan(NewGRFScanCallback *callback)
|
||||||
{
|
{
|
||||||
|
if (_request_newgrf_scan) return false;
|
||||||
|
|
||||||
_request_newgrf_scan = true;
|
_request_newgrf_scan = true;
|
||||||
_request_newgrf_scan_callback = callback;
|
_request_newgrf_scan_callback = callback;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameLoop()
|
void GameLoop()
|
||||||
|
|
|
@ -81,6 +81,6 @@ void HandleExitGameRequest();
|
||||||
|
|
||||||
void SwitchToMode(SwitchMode new_mode);
|
void SwitchToMode(SwitchMode new_mode);
|
||||||
|
|
||||||
void RequestNewGRFScan(struct NewGRFScanCallback *callback = nullptr);
|
bool RequestNewGRFScan(struct NewGRFScanCallback *callback = nullptr);
|
||||||
|
|
||||||
#endif /* OPENTTD_H */
|
#endif /* OPENTTD_H */
|
||||||
|
|
Loading…
Reference in New Issue