summaryrefslogtreecommitdiff
path: root/src/newgrf_commons.cpp
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-06-21 17:09:10 +0000
committerbelugas <belugas@openttd.org>2007-06-21 17:09:10 +0000
commitad446daf3377edcb2b83eeefbb1bb72a30c63274 (patch)
treea326890bbd423a6826dfbcdb9b4536761258caa7 /src/newgrf_commons.cpp
parentf58ea51e2ae360a2ca920603dcf13acf559cee81 (diff)
downloadopenttd-ad446daf3377edcb2b83eeefbb1bb72a30c63274.tar.xz
(svn r10256) -Add: Addition of IndustryTileOverrideManager
Diffstat (limited to 'src/newgrf_commons.cpp')
-rw-r--r--src/newgrf_commons.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/newgrf_commons.cpp b/src/newgrf_commons.cpp
index 72567920e..6fc0103be 100644
--- a/src/newgrf_commons.cpp
+++ b/src/newgrf_commons.cpp
@@ -220,6 +220,29 @@ void IndustryOverrideManager::SetEntitySpec(const IndustrySpec *inds)
_industry_specs[ind_id].enabled = true;
}
+void IndustryTileOverrideManager::SetEntitySpec(const IndustryTileSpec *its)
+{
+ IndustryGfx indt_id = this->AddEntityID(its->grf_prop.local_id, its->grf_prop.grffile->grfid, its->grf_prop.subst_id);
+
+ if (indt_id == invalid_ID) {
+ grfmsg(1, "IndustryTile.SetEntitySpec: Too many industry tiles allocated. Ignoring.");
+ return;
+ }
+
+ memcpy(&_industry_tile_specs[indt_id], its, sizeof(*its));
+
+ /* Now add the overrides. */
+ for (int i = 0; i < max_offset; i++) {
+ IndustryTileSpec *overridden_its = &_industry_tile_specs[i];
+
+ if (entity_overrides[i] != its->grf_prop.local_id) continue;
+
+ overridden_its->grf_prop.override = indt_id;
+ overridden_its->enabled = false;
+ entity_overrides[i] = invalid_ID;
+ }
+}
+
/** Function used by houses (and soon industries) to get information
* on type of "terrain" the tile it is queries sits on.
* @param tile TileIndex of the tile been queried