(svn r23142) -Change: [NewGRF v8] Unify the return values of callbacks returning D0xx texts.

This commit is contained in:
frosch
2011-11-08 17:24:43 +00:00
parent c0fd4aec7f
commit 6365d92776
9 changed files with 140 additions and 59 deletions

View File

@@ -273,7 +273,12 @@ StringID GetAirportTextCallback(const AirportSpec *as, byte layout, uint16 callb
object.callback = (CallbackID)callback;
group = SpriteGroup::Resolve(as->grf_prop.spritegroup[0], &object);
if (group == NULL) return STR_UNDEFINED;
uint16 cb_res = (group != NULL) ? group->GetCallbackResult() : CALLBACK_FAILED;
if (cb_res == CALLBACK_FAILED || cb_res == 0x400) return STR_UNDEFINED;
if (cb_res > 0x400) {
ErrorUnknownCallbackResult(as->grf_prop.grffile->grfid, callback, cb_res);
return STR_UNDEFINED;
}
return GetGRFStringID(as->grf_prop.grffile->grfid, 0xD000 + group->GetCallbackResult());
return GetGRFStringID(as->grf_prop.grffile->grfid, 0xD000 + cb_res);
}