summaryrefslogtreecommitdiff
path: root/src/newgrf_house.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2014-03-03 20:02:31 +0000
committerfrosch <frosch@openttd.org>2014-03-03 20:02:31 +0000
commit6b61c4608fab00c7bfc78c296b3c85f611681f59 (patch)
tree9919983ecf008602a497445b2b3e05b5c32892b8 /src/newgrf_house.cpp
parentb935cb84156f18b51196288ff6d12f8ca5b26630 (diff)
downloadopenttd-6b61c4608fab00c7bfc78c296b3c85f611681f59.tar.xz
(svn r26388) -Codechange: Move resolving of Action 3 into ResolverObject constructor.
Diffstat (limited to 'src/newgrf_house.cpp')
-rw-r--r--src/newgrf_house.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp
index a31ac4bc4..c660fe3ab 100644
--- a/src/newgrf_house.cpp
+++ b/src/newgrf_house.cpp
@@ -81,6 +81,7 @@ HouseResolverObject::HouseResolverObject(HouseID house_id, TileIndex tile, Town
house_scope(*this, house_id, tile, town, not_yet_constructed, initial_random_bits, watched_cargo_triggers),
town_scope(*this, town, not_yet_constructed) // Don't access StorePSA if house is not yet constructed.
{
+ this->root_spritegroup = HouseSpec::Get(house_id)->grf_prop.spritegroup[0];
}
HouseClassID AllocateHouseClassID(byte grf_class_id, uint32 grfid)
@@ -439,11 +440,7 @@ uint16 GetHouseCallback(CallbackID callback, uint32 param1, uint32 param2, House
HouseResolverObject object(house_id, tile, town, callback, param1, param2,
not_yet_constructed, initial_random_bits, watched_cargo_triggers);
-
- const SpriteGroup *group = SpriteGroup::Resolve(HouseSpec::Get(house_id)->grf_prop.spritegroup[0], object);
- if (group == NULL) return CALLBACK_FAILED;
-
- return group->GetCallbackResult();
+ return object.ResolveCallback();
}
static void DrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, byte stage, HouseID house_id)
@@ -490,7 +487,7 @@ void DrawNewHouseTile(TileInfo *ti, HouseID house_id)
HouseResolverObject object(house_id, ti->tile, Town::GetByTile(ti->tile));
- const SpriteGroup *group = SpriteGroup::Resolve(hs->grf_prop.spritegroup[0], object);
+ const SpriteGroup *group = object.Resolve();
if (group != NULL && group->type == SGT_TILELAYOUT) {
/* Limit the building stage to the number of stages supplied. */
const TileLayoutSpriteGroup *tlgroup = (const TileLayoutSpriteGroup *)group;
@@ -615,7 +612,7 @@ static void DoTriggerHouse(TileIndex tile, HouseTrigger trigger, byte base_rando
HouseResolverObject object(hid, tile, Town::GetByTile(tile), CBID_RANDOM_TRIGGER);
object.trigger = trigger;
- const SpriteGroup *group = SpriteGroup::Resolve(hs->grf_prop.spritegroup[0], object);
+ const SpriteGroup *group = object.Resolve();
if (group == NULL) return;
byte new_random_bits = Random();