diff options
author | rubidium <rubidium@openttd.org> | 2007-10-02 17:48:17 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-10-02 17:48:17 +0000 |
commit | 2b56d112760b44552d4a0149fd0a6846be678913 (patch) | |
tree | 5ad529739c93f90c6f18d14cc219a90421a3090d /src | |
parent | 531fe3e07012670f56eaaf59f85a0ad99208c032 (diff) | |
download | openttd-2b56d112760b44552d4a0149fd0a6846be678913.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.cpp | 18 |
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) |