mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-13 07:10:57 +00:00
(svn r20371) -Codechange: add general function to call text callbacks for airports
This commit is contained in:
parent
f9f141c480
commit
7c2eaeee09
@ -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());
|
||||
}
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user