# HG changeset patch # User belugas # Date 1185504089 0 # Node ID f3a0c16d84ea9f679b62d36587ab6fba562b252f # Parent 2f84cd6d6c28da25215537c149856541918ea81f (svn r10700) -Codechange: Enable to jump (by default) to the overriding industry tile spec of the one been queried. Only on certain very specific circumstances do we need the original spec diff -r 2f84cd6d6c28 -r f3a0c16d84ea src/industry.h --- a/src/industry.h Thu Jul 26 18:36:32 2007 +0000 +++ b/src/industry.h Fri Jul 27 02:41:29 2007 +0000 @@ -205,7 +205,7 @@ /* 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 -r 2f84cd6d6c28 -r f3a0c16d84ea src/industry_cmd.cpp --- a/src/industry_cmd.cpp Thu Jul 26 18:36:32 2007 +0000 +++ b/src/industry_cmd.cpp Fri Jul 27 02:41:29 2007 +0000 @@ -124,13 +124,19 @@ * 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 -r 2f84cd6d6c28 -r f3a0c16d84ea src/newgrf_industries.cpp --- a/src/newgrf_industries.cpp Thu Jul 26 18:36:32 2007 +0000 +++ b/src/newgrf_industries.cpp Fri Jul 27 02:41:29 2007 +0000 @@ -87,8 +87,8 @@ 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 */