From 1da0086a4537487e12d1ae3c0c9d57079349000d Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 24 Apr 2010 13:35:18 +0000 Subject: (svn r19707) -Add: helper functions to instantiate/fill ResolverObjects --- src/newgrf_airporttiles.cpp | 9 +++++++++ src/newgrf_engine.cpp | 11 +++++++++++ src/newgrf_house.cpp | 10 ++++++++++ src/newgrf_industries.cpp | 11 +++++++++++ src/newgrf_industrytiles.cpp | 10 ++++++++++ src/newgrf_railtype.cpp | 10 ++++++++++ src/newgrf_station.cpp | 10 ++++++++++ 7 files changed, 71 insertions(+) (limited to 'src') diff --git a/src/newgrf_airporttiles.cpp b/src/newgrf_airporttiles.cpp index ec85c26fb..520438c5a 100644 --- a/src/newgrf_airporttiles.cpp +++ b/src/newgrf_airporttiles.cpp @@ -406,3 +406,12 @@ void AirportAnimationTrigger(Station *st, AirpAnimationTrigger trigger, CargoID } } +/** + * Resolve an airport tile's spec and such so we can get a variable. + * @param ro The resolver object to fill. + * @param index The airport tile to get the data from. + */ +void GetAirportTileTypeResolver(ResolverObject *ro, uint index) +{ + AirportTileResolver(ro, GetAirportGfx(index), index, Station::GetByTile(index)); +} diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index e3852fe80..3ae9244f1 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -1188,3 +1188,14 @@ void CommitVehicleListOrderChanges() /* Clear out the queue */ _list_order_changes.Reset(); } + +/** + * Resolve an engine's spec and such so we can get a variable. + * @param ro The resolver object to fill. + * @param index The vehicle to get the data from. + */ +void GetVehicleResolver(ResolverObject *ro, uint index) +{ + Vehicle *v = Vehicle::Get(index); + NewVehicleResolver(ro, v->engine_type, v); +} diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp index 3ea73c4cd..1f53e2c73 100644 --- a/src/newgrf_house.cpp +++ b/src/newgrf_house.cpp @@ -656,3 +656,13 @@ void TriggerHouse(TileIndex t, HouseTrigger trigger) { DoTriggerHouse(t, trigger, 0, true); } + +/** + * Resolve a house's spec and such so we can get a variable. + * @param ro The resolver object to fill. + * @param index The house tile to get the data from. + */ +void GetHouseResolver(ResolverObject *ro, uint index) +{ + NewHouseResolver(ro, GetHouseType(index), index, Town::GetByTile(index)); +} diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp index ee7eaf4ef..467879c73 100644 --- a/src/newgrf_industries.cpp +++ b/src/newgrf_industries.cpp @@ -563,3 +563,14 @@ void IndustryProductionCallback(Industry *ind, int reason) SetWindowDirty(WC_INDUSTRY_VIEW, ind->index); } + +/** + * Resolve a industry's spec and such so we can get a variable. + * @param ro The resolver object to fill. + * @param index The industry ID to get the data from. + */ +void GetIndustryResolver(ResolverObject *ro, uint index) +{ + Industry *i = Industry::Get(index); + NewIndustryResolver(ro, i->location.tile, i, i->type); +} diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp index bc07ed72a..4ffdd2600 100644 --- a/src/newgrf_industrytiles.cpp +++ b/src/newgrf_industrytiles.cpp @@ -430,3 +430,13 @@ void TriggerIndustry(Industry *ind, IndustryTileTrigger trigger) } } } + +/** + * Resolve a industry tile's spec and such so we can get a variable. + * @param ro The resolver object to fill. + * @param index The industry tile to get the data from. + */ +void GetIndustryTileResolver(ResolverObject *ro, uint index) +{ + NewIndustryTileResolver(ro, GetIndustryGfx(index), index, Industry::GetByTile(index)); +} diff --git a/src/newgrf_railtype.cpp b/src/newgrf_railtype.cpp index 931f544e9..4a40d6605 100644 --- a/src/newgrf_railtype.cpp +++ b/src/newgrf_railtype.cpp @@ -113,3 +113,13 @@ uint8 GetReverseRailTypeTranslation(RailType railtype, const GRFFile *grffile) /* If not found, return as invalid */ return 0xFF; } + +/** + * Resolve a railtypes's spec and such so we can get a variable. + * @param ro The resolver object to fill. + * @param index The rail tile to get the data from. + */ +void GetRailTypeResolver(ResolverObject *ro, uint index) +{ + NewRailTypeResolver(ro, index); +} diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index 0f4973da4..56e8a5d48 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -1081,3 +1081,13 @@ void StationUpdateAnimTriggers(BaseStation *st) if (ss != NULL) st->cached_anim_triggers |= ss->anim_triggers; } } + +/** + * Resolve a station's spec and such so we can get a variable. + * @param ro The resolver object to fill. + * @param index The station to get the data from. + */ +void GetStationResolver(ResolverObject *ro, uint index) +{ + NewStationResolver(ro, GetStationSpec(index), Station::GetByTile(index), index); +} -- cgit v1.2.3-54-g00ecf