summaryrefslogtreecommitdiff
path: root/src/industry_cmd.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-11-13 15:15:25 +0000
committeralberth <alberth@openttd.org>2010-11-13 15:15:25 +0000
commitf22fb0d53db43e1e9ebeeda01ba8948656d537af (patch)
treec27fbb704848e8a5ed7f2956be0b2b3ace243c9f /src/industry_cmd.cpp
parent4d419b9f3e058be20f62e494829e8ae1b167e82b (diff)
downloadopenttd-f22fb0d53db43e1e9ebeeda01ba8948656d537af.tar.xz
(svn r21171) -Change: Reset industry build data at game start or load.
Diffstat (limited to 'src/industry_cmd.cpp')
-rw-r--r--src/industry_cmd.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index df240f0b6..cc00755eb 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -1955,6 +1955,22 @@ static void PlaceInitialIndustry(IndustryType type, bool try_hard)
cur_company.Restore();
}
+
+/** Reset the entry. */
+void IndustryTypeBuildData::Reset()
+{
+ this->probability = 0;
+ this->target_count = 0;
+}
+
+/** Completely reset the industry build data. */
+void IndustryBuildData::Reset()
+{
+ for (IndustryType it = 0; it < NUM_INDUSTRYTYPES; it++) {
+ this->builddata[it].Reset();
+ }
+}
+
/**
* This function will create random industries during game creation.
* It will scale the amount of industries by mapsize and difficulty level.
@@ -2005,6 +2021,7 @@ void GenerateIndustries()
assert(industry_probs[it] > 0);
PlaceInitialIndustry(it, false);
}
+ _industry_builder.Reset();
}
/**
@@ -2541,6 +2558,8 @@ void InitializeIndustries()
Industry::ResetIndustryCounts();
_industry_sound_tile = 0;
+
+ _industry_builder.Reset();
}
bool IndustrySpec::IsRawIndustry() const