summaryrefslogtreecommitdiff
path: root/src/object_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-11-08 17:27:13 +0000
committerfrosch <frosch@openttd.org>2011-11-08 17:27:13 +0000
commit52774235eb6eb8affb7e68b94c490d3f09e7ae31 (patch)
treeaf07d5b6df28b5c9fdcef94e0f67ecec290e1764 /src/object_cmd.cpp
parent30874b5e81af0fff2f42d34b9b105ee86666b8ac (diff)
downloadopenttd-52774235eb6eb8affb7e68b94c490d3f09e7ae31.tar.xz
(svn r23148) -Change: [NewGRF] Check the results of various callbacks for validness.
Diffstat (limited to 'src/object_cmd.cpp')
-rw-r--r--src/object_cmd.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp
index 44b221457..32618d9ff 100644
--- a/src/object_cmd.cpp
+++ b/src/object_cmd.cpp
@@ -93,7 +93,10 @@ void BuildObject(ObjectType type, TileIndex tile, CompanyID owner, Town *town, u
if (HasBit(spec->callback_mask, CBM_OBJ_COLOUR)) {
uint16 res = GetObjectCallback(CBID_OBJECT_COLOUR, o->colour, 0, spec, o, tile);
- if (res != CALLBACK_FAILED) o->colour = GB(res, 0, 8);
+ if (res != CALLBACK_FAILED) {
+ if (res >= 0x100) ErrorUnknownCallbackResult(spec->grf_prop.grffile->grfid, CBID_OBJECT_COLOUR, res);
+ o->colour = GB(res, 0, 8);
+ }
}
assert(o->town != NULL);