summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/newgrf_airport.cpp14
-rw-r--r--src/newgrf_airport.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/src/newgrf_airport.cpp b/src/newgrf_airport.cpp
index 20533bc67..d077ae14f 100644
--- a/src/newgrf_airport.cpp
+++ b/src/newgrf_airport.cpp
@@ -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());
+}
diff --git a/src/newgrf_airport.h b/src/newgrf_airport.h
index 20c6aa046..a20be0f54 100644
--- a/src/newgrf_airport.h
+++ b/src/newgrf_airport.h
@@ -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 */