diff options
author | peter1138 <peter1138@openttd.org> | 2019-03-10 17:45:15 +0000 |
---|---|---|
committer | PeterN <peter@fuzzle.org> | 2019-03-15 17:43:10 +0000 |
commit | fc5f67123acfd977cd74d5e5a8d2d13a049b357a (patch) | |
tree | 9b6b901add621a3c38d5f6fb3e15c44205b79b3c /src/newgrf_industries.cpp | |
parent | b00a861467b9c7ea62bae2df140975f0838e0ea7 (diff) | |
download | openttd-fc5f67123acfd977cd74d5e5a8d2d13a049b357a.tar.xz |
Fix e66cec8f86: Permit loading of industry production callback with invalid cargo type.
It is only an error if the invalid result is actually used. This will be silently ignored at the moment.
It is still an error if a duplicate cargo type is returned.
Diffstat (limited to 'src/newgrf_industries.cpp')
-rw-r--r-- | src/newgrf_industries.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp index de388c023..980059cab 100644 --- a/src/newgrf_industries.cpp +++ b/src/newgrf_industries.cpp @@ -605,6 +605,17 @@ void IndustryProductionCallback(Industry *ind, int reason) if (tgroup == NULL || tgroup->type != SGT_INDUSTRY_PRODUCTION) break; const IndustryProductionSpriteGroup *group = (const IndustryProductionSpriteGroup *)tgroup; + if (group->version == 0xFF) { + /* Result was marked invalid on load, display error message */ + SetDParamStr(0, spec->grf_prop.grffile->filename); + SetDParam(1, spec->name); + SetDParam(2, ind->location.tile); + ShowErrorMessage(STR_NEWGRF_BUGGY, STR_NEWGRF_BUGGY_INVALID_CARGO_PRODUCTION_CALLBACK, WL_WARNING); + + /* abort the function early, this error isn't critical and will allow the game to continue to run */ + break; + } + bool deref = (group->version >= 1); if (group->version < 2) { |