(svn r20371) -Codechange: add general function to call text callbacks for airports

This commit is contained in:
yexo 2010-08-05 12:04:33 +00:00
parent f9f141c480
commit 7c2eaeee09
2 changed files with 16 additions and 0 deletions

View File

@ -349,3 +349,17 @@ uint16 GetAirportCallback(CallbackID callback, uint32 param1, uint32 param2, Sta
return group->GetCallbackResult();
}
StringID GetAirportTextCallback(const AirportSpec *as, byte layout, uint16 callback)
{
const SpriteGroup *group;
ResolverObject object;
NewAirportResolver(&object, INVALID_TILE, NULL, as->GetIndex(), layout);
object.callback = (CallbackID)callback;
group = SpriteGroup::Resolve(as->grf_prop.spritegroup, &object);
if (group == NULL) return STR_UNDEFINED;
return GetGRFStringID(as->grf_prop.grffile->grfid, 0xD000 + group->GetResult());
}

View File

@ -117,4 +117,6 @@ uint GetNumAirportsInClass(AirportClassID id);
void BindAirportSpecs();
const AirportSpec *GetAirportSpecFromClass(AirportClassID aclass, uint airport);
StringID GetAirportTextCallback(const AirportSpec *as, byte layout, uint16 callback);
#endif /* NEWGRF_AIRPORT_H */