summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-10-02 17:48:17 +0000
committerrubidium <rubidium@openttd.org>2007-10-02 17:48:17 +0000
commit8c25b4575c828af45409ace10a9e63c88a7cef7e (patch)
tree5ad529739c93f90c6f18d14cc219a90421a3090d /src
parent5093d8b1cdb5438c5c021cc015ef8dba665e7cd1 (diff)
downloadopenttd-8c25b4575c828af45409ace10a9e63c88a7cef7e.tar.xz
(svn r11194) -Fix: industries with not all tiles custom slope checked (but at least one) would be build on wrongly sloped tiles.
Diffstat (limited to 'src')
-rw-r--r--src/industry_cmd.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index c8ce02be0..2f438cfa8 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -1198,6 +1198,8 @@ bool IsSlopeRefused(Slope current, Slope refused)
static bool CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable *it, uint itspec_index, int type, bool *custom_shape_check = NULL)
{
_error_message = STR_0239_SITE_UNSUITABLE;
+ bool refused_slope = false;
+ bool custom_shape = false;
do {
IndustryGfx gfx = GetTranslatedIndustryTileID(it->gfx);
@@ -1222,7 +1224,7 @@ static bool CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable
IndustyBehaviour ind_behav = GetIndustrySpec(type)->behaviour;
if (HASBIT(its->callback_flags, CBM_INDT_SHAPE_CHECK)) {
- if (custom_shape_check != NULL) *custom_shape_check = true;
+ custom_shape = true;
if (!PerformIndustryTileSlopeCheck(tile, cur_tile, its, type, gfx, itspec_index)) return false;
} else {
if (ind_behav & INDUSTRYBEH_BUILT_ONWATER) {
@@ -1238,12 +1240,7 @@ static bool CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable
tileh = GetTileSlope(cur_tile, NULL);
if (IsSteepSlope(tileh)) return false;
- if (_patches.land_generator != LG_TERRAGENESIS || !_generating_world) {
- /* It is almost impossible to have a fully flat land in TG, so what we
- * do is that we check if we can make the land flat later on. See
- * CheckIfCanLevelIndustryPlatform(). */
- if (IsSlopeRefused(tileh, its->slopes_refused)) return false;
- }
+ refused_slope |= IsSlopeRefused(tileh, its->slopes_refused);
}
}
@@ -1259,7 +1256,12 @@ static bool CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable
}
} while ((++it)->ti.x != -0x80);
- return true;
+ if (custom_shape_check != NULL) *custom_shape_check = custom_shape;
+
+ /* It is almost impossible to have a fully flat land in TG, so what we
+ * do is that we check if we can make the land flat later on. See
+ * CheckIfCanLevelIndustryPlatform(). */
+ return !refused_slope || (_patches.land_generator == LG_TERRAGENESIS && _generating_world && !custom_shape);
}
static bool CheckIfIndustryIsAllowed(TileIndex tile, int type, const Town *t)