summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-12-31 07:14:25 +0000
committerrubidium <rubidium@openttd.org>2007-12-31 07:14:25 +0000
commitb1be9f0137d3310f1853e725422e2f7c84c0725d (patch)
tree2125734bd38dc90ff3fe41dddb0f9b35a47b8bd4
parent8ee1faca6c8b4dbb13962c132fd9544dfee42ffa (diff)
downloadopenttd-b1be9f0137d3310f1853e725422e2f7c84c0725d.tar.xz
(svn r11728) -Fix [FS#1577]: if there are no houses that can be build in a specific year yet, force the houses with the earliest introduction year to be available.
-rw-r--r--src/newgrf.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index cacc67596..0cb9956d0 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -5326,8 +5326,11 @@ static void FinaliseHouseArray()
* compatible with TTDPatch, where if no houses have start dates before
* 1930 and the date is before 1930, the game pretends that this is 1930.
* If there have been any houses defined with start dates before 1930 then
- * the dates are left alone. */
- bool reset_dates = true;
+ * the dates are left alone.
+ * On the other hand, why 1930? Just 'fix' the houses with the lowest
+ * minimum introduction date to 0.
+ */
+ Year min_date = MAX_YEAR;
for (GRFFile *file = _first_grffile; file != NULL; file = file->next) {
if (file->housespec == NULL) continue;
@@ -5336,16 +5339,16 @@ static void FinaliseHouseArray()
HouseSpec *hs = file->housespec[i];
if (hs != NULL) {
_house_mngr.SetEntitySpec(hs);
- if (hs->min_date < 1930) reset_dates = false;
+ if (hs->min_date < min_date) min_date = hs->min_date;
}
}
}
- if (reset_dates) {
- for (int i = NEW_HOUSE_OFFSET; i < HOUSE_MAX; i++) {
+ if (min_date != 0) {
+ for (int i = 0; i < HOUSE_MAX; i++) {
HouseSpec *hs = GetHouseSpecs(i);
- if (hs->enabled && hs->min_date == 1930) hs->min_date = 0;
+ if (hs->enabled && hs->min_date == min_date) hs->min_date = 0;
}
}
}