mirror of https://github.com/OpenTTD/OpenTTD
(svn r10494) -Fix (r10490): possible null dereference in some exotic newgrfs.
parent
b876be0064
commit
09eb6623ab
|
@ -1191,7 +1191,7 @@ static bool CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable
|
||||||
|
|
||||||
if (HASBIT(its->callback_flags, CBM_INDT_SHAPE_CHECK)) {
|
if (HASBIT(its->callback_flags, CBM_INDT_SHAPE_CHECK)) {
|
||||||
if (custom_shape_check != NULL) *custom_shape_check = true;
|
if (custom_shape_check != NULL) *custom_shape_check = true;
|
||||||
if (!PerformIndustryTileSlopeCheck(cur_tile, its, it->gfx)) return false;
|
if (!PerformIndustryTileSlopeCheck(cur_tile, its, type, it->gfx)) return false;
|
||||||
} else {
|
} else {
|
||||||
if (ind_behav & INDUSTRYBEH_BUILT_ONWATER) {
|
if (ind_behav & INDUSTRYBEH_BUILT_ONWATER) {
|
||||||
/* As soon as the tile is not water, bail out.
|
/* As soon as the tile is not water, bail out.
|
||||||
|
|
|
@ -229,9 +229,13 @@ bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const Indus
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PerformIndustryTileSlopeCheck(TileIndex tile, const IndustryTileSpec *its, IndustryGfx gfx)
|
bool PerformIndustryTileSlopeCheck(TileIndex tile, const IndustryTileSpec *its, IndustryType type, IndustryGfx gfx)
|
||||||
{
|
{
|
||||||
uint16 callback_res = GetIndustryTileCallback(CBID_INDTILE_SHAPE_CHECK, 0, 0, gfx, NULL, tile);
|
Industry ind;
|
||||||
|
ind.xy = 0;
|
||||||
|
ind.type = type;
|
||||||
|
|
||||||
|
uint16 callback_res = GetIndustryTileCallback(CBID_INDTILE_SHAPE_CHECK, 0, 0, gfx, &ind, tile);
|
||||||
if (its->grf_prop.grffile->grf_version < 7) {
|
if (its->grf_prop.grffile->grf_version < 7) {
|
||||||
return callback_res != 0;
|
return callback_res != 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,6 @@
|
||||||
|
|
||||||
bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const IndustryTileSpec *inds);
|
bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const IndustryTileSpec *inds);
|
||||||
uint16 GetIndustryTileCallback(uint16 callback, uint32 param1, uint32 param2, IndustryGfx gfx_id, Industry *industry, TileIndex tile);
|
uint16 GetIndustryTileCallback(uint16 callback, uint32 param1, uint32 param2, IndustryGfx gfx_id, Industry *industry, TileIndex tile);
|
||||||
bool PerformIndustryTileSlopeCheck(TileIndex tile, const IndustryTileSpec *its, IndustryGfx gfx);
|
bool PerformIndustryTileSlopeCheck(TileIndex tile, const IndustryTileSpec *its, IndustryType type, IndustryGfx gfx);
|
||||||
|
|
||||||
#endif /* NEWGRF_INDUSTRYTILES_H */
|
#endif /* NEWGRF_INDUSTRYTILES_H */
|
||||||
|
|
Loading…
Reference in New Issue