From d19c347fd07f1a1c5d460eec7f29cdb465772b3c Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 31 May 2008 22:43:42 +0000 Subject: (svn r13348) -Fix: an industry does not always need foundations; in the case of NewGRFs an industry can be built on a steep slope, however when 'querying' the foundation type of an industry we neglected the fact that these steep slope tiles do not have a foundation. As a result of this when one built a structure requiring foundations on a tile SW or SE of a steep slope industry tile it would try to apply the foundation on the steep slope to determine whether to draw the wall of the foundation and trigger an assert. --- src/industry_cmd.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 2ae199d40..0bf658cdc 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -334,6 +334,20 @@ static uint GetSlopeZ_Industry(TileIndex tile, uint x, uint y) static Foundation GetFoundation_Industry(TileIndex tile, Slope tileh) { + IndustryGfx gfx = GetIndustryGfx(tile); + + /* For NewGRF industry tiles we might not be drawing a foundation. We need to + * account for this, otherwise we might be applying a FOUNDATION_LEVELED + * on a steep slope which is not allowed. Furthermore other structures should + * draw the wall of the foundation in this case. + */ + if (gfx >= NEW_INDUSTRYTILEOFFSET) { + const IndustryTileSpec *indts = GetIndustryTileSpec(gfx); + if (indts->grf_prop.spritegroup != NULL && HasBit(indts->callback_flags, CBM_INDT_DRAW_FOUNDATIONS)) { + uint32 callback_res = GetIndustryTileCallback(CBID_INDUSTRY_DRAW_FOUNDATIONS, 0, 0, gfx, GetIndustryByTile(tile), tile); + if (callback_res == 0) return FOUNDATION_NONE; + } + } return FlatteningFoundation(tileh); } -- cgit v1.2.3-54-g00ecf