changeset 15081:961ab6166e79 draft

(svn r19707) -Add: helper functions to instantiate/fill ResolverObjects
author rubidium <rubidium@openttd.org>
date Sat, 24 Apr 2010 13:35:18 +0000
parents 5eeefe395a96
children b9c35ad9b9f8
files src/newgrf_airporttiles.cpp src/newgrf_engine.cpp src/newgrf_house.cpp src/newgrf_industries.cpp src/newgrf_industrytiles.cpp src/newgrf_railtype.cpp src/newgrf_station.cpp
diffstat 7 files changed, 71 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/newgrf_airporttiles.cpp
+++ b/src/newgrf_airporttiles.cpp
@@ -406,3 +406,12 @@
 	}
 }
 
+/**
+ * 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));
+}
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -1188,3 +1188,14 @@
 	/* 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);
+}
--- a/src/newgrf_house.cpp
+++ b/src/newgrf_house.cpp
@@ -656,3 +656,13 @@
 {
 	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));
+}
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -563,3 +563,14 @@
 
 	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);
+}
--- a/src/newgrf_industrytiles.cpp
+++ b/src/newgrf_industrytiles.cpp
@@ -430,3 +430,13 @@
 		}
 	}
 }
+
+/**
+ * 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));
+}
--- a/src/newgrf_railtype.cpp
+++ b/src/newgrf_railtype.cpp
@@ -113,3 +113,13 @@
 	/* 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);
+}
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -1081,3 +1081,13 @@
 		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);
+}