(svn r10904) -Fix: When using a temporary industry, make sure you do not clear some unreachable tiles upon its destruction.
authorbelugas
Wed, 15 Aug 2007 01:50:13 +0000
changeset 7942 9f7797968d6d
parent 7941 ddf9d11e6df8
child 7943 5bd1fbc094c6
(svn r10904) -Fix: When using a temporary industry, make sure you do not clear some unreachable tiles upon its destruction.
-Codechange: do not perform something that by all means will not change. A zero offset is really meaningless...
src/newgrf_industrytiles.cpp
--- a/src/newgrf_industrytiles.cpp	Wed Aug 15 00:49:34 2007 +0000
+++ b/src/newgrf_industrytiles.cpp	Wed Aug 15 01:50:13 2007 +0000
@@ -35,7 +35,7 @@
 	byte tile_type;
 	bool is_same_industry;
 
-	tile = GetNearbyTile(parameter, tile);
+	if (parameter != 0) tile = GetNearbyTile(parameter, tile); // only perform if it is required
 	is_same_industry = (IsTileType(tile, MP_INDUSTRY) && GetIndustryIndex(tile) == index);
 	tile_type = GetTerrainType(tile) << 2 | (IsTileType(tile, MP_WATER) ? 1 : 0) << 1 | (is_same_industry ? 1 : 0);
 
@@ -236,6 +236,7 @@
 {
 	Industry ind;
 	ind.xy = 0;
+	ind.width = 0;
 	ind.type = type;
 
 	uint16 callback_res = GetIndustryTileCallback(CBID_INDTILE_SHAPE_CHECK, 0, 0, gfx, &ind, tile);