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.
This commit is contained in:
peter1138
2019-03-10 17:45:15 +00:00
committed by Patric Stout
parent 3a97b541af
commit 38e93182c5
4 changed files with 24 additions and 4 deletions
+11
View File
@@ -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) {