src/industry_cmd.cpp
changeset 5587 167d9a91ef02
parent 5584 1111b4d36e35
child 5668 36b39f4a9032
--- a/src/industry_cmd.cpp	Wed Jan 10 18:44:52 2007 +0000
+++ b/src/industry_cmd.cpp	Wed Jan 10 18:56:51 2007 +0000
@@ -765,14 +765,14 @@
 		tile = TILE_MASK(tile);
 
 		if (IsTileType(tile, MP_CLEAR) || IsTileType(tile, MP_TREES)) {
-			byte or = type;
+			byte or_ = type;
 
-			if (or == 1 && CHANCE16(1, 7)) or = 2;
+			if (or_ == 1 && CHANCE16(1, 7)) or_ = 2;
 
 			if (direction == AXIS_X) {
-				SetFenceSE(tile, or);
+				SetFenceSE(tile, or_);
 			} else {
-				SetFenceSW(tile, or);
+				SetFenceSW(tile, or_);
 			}
 		}
 
@@ -942,7 +942,7 @@
 	if ((i->counter & 0x3F) == 0) {
 		if (CHANCE16R(1,14,r) && (num=_industry_sounds[i->type][0]) != 0) {
 			SndPlayTileFx(
-				_industry_sounds[i->type][1] + (((r >> 16) * num) >> 16),
+				(SoundFx)(_industry_sounds[i->type][1] + (((r >> 16) * num) >> 16)),
 				i->xy);
 		}
 	}
@@ -1225,7 +1225,7 @@
 			return false;
 
 		/* Don't allow too big of a change if this is the sub-tile check */
-		if (internal != 0 && myabs(curh - height) > 1) return false;
+		if (internal != 0 && delta(curh, height) > 1) return false;
 
 		/* Different height, so the surrounding tiles of this tile
 		 *  has to be correct too (in level, or almost in level)
@@ -1353,7 +1353,7 @@
 	return AddBlockToPool(&_Industry_pool) ? AllocateIndustry() : NULL;
 }
 
-static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const IndustryTileTable *it, const Town *t, byte owner)
+static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const IndustryTileTable *it, const Town *t, Owner owner)
 {
 	const IndustrySpec *indspec = GetIndustrySpec(type);
 	uint32 r;
@@ -1595,25 +1595,25 @@
 		default: /* INDUSTRY_PRODUCTION */
 			for (j = 0; j < 2 && i->produced_cargo[j] != CT_INVALID; j++){
 				uint32 r = Random();
-				int old, new, percent;
+				int old_prod, new_prod, percent;
 				int mag;
 
-				new = old = i->production_rate[j];
+				new_prod = old_prod = i->production_rate[j];
 				if (CHANCE16I(20, 1024, r))
-					new -= ((RandomRange(50) + 10) * old) >> 8;
+					new_prod -= ((RandomRange(50) + 10) * old_prod) >> 8;
 				if (CHANCE16I(20 + (i->pct_transported[j] * 20 >> 8), 1024, r >> 16))
-					new += ((RandomRange(50) + 10) * old) >> 8;
+					new_prod += ((RandomRange(50) + 10) * old_prod) >> 8;
 
-				new = clamp(new, 0, 255);
-				if (new == old) {
+				new_prod = clamp(new_prod, 0, 255);
+				if (new_prod == old_prod) {
 					closeit = false;
 					continue;
 				}
 
-				percent = new * 100 / old - 100;
-				i->production_rate[j] = new;
+				percent = new_prod * 100 / old_prod - 100;
+				i->production_rate[j] = new_prod;
 
-				if (new >= indspec->production_rate[j] / 4)
+				if (new_prod >= indspec->production_rate[j] / 4)
 					closeit = false;
 
 				mag = abs(percent);
@@ -1827,7 +1827,7 @@
 	_industry_sound_tile = 0;
 }
 
-const TileTypeProcs _tile_type_industry_procs = {
+extern const TileTypeProcs _tile_type_industry_procs = {
 	DrawTile_Industry,           /* draw_tile_proc */
 	GetSlopeZ_Industry,          /* get_slope_z_proc */
 	ClearTile_Industry,          /* clear_tile_proc */
@@ -1905,6 +1905,6 @@
 	}
 }
 
-const ChunkHandler _industry_chunk_handlers[] = {
+extern const ChunkHandler _industry_chunk_handlers[] = {
 	{ 'INDY', Save_INDY, Load_INDY, CH_ARRAY | CH_LAST},
 };