summaryrefslogtreecommitdiff
path: root/src/newgrf_house.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-05-01 13:09:49 +0000
committerfrosch <frosch@openttd.org>2010-05-01 13:09:49 +0000
commit910aade284ef2b3212663c81f4e15e77b1c7120d (patch)
tree1975bbb8eeb58de9cd174667fc7f7654eee89d10 /src/newgrf_house.cpp
parent77953032274c3bb49c8b22ff7a2767412586c5a7 (diff)
downloadopenttd-910aade284ef2b3212663c81f4e15e77b1c7120d.tar.xz
(svn r19744) -Add [FS#3477]: [NewGRF] Access to random bits of houses and industries from construction callbacks 17, 28 and 2F. That is: The randombits the house/industry will start with, if construction succeeds.
Diffstat (limited to 'src/newgrf_house.cpp')
-rw-r--r--src/newgrf_house.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp
index 3ca62f5bd..4a80547c3 100644
--- a/src/newgrf_house.cpp
+++ b/src/newgrf_house.cpp
@@ -102,7 +102,7 @@ static uint32 HouseGetRandomBits(const ResolverObject *object)
/* Note: Towns build houses over houses. So during construction checks 'tile' may be a valid but unrelated house. */
TileIndex tile = object->u.house.tile;
assert(IsValidTile(tile) && (object->u.house.not_yet_constructed || IsTileType(tile, MP_HOUSE)));
- return object->u.house.not_yet_constructed ? 0 : GetHouseRandomBits(tile);
+ return object->u.house.not_yet_constructed ? object->u.house.initial_random_bits : GetHouseRandomBits(tile);
}
static uint32 HouseGetTriggers(const ResolverObject *object)
@@ -389,7 +389,7 @@ static void NewHouseResolver(ResolverObject *res, HouseID house_id, TileIndex ti
res->grffile = (hs != NULL ? hs->grffile : NULL);
}
-uint16 GetHouseCallback(CallbackID callback, uint32 param1, uint32 param2, HouseID house_id, Town *town, TileIndex tile, bool not_yet_constructed)
+uint16 GetHouseCallback(CallbackID callback, uint32 param1, uint32 param2, HouseID house_id, Town *town, TileIndex tile, bool not_yet_constructed, uint8 initial_random_bits)
{
ResolverObject object;
const SpriteGroup *group;
@@ -401,6 +401,7 @@ uint16 GetHouseCallback(CallbackID callback, uint32 param1, uint32 param2, House
object.callback_param1 = param1;
object.callback_param2 = param2;
object.u.house.not_yet_constructed = not_yet_constructed;
+ object.u.house.initial_random_bits = initial_random_bits;
group = SpriteGroup::Resolve(HouseSpec::Get(house_id)->spritegroup, &object);
if (group == NULL) return CALLBACK_FAILED;