(svn r10963) -Revert(10700): Although the idea was good, it was more prone of errors than usefull.
authorbelugas
Wed, 22 Aug 2007 01:16:08 +0000
changeset 7462 74a281f80498
parent 7461 09deed76b5d6
child 7463 6f79efd6772a
(svn r10963) -Revert(10700): Although the idea was good, it was more prone of errors than usefull.
So now, it will be better to jump to the overriden tile when it is been marked as an override
src/industry.h
src/industry_cmd.cpp
src/newgrf_industries.cpp
--- a/src/industry.h	Wed Aug 22 00:59:46 2007 +0000
+++ b/src/industry.h	Wed Aug 22 01:16:08 2007 +0000
@@ -212,7 +212,7 @@
 
 /* industry_cmd.cpp*/
 const IndustrySpec *GetIndustrySpec(IndustryType thistype);    ///< Array of industries data
-const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx, bool full_check = true);  ///< Array of industry tiles data
+const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx);  ///< Array of industry tiles data
 void ResetIndustries();
 void PlantRandomFarmField(const Industry *i);
 
--- a/src/industry_cmd.cpp	Wed Aug 22 00:59:46 2007 +0000
+++ b/src/industry_cmd.cpp	Wed Aug 22 01:16:08 2007 +0000
@@ -113,19 +113,13 @@
  * 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, bool full_check)
+const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx)
 {
 	assert(gfx < INVALID_INDUSTRYTILE);
-	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;
+	return &_industry_tile_specs[gfx];
 }
 
 Industry::~Industry()
@@ -334,6 +328,7 @@
 {
 	IndustryGfx gfx = GetIndustryGfx(tile);
 	const IndustryTileSpec *itspec = GetIndustryTileSpec(gfx);
+	if (itspec->grf_prop.override != INVALID_INDUSTRYTILE) itspec = GetIndustryTileSpec(itspec->grf_prop.override);
 
 	/* When we have to use a callback, we put our data in the next two variables */
 	CargoID raw_accepts_cargo[lengthof(itspec->accepts_cargo)];
--- a/src/newgrf_industries.cpp	Wed Aug 22 00:59:46 2007 +0000
+++ b/src/newgrf_industries.cpp	Wed Aug 22 01:16:08 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, false);
-			const IndustryTileSpec *indold = GetIndustryTileSpec(GetIndustryGfx(old_tile), false);
+			const IndustryTileSpec *indtsp = GetIndustryTileSpec(gfx);
+			const IndustryTileSpec *indold = GetIndustryTileSpec(GetIndustryGfx(old_tile));
 
 			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 */