summaryrefslogtreecommitdiff
path: root/src/newgrf_industrytiles.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-10-02 16:56:45 +0000
committerrubidium <rubidium@openttd.org>2007-10-02 16:56:45 +0000
commit531fe3e07012670f56eaaf59f85a0ad99208c032 (patch)
tree1d46101c1e0fc0626c63928a6ef4b691f90c32c0 /src/newgrf_industrytiles.cpp
parent7979674717cb807d4294eaffccabb5fb08aec9a4 (diff)
downloadopenttd-531fe3e07012670f56eaaf59f85a0ad99208c032.tar.xz
(svn r11193) -Fix: be more compliant with the specifications of callback #2F (and undocumented side effects in TTDP in corner cases).
Diffstat (limited to 'src/newgrf_industrytiles.cpp')
-rw-r--r--src/newgrf_industrytiles.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp
index 6c3c40c99..1c1d74199 100644
--- a/src/newgrf_industrytiles.cpp
+++ b/src/newgrf_industrytiles.cpp
@@ -247,18 +247,23 @@ bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const Indus
}
}
-bool PerformIndustryTileSlopeCheck(TileIndex tile, const IndustryTileSpec *its, IndustryType type, IndustryGfx gfx)
+extern bool IsSlopeRefused(Slope current, Slope refused);
+
+bool PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind_tile, const IndustryTileSpec *its, IndustryType type, IndustryGfx gfx, uint itspec_index)
{
Industry ind;
- ind.xy = 0;
+ ind.index = INVALID_INDUSTRY;
+ ind.xy = ind_base_tile;
ind.width = 0;
ind.type = type;
- uint16 callback_res = GetIndustryTileCallback(CBID_INDTILE_SHAPE_CHECK, 0, 0, gfx, &ind, tile);
+ uint16 callback_res = GetIndustryTileCallback(CBID_INDTILE_SHAPE_CHECK, 0, itspec_index, gfx, &ind, ind_tile);
+ if (callback_res == CALLBACK_FAILED) {
+ return !IsSlopeRefused(GetTileSlope(ind_tile, NULL), its->slopes_refused);
+ }
if (its->grf_prop.grffile->grf_version < 7) {
return callback_res != 0;
}
- if (callback_res == CALLBACK_FAILED) return false;
switch (callback_res) {
case 0x400: return true;