diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/industry.h | 2 | ||||
-rw-r--r-- | src/industry_cmd.cpp | 10 | ||||
-rw-r--r-- | src/newgrf_industries.cpp | 4 |
3 files changed, 11 insertions, 5 deletions
diff --git a/src/industry.h b/src/industry.h index 12dbb5f8f..2dc562d20 100644 --- a/src/industry.h +++ b/src/industry.h @@ -205,7 +205,7 @@ struct IndustryTileSpec { /* industry_cmd.cpp*/ const IndustrySpec *GetIndustrySpec(IndustryType thistype); ///< Array of industries data -const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx); ///< Array of industry tiles data +const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx, bool full_check = true); ///< Array of industry tiles data void ResetIndustries(); void PlantRandomFarmField(const Industry *i); diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index bbdab2415..25228fe95 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -124,13 +124,19 @@ const IndustrySpec *GetIndustrySpec(IndustryType thistype) * This will ensure at once : proper access and * not allowing modifications of it. * @param gfx of industrytile (which is the index in _industry_tile_specs) + * @param full_check (default to true) verify if an override is available. + * If so, use it instead of the gfx provided. * @pre gfx < INVALID_INDUSTRYTILE * @return a pointer to the corresponding industrytile spec **/ -const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx) +const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx, bool full_check) { assert(gfx < INVALID_INDUSTRYTILE); - return &_industry_tile_specs[gfx]; + const IndustryTileSpec *its = &_industry_tile_specs[gfx]; + if (full_check && its->grf_prop.override != INVALID_INDUSTRYTILE) { + its = &_industry_tile_specs[its->grf_prop.override]; + } + return its; } void DestroyIndustry(Industry *i) diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp index 0ce3627d1..a627376fa 100644 --- a/src/newgrf_industries.cpp +++ b/src/newgrf_industries.cpp @@ -87,8 +87,8 @@ uint32 GetIndustryIDAtOffset(TileIndex new_tile, TileIndex old_tile, const Indus if (GetIndustryIndex(new_tile) == i->index) { // Does it belong to the same industry? IndustryGfx gfx = GetIndustryGfx(new_tile); - const IndustryTileSpec *indtsp = GetIndustryTileSpec(gfx); - const IndustryTileSpec *indold = GetIndustryTileSpec(GetIndustryGfx(old_tile)); + const IndustryTileSpec *indtsp = GetIndustryTileSpec(gfx, false); + const IndustryTileSpec *indold = GetIndustryTileSpec(GetIndustryGfx(old_tile), false); if (gfx < NEW_INDUSTRYOFFSET) { // Does it belongs to an old type? /* It is an old tile. We have to see if it's been overriden */ |