summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-07-06 20:40:58 +0000
committerbelugas <belugas@openttd.org>2007-07-06 20:40:58 +0000
commit7c2b43267045fec33c66c9d7c3372298b1f56848 (patch)
treea1b97d69f35d1870e4cce862ad69518620e2c62a /src
parent26a7f3df84b32853a47208c42c63c0069ae4ec08 (diff)
downloadopenttd-7c2b43267045fec33c66c9d7c3372298b1f56848.tar.xz
(svn r10457) -Codechange: Load the newly read definitions of Industries and Industry tiles.
No, this is not the final commit for newindustries (far from it), just another step.
Diffstat (limited to 'src')
-rw-r--r--src/newgrf.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index c4a4895a4..e835a3e83 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -4770,6 +4770,33 @@ static void FinaliseHouseArray()
}
}
+/** Add all new industries to the industry array. Industry properties can be set at any
+ * time in the GRF file, so we can only add a industry spec to the industry array
+ * after the file has finished loading. */
+static void FinaliseIndustriesArray()
+{
+ for (GRFFile *file = _first_grffile; file != NULL; file = file->next) {
+ if (file->industryspec != NULL) {
+ for (int i = 0; i < NUM_INDUSTRYTYPES; i++) {
+ IndustrySpec *indsp = file->industryspec[i];
+
+ if (indsp != NULL && indsp->enabled) {
+ _industry_mngr.SetEntitySpec(indsp);
+ _loaded_newgrf_features.has_newindustries = true;
+ }
+ }
+ }
+
+ if (file->indtspec != NULL) {
+ for (int i = 0; i < NUM_INDUSTRYTILES; i++) {
+ IndustryTileSpec *indtsp = file->indtspec[i];
+ if (indtsp != NULL) {
+ _industile_mngr.SetEntitySpec(indtsp);
+ }
+ }
+ }
+ }
+}
/** Each cargo string needs to be mapped from TTDPatch to OpenTTD string IDs.
* This is done after loading so that strings from Action 4 will be mapped
@@ -4976,6 +5003,9 @@ static void AfterLoadGRFs()
/* Add all new houses to the house array. */
FinaliseHouseArray();
+ /* Add all new industries to the industry array. */
+ FinaliseIndustriesArray();
+
/* Create dynamic list of industry legends for smallmap_gui.cpp */
BuildIndustriesLegend();