summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-04-24 13:35:18 +0000
committerrubidium <rubidium@openttd.org>2010-04-24 13:35:18 +0000
commit1da0086a4537487e12d1ae3c0c9d57079349000d (patch)
tree1dad6fdf48230934b01963ae9af3a4157f889df9
parente75e2648fc5a9c741629ef1efc8a097c655ed035 (diff)
downloadopenttd-1da0086a4537487e12d1ae3c0c9d57079349000d.tar.xz
(svn r19707) -Add: helper functions to instantiate/fill ResolverObjects
-rw-r--r--src/newgrf_airporttiles.cpp9
-rw-r--r--src/newgrf_engine.cpp11
-rw-r--r--src/newgrf_house.cpp10
-rw-r--r--src/newgrf_industries.cpp11
-rw-r--r--src/newgrf_industrytiles.cpp10
-rw-r--r--src/newgrf_railtype.cpp10
-rw-r--r--src/newgrf_station.cpp10
7 files changed, 71 insertions, 0 deletions
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);
+}