diff options
author | rubidium <rubidium@openttd.org> | 2010-08-28 18:50:32 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-08-28 18:50:32 +0000 |
commit | ee8c37c3d9fb5b62e24b0272fd93cd50acaa80f6 (patch) | |
tree | b622998fd46c759e6be6dfc9c202ba43af79da73 /src | |
parent | 852bde0bad87b0aab2f8e70688989c76a4c34480 (diff) | |
download | openttd-ee8c37c3d9fb5b62e24b0272fd93cd50acaa80f6.tar.xz |
(svn r20661) -Codechange: implement the "decide colour" callback for objects
Diffstat (limited to 'src')
-rw-r--r-- | src/newgrf_callbacks.h | 2 | ||||
-rw-r--r-- | src/object_cmd.cpp | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/newgrf_callbacks.h b/src/newgrf_callbacks.h index 3cdd6abb0..4dcc24d5a 100644 --- a/src/newgrf_callbacks.h +++ b/src/newgrf_callbacks.h @@ -265,7 +265,7 @@ enum CallbackID { CBID_OBJECT_ANIMATION_SPEED = 0x15A, // 8 bit callback, not implemented /** Called to determine the colour of a town building. */ - CBID_OBJECT_COLOUR = 0x15B, // 15 bit callback, not implemented + CBID_OBJECT_COLOUR = 0x15B, // 15 bit callback /** Called to determine more text in the fund object window */ CBID_OBJECT_FUND_MORE_TEXT = 0x15C, // 15 bit callback, not implemented diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp index 29564f8fe..c4f17f576 100644 --- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -75,6 +75,11 @@ void BuildObject(ObjectType type, TileIndex tile, CompanyID owner, Town *town) /* If the object wants only one colour, then give it that colour. */ if ((spec->flags & OBJECT_FLAG_2CC_COLOUR) == 0) o->colour &= 0xF; + 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); + } + assert(o->town != NULL); TILE_AREA_LOOP(t, ta) { |