summaryrefslogtreecommitdiff
path: root/src/openttd.cpp
diff options
context:
space:
mode:
authorrubidium42 <rubidium42@users.noreply.github.com>2021-04-12 20:53:04 +0200
committerGitHub <noreply@github.com>2021-04-12 20:53:04 +0200
commitc4bccd4f70cc369d5b3867f8dac74b0ac1d9ea5c (patch)
tree0f799c0cc08012d4d1e1fcfc3469a11e77fc87ab /src/openttd.cpp
parente722ea89f0ebda60fd251ee2ba33635df367acd4 (diff)
downloadopenttd-c4bccd4f70cc369d5b3867f8dac74b0ac1d9ea5c.tar.xz
Fix #8874: show a warning when a NewGRF scan is requested multiple times from the console (#9022)
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r--src/openttd.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 250aa0db3..4d820d4db 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -1450,11 +1450,15 @@ static void DoAutosave()
* done in the game-thread, and not in the draw-thread (which most often
* triggers this request).
* @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_callback = callback;
+ return true;
}
void GameLoop()