summaryrefslogtreecommitdiff
path: root/src/newgrf_airport.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-11-08 17:24:43 +0000
committerfrosch <frosch@openttd.org>2011-11-08 17:24:43 +0000
commitd8f8909f859eb900ceaf8897537b2f46d970b308 (patch)
tree6a7c1eec6508195356926d1859b78305f959aafb /src/newgrf_airport.cpp
parentcd029465e1d6413453cb16224d5000fa9689fa79 (diff)
downloadopenttd-d8f8909f859eb900ceaf8897537b2f46d970b308.tar.xz
(svn r23142) -Change: [NewGRF v8] Unify the return values of callbacks returning D0xx texts.
Diffstat (limited to 'src/newgrf_airport.cpp')
-rw-r--r--src/newgrf_airport.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/newgrf_airport.cpp b/src/newgrf_airport.cpp
index 05e54ab23..9137bf865 100644
--- a/src/newgrf_airport.cpp
+++ b/src/newgrf_airport.cpp
@@ -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);
}