summaryrefslogtreecommitdiff
path: root/src/newgrf.cpp
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-05-31 03:35:11 +0000
committerbelugas <belugas@openttd.org>2007-05-31 03:35:11 +0000
commit86abe1b2292b8e1fa9c4f86febb16dddff1b5334 (patch)
tree2dd2ec04eec4148229713d68a20df23574978418 /src/newgrf.cpp
parent8d82deffa1a46b9205e220865a27b1d46c0455cb (diff)
downloadopenttd-86abe1b2292b8e1fa9c4f86febb16dddff1b5334.tar.xz
(svn r9994) -Codechange: Add pointers for Industry and Industry Tiles in the grf file.
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r--src/newgrf.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index d16bd0676..0ba3aa846 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -4304,6 +4304,43 @@ static void ResetCustomHouses()
}
}
+static void ResetCustomIndustries()
+{
+ GRFFile *file;
+
+ for (file = _first_grffile; file != NULL; file = file->next) {
+ uint i;
+ /* We are verifiying both tiles and industries specs loaded from the grf file
+ * First, let's deal with industryspec */
+ if (file->industryspec != NULL) {
+
+ for (i = 0; i < NUM_INDUSTRYTYPES; i++) {
+ IndustrySpec *ind = file->industryspec[i];
+
+ if (ind != NULL) {
+ free(ind);
+ ind = NULL;
+ }
+ }
+
+ free(file->industryspec);
+ file->industryspec = NULL;
+ }
+
+ if (file->indtspec != NULL) {
+ for (i = 0; i < NUM_INDUSTRYTILES; i++) {
+ if (file->indtspec[i] != NULL) {
+ free(file->indtspec[i]);
+ file->indtspec[i] = NULL;
+ }
+ }
+
+ free(file->indtspec);
+ file->indtspec = NULL;
+ }
+ }
+}
+
static void ResetNewGRF()
{
GRFFile *next;
@@ -4370,6 +4407,7 @@ static void ResetNewGRFData()
ResetHouses();
/* Reset the industries structures*/
+ ResetCustomIndustries();
ResetIndustries();
/* Reset station classes */