Changeset - r6491:6b6c19f090e1
[Not reviewed]
master
! ! !
rubidium - 17 years ago 2007-04-18 22:10:36
rubidium@openttd.org
(svn r9672) -Cleanup: lots of coding style fixes around operands.
62 files changed with 1051 insertions and 1051 deletions:
0 comments (0 inline, 0 general)
src/ai/ai.h
Show inline comments
 
@@ -77,8 +77,8 @@ static inline bool AI_AllowNewAI()
 
	return true;
 
}
 

	
 
#define AI_CHANCE16(a,b)    ((uint16)     AI_Random()  <= (uint16)((65536 * a) / b))
 
#define AI_CHANCE16R(a,b,r) ((uint16)(r = AI_Random()) <= (uint16)((65536 * a) / b))
 
#define AI_CHANCE16(a, b)    ((uint16)     AI_Random()  <= (uint16)((65536 * a) / b))
 
#define AI_CHANCE16R(a, b, r) ((uint16)(r = AI_Random()) <= (uint16)((65536 * a) / b))
 

	
 
/**
 
 * The random-function that should be used by ALL AIs.
src/ai/default/default.cpp
Show inline comments
 
@@ -516,7 +516,7 @@ static void AiFindSubsidyPassengerRoute(
 
{
 
	uint i;
 
	const Subsidy* s;
 
	Town *from,*to;
 
	Town *from, *to;
 

	
 
	// initially error
 
	fr->distance = -1;
 
@@ -1561,7 +1561,7 @@ static bool AiCheckTrackResources(TileIn
 
				return false;
 
			if (cargo != CT_MAIL)
 
				return true;
 
			return !!((values[cargo]>>1) & ~7);
 
			return !!((values[cargo] >> 1) & ~7);
 
		}
 
	}
 

	
 
@@ -1574,7 +1574,7 @@ static int32 AiDoBuildDefaultRailTrack(T
 
	int32 total_cost = 0;
 
	Town *t = NULL;
 
	int rating = 0;
 
	int i,j,k;
 
	int i, j, k;
 

	
 
	for (;;) {
 
		// This will seldomly overflow for valid reasons. Mask it to be on the safe side.
 
@@ -1588,7 +1588,7 @@ static int32 AiDoBuildDefaultRailTrack(T
 
				ret = DoCommand(c, railtype, p->attr, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_TRAIN_DEPOT);
 
			} else {
 
				// Station
 
				ret = DoCommand(c, (p->attr&1) | (p->attr>>4)<<8 | (p->attr>>1&7)<<16, railtype, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_RAILROAD_STATION);
 
				ret = DoCommand(c, (p->attr & 1) | (p->attr >> 4) << 8 | (p->attr >> 1 & 7) << 16, railtype, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_RAILROAD_STATION);
 
			}
 

	
 
			if (CmdFailed(ret)) return CMD_ERROR;
 
@@ -1610,7 +1610,7 @@ clear_town_stuff:;
 

	
 
			// Build the rail
 
			for (i = 0; i != 6; i++, j >>= 1) {
 
				if (j&1) {
 
				if (j & 1) {
 
					k = i;
 
					ret = DoCommand(c, railtype, i, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_SINGLE_RAIL);
 
					if (CmdFailed(ret)) return CMD_ERROR;
 
@@ -1642,7 +1642,7 @@ clear_town_stuff:;
 
			total_cost += ret + _price.build_rail;
 

	
 
			if (flag & DC_EXEC) {
 
				DoCommand(c, railtype, p->attr&1, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_SINGLE_RAIL);
 
				DoCommand(c, railtype, p->attr & 1, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_SINGLE_RAIL);
 
			}
 

	
 
			goto clear_town_stuff;
 
@@ -1784,7 +1784,7 @@ static void AiStateBuildDefaultRailBlock
 
			if (rule == -1) {
 
				// cannot build, terraform after a while
 
				if (p->ai.state_counter >= 600) {
 
					AiDoTerraformLand(aib->use_tile, Random()&3, 3, (int8)p->ai.state_mode);
 
					AiDoTerraformLand(aib->use_tile, Random() & 3, 3, (int8)p->ai.state_mode);
 
				}
 
				// also try the other terraform direction
 
				if (++p->ai.state_counter >= 1000) {
 
@@ -1804,7 +1804,7 @@ static void AiStateBuildDefaultRailBlock
 
				);
 
				assert(!CmdFailed(r));
 
			}
 
		} while (++aib,--j);
 
		} while (++aib, --j);
 
	}
 

	
 
	// check if we're done with all of them
 
@@ -1812,7 +1812,7 @@ static void AiStateBuildDefaultRailBlock
 
	j = p->ai.num_build_rec;
 
	do {
 
		if (aib->cur_building_rule == 255) return;
 
	} while (++aib,--j);
 
	} while (++aib, --j);
 

	
 
	// yep, all are done. switch state to the rail building state.
 
	p->ai.state = AIS_BUILD_RAIL;
 
@@ -1857,7 +1857,7 @@ static bool AiDoFollowTrack(const Player
 
	arpfd.tile2 = p->ai.cur_tile_a;
 
	arpfd.flag = false;
 
	arpfd.count = 0;
 
	FollowTrack(p->ai.cur_tile_a + TileOffsByDiagDir(p->ai.cur_dir_a), 0x2000 | TRANSPORT_RAIL, (DiagDirection)(p->ai.cur_dir_a^2),
 
	FollowTrack(p->ai.cur_tile_a + TileOffsByDiagDir(p->ai.cur_dir_a), 0x2000 | TRANSPORT_RAIL, (DiagDirection)(p->ai.cur_dir_a ^ 2),
 
		(TPFEnumProc*)AiEnumFollowTrack, NULL, &arpfd);
 
	return arpfd.count > 8;
 
}
 
@@ -2001,8 +2001,8 @@ static inline void AiCheckBuildRailTunne
 
	if (GetTileSlope(tile, &z) == _dir_table_2[p[0] & 3] && z != 0) {
 
		int32 cost = DoCommand(tile, arf->player->ai.railtype_to_use, 0, DC_AUTO, CMD_BUILD_TUNNEL);
 

	
 
		if (!CmdFailed(cost) && cost <= (arf->player->player_money>>4)) {
 
			AiBuildRailRecursive(arf, _build_tunnel_endtile, p[0]&3);
 
		if (!CmdFailed(cost) && cost <= (arf->player->player_money >> 4)) {
 
			AiBuildRailRecursive(arf, _build_tunnel_endtile, p[0] & 3);
 
			if (arf->depth == 1) AiCheckRailPathBetter(arf, p);
 
		}
 
	}
 
@@ -2017,7 +2017,7 @@ static void AiBuildRailRecursive(AiRailF
 

	
 
	// Reached destination?
 
	if (tile == arf->final_tile) {
 
		if (arf->final_dir != (dir^2)) {
 
		if (arf->final_dir != (dir ^ 2)) {
 
			if (arf->recursive_mode != 2) arf->recursive_mode = 1;
 
		} else if (arf->recursive_mode != 2) {
 
			arf->recursive_mode = 2;
 
@@ -2063,17 +2063,17 @@ static void AiBuildRailRecursive(AiRailF
 
			if (arf->depth == 1) AiCheckRailPathBetter(arf, p);
 

	
 
			p += 2;
 
		} while (!(p[0]&0x80));
 
		} while (!(p[0] & 0x80));
 
	}
 

	
 
	AiCheckBuildRailBridgeHere(arf, tile, p);
 
	AiCheckBuildRailTunnelHere(arf, tile, p+1);
 
	AiCheckBuildRailTunnelHere(arf, tile, p + 1);
 

	
 
	arf->depth--;
 
}
 

	
 

	
 
static const byte _dir_table_3[]= {0x25, 0x2A, 0x19, 0x16};
 
static const byte _dir_table_3[] = {0x25, 0x2A, 0x19, 0x16};
 

	
 
static void AiBuildRailConstruct(Player *p)
 
{
 
@@ -2324,23 +2324,23 @@ static void AiStateBuildRail(Player *p)
 
	}
 

	
 
	// Find first edge to build from.
 
	tile = AiGetEdgeOfDefaultRailBlock(aib->cur_building_rule, aib->use_tile, cmd&3, &dir);
 
	tile = AiGetEdgeOfDefaultRailBlock(aib->cur_building_rule, aib->use_tile, cmd & 3, &dir);
 
	p->ai.start_tile_a = tile;
 
	p->ai.cur_tile_a = tile;
 
	p->ai.start_dir_a = dir;
 
	p->ai.cur_dir_a = dir;
 
	DoCommand(TILE_MASK(tile + TileOffsByDiagDir(dir)), 0, (dir&1)?1:0, DC_EXEC, CMD_REMOVE_SINGLE_RAIL);
 
	DoCommand(TILE_MASK(tile + TileOffsByDiagDir(dir)), 0, (dir & 1) ? 1 : 0, DC_EXEC, CMD_REMOVE_SINGLE_RAIL);
 

	
 
	assert(TILE_MASK(tile) != 0xFF00);
 

	
 
	// Find second edge to build to
 
	aib = (&p->ai.src) + ((cmd >> 4)&0xF);
 
	tile = AiGetEdgeOfDefaultRailBlock(aib->cur_building_rule, aib->use_tile, (cmd>>2)&3, &dir);
 
	aib = (&p->ai.src) + ((cmd >> 4) & 0xF);
 
	tile = AiGetEdgeOfDefaultRailBlock(aib->cur_building_rule, aib->use_tile, (cmd >> 2) & 3, &dir);
 
	p->ai.start_tile_b = tile;
 
	p->ai.cur_tile_b = tile;
 
	p->ai.start_dir_b = dir;
 
	p->ai.cur_dir_b = dir;
 
	DoCommand(TILE_MASK(tile + TileOffsByDiagDir(dir)), 0, (dir&1)?1:0, DC_EXEC, CMD_REMOVE_SINGLE_RAIL);
 
	DoCommand(TILE_MASK(tile + TileOffsByDiagDir(dir)), 0, (dir & 1) ? 1 : 0, DC_EXEC, CMD_REMOVE_SINGLE_RAIL);
 

	
 
	assert(TILE_MASK(tile) != 0xFF00);
 

	
 
@@ -2503,7 +2503,7 @@ static void AiStateDeleteRailBlocks(Play
 
		for (b = _default_rail_track_data[aib->cur_building_rule]->data; b->mode != 4; b++) {
 
			DoCommand(TILE_ADD(aib->use_tile, ToTileIndexDiff(b->tileoffs)), 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
 
		}
 
	} while (++aib,--num);
 
	} while (++aib, --num);
 

	
 
	p->ai.state = AIS_0;
 
}
 
@@ -2682,14 +2682,14 @@ static void AiStateBuildDefaultRoadBlock
 
			if (rule == -1) {
 
				// cannot build, terraform after a while
 
				if (p->ai.state_counter >= 600) {
 
					AiDoTerraformLand(aib->use_tile, Random()&3, 3, (int8)p->ai.state_mode);
 
					AiDoTerraformLand(aib->use_tile, Random() & 3, 3, (int8)p->ai.state_mode);
 
				}
 
				// also try the other terraform direction
 
				if (++p->ai.state_counter >= 1000) {
 
					p->ai.state_counter = 0;
 
					p->ai.state_mode = -p->ai.state_mode;
 
				}
 
			} else if (CheckPlayerHasMoney(cost) && AiCheckBlockDistances(p,aib->use_tile)) {
 
			} else if (CheckPlayerHasMoney(cost) && AiCheckBlockDistances(p, aib->use_tile)) {
 
				int32 r;
 

	
 
				// player has money, build it.
 
@@ -2702,7 +2702,7 @@ static void AiStateBuildDefaultRoadBlock
 
				);
 
				assert(!CmdFailed(r));
 
			}
 
		} while (++aib,--j);
 
		} while (++aib, --j);
 
	}
 

	
 
	// check if we're done with all of them
 
@@ -2710,7 +2710,7 @@ static void AiStateBuildDefaultRoadBlock
 
	j = p->ai.num_build_rec;
 
	do {
 
		if (aib->cur_building_rule == 255) return;
 
	} while (++aib,--j);
 
	} while (++aib, --j);
 

	
 
	// yep, all are done. switch state to the rail building state.
 
	p->ai.state = AIS_BUILD_ROAD;
 
@@ -2901,8 +2901,8 @@ static inline void AiCheckBuildRoadTunne
 
	if (GetTileSlope(tile, &z) == _dir_table_2[p[0] & 3] && z != 0) {
 
		int32 cost = DoCommand(tile, 0x200, 0, DC_AUTO, CMD_BUILD_TUNNEL);
 

	
 
		if (!CmdFailed(cost) && cost <= (arf->player->player_money>>4)) {
 
			AiBuildRoadRecursive(arf, _build_tunnel_endtile, p[0]&3);
 
		if (!CmdFailed(cost) && cost <= (arf->player->player_money >> 4)) {
 
			AiBuildRoadRecursive(arf, _build_tunnel_endtile, p[0] & 3);
 
			if (arf->depth == 1)  AiCheckRoadPathBetter(arf, p);
 
		}
 
	}
 
@@ -2918,7 +2918,7 @@ static void AiBuildRoadRecursive(AiRoadF
 

	
 
	// Reached destination?
 
	if (tile == arf->final_tile) {
 
		if ((arf->final_dir^2) == dir) {
 
		if ((arf->final_dir ^ 2) == dir) {
 
			arf->recursive_mode = 2;
 
			arf->cur_best_depth = arf->depth;
 
		}
 
@@ -2962,7 +2962,7 @@ static void AiBuildRoadRecursive(AiRoadF
 
	}
 

	
 
	AiCheckBuildRoadBridgeHere(arf, tile, p);
 
	AiCheckBuildRoadTunnelHere(arf, tile, p+1);
 
	AiCheckBuildRoadTunnelHere(arf, tile, p + 1);
 

	
 
	arf->depth--;
 
}
 
@@ -3020,7 +3020,7 @@ do_some_terraform:
 

	
 
	tile = TILE_MASK(p->ai.cur_tile_a + TileOffsByDiagDir(p->ai.cur_dir_a));
 

	
 
	if (arf.best_ptr[0]&0x80) {
 
	if (arf.best_ptr[0] & 0x80) {
 
		int i;
 
		int32 bridge_len;
 
		p->ai.cur_tile_a = arf.bridge_end_tile;
 
@@ -3042,7 +3042,7 @@ do_some_terraform:
 
		DoCommand(tile, p->ai.cur_tile_a, i + (0x80 << 8), DC_AUTO | DC_EXEC, CMD_BUILD_BRIDGE);
 

	
 
		p->ai.state_counter = 0;
 
	} else if (arf.best_ptr[0]&0x40) {
 
	} else if (arf.best_ptr[0] & 0x40) {
 
		// tunnel
 
		DoCommand(tile, 0x200, 0, DC_AUTO | DC_EXEC, CMD_BUILD_TUNNEL);
 
		p->ai.cur_tile_a = _build_tunnel_endtile;
 
@@ -3148,7 +3148,7 @@ static void AiStateBuildRoad(Player *p)
 
	p->ai.cur_dir_a = dir;
 

	
 
	// Find second edge to build to
 
	aib = (&p->ai.src) + (cmd&0xF);
 
	aib = (&p->ai.src) + (cmd & 0xF);
 
	tile = AiGetRoadBlockEdge(aib->cur_building_rule, aib->use_tile, &dir);
 
	p->ai.start_tile_b = tile;
 
	p->ai.cur_tile_b = tile;
 
@@ -3239,7 +3239,7 @@ static void AiStateDeleteRoadBlocks(Play
 
			if (b->mode > 1) continue;
 
			DoCommand(TILE_ADD(aib->use_tile, ToTileIndexDiff(b->tileoffs)), 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
 
		}
 
	} while (++aib,--num);
 
	} while (++aib, --num);
 

	
 
	p->ai.state = AIS_0;
 
}
 
@@ -3326,7 +3326,7 @@ static int32 AiDoBuildDefaultAirportBloc
 

	
 
	for (; p->mode == 0; p++) {
 
		if (!HASBIT(avail_airports, p->attr)) return CMD_ERROR;
 
		ret = DoCommand(TILE_MASK(tile + ToTileIndexDiff(p->tileoffs)), p->attr,0,flag | DC_AUTO | DC_NO_WATER,CMD_BUILD_AIRPORT);
 
		ret = DoCommand(TILE_MASK(tile + ToTileIndexDiff(p->tileoffs)), p->attr, 0, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_AIRPORT);
 
		if (CmdFailed(ret)) return CMD_ERROR;
 
		total_cost += ret;
 
	}
 
@@ -3408,14 +3408,14 @@ static void AiStateBuildDefaultAirportBl
 
			if (rule == -1) {
 
				// cannot build, terraform after a while
 
				if (p->ai.state_counter >= 600) {
 
					AiDoTerraformLand(aib->use_tile, Random()&3, 3, (int8)p->ai.state_mode);
 
					AiDoTerraformLand(aib->use_tile, Random() & 3, 3, (int8)p->ai.state_mode);
 
				}
 
				// also try the other terraform direction
 
				if (++p->ai.state_counter >= 1000) {
 
					p->ai.state_counter = 0;
 
					p->ai.state_mode = -p->ai.state_mode;
 
				}
 
			} else if (CheckPlayerHasMoney(cost) && AiCheckBlockDistances(p,aib->use_tile)) {
 
			} else if (CheckPlayerHasMoney(cost) && AiCheckBlockDistances(p, aib->use_tile)) {
 
				// player has money, build it.
 
				int32 r;
 

	
 
@@ -3428,7 +3428,7 @@ static void AiStateBuildDefaultAirportBl
 
				);
 
				assert(!CmdFailed(r));
 
			}
 
		} while (++aib,--j);
 
		} while (++aib, --j);
 
	} while (--i);
 

	
 
	// check if we're done with all of them
 
@@ -3436,7 +3436,7 @@ static void AiStateBuildDefaultAirportBl
 
	j = p->ai.num_build_rec;
 
	do {
 
		if (aib->cur_building_rule == 255) return;
 
	} while (++aib,--j);
 
	} while (++aib, --j);
 

	
 
	// yep, all are done. switch state.
 
	p->ai.state = AIS_BUILD_AIRCRAFT_VEHICLES;
 
@@ -3650,7 +3650,7 @@ pos_3:
 
				}
 
			}
 
		} else {
 
			static const byte _depot_bits[] = {0x19,0x16,0x25,0x2A};
 
			static const byte _depot_bits[] = {0x19, 0x16, 0x25, 0x2A};
 

	
 
			DiagDirection dir = GetRailDepotDirection(tile);
 

	
 
@@ -3795,13 +3795,13 @@ static void AiHandleTakeover(Player *p)
 
		// Ask the guy with the highest performance hist.
 
		FOR_ALL_PLAYERS(pp) {
 
			if (pp->is_active &&
 
					!(asked&1) &&
 
					!(asked & 1) &&
 
					pp->bankrupt_asked == 0 &&
 
					best_val < pp->old_economy[1].performance_history) {
 
				best_val = pp->old_economy[1].performance_history;
 
				best_pl = pp;
 
			}
 
			asked>>=1;
 
			asked >>= 1;
 
		}
 

	
 
		// Asked all players?
 
@@ -3843,7 +3843,7 @@ static void AiAdjustLoan(const Player* p
 
		// Increase loan
 
		if (p->current_loan < _economy.max_loan &&
 
				p->num_valid_stat_ent >= 2 &&
 
				-(p->old_economy[0].expenses+p->old_economy[1].expenses) < base * 60) {
 
				-(p->old_economy[0].expenses + p->old_economy[1].expenses) < base * 60) {
 
			DoCommand(0, 0, 0, DC_EXEC, CMD_INCREASE_LOAN);
 
		}
 
	}
 
@@ -3872,7 +3872,7 @@ void AiDoGameLoop(Player *p)
 
	//  to the patch-setting
 
	// Also, it takes into account the setting if the service-interval is in days
 
	//  or in %
 
	_ai_service_interval = _patches.servint_ispercent?80:180;
 
	_ai_service_interval = _patches.servint_ispercent ? 80 : 180;
 

	
 
	if (IsHumanPlayer(_current_player)) return;
 

	
 
@@ -3883,7 +3883,7 @@ void AiDoGameLoop(Player *p)
 
	{
 
		static byte old_state = 99;
 
		static bool hasdots = false;
 
		char *_ai_state_names[]={
 
		char *_ai_state_names[] = {
 
			"AiCase0",
 
			"AiCase1",
 
			"AiStateVehLoop",
src/ai/trolly/build.cpp
Show inline comments
 
@@ -123,7 +123,7 @@ int AiNew_Build_RoutePart(Player *p, Ai_
 
		}
 
		// Bridge code
 
		if ((AI_PATHFINDER_FLAG_BRIDGE & route_extra[part]) != 0) {
 
			cost += AiNew_Build_Bridge(p, route[part], route[part-1], flag);
 
			cost += AiNew_Build_Bridge(p, route[part], route[part - 1], flag);
 
			PathFinderInfo->position++;
 
			// TODO: problems!
 
			if (CmdFailed(cost)) {
 
@@ -173,7 +173,7 @@ int AiNew_Build_RoutePart(Player *p, Ai_
 
		}
 
		// Bridge code
 
		if ((AI_PATHFINDER_FLAG_BRIDGE & route_extra[part]) != 0) {
 
			cost += AiNew_Build_Bridge(p, route[part], route[part+1], flag);
 
			cost += AiNew_Build_Bridge(p, route[part], route[part + 1], flag);
 
			PathFinderInfo->position++;
 
			// TODO: problems!
 
			if (CmdFailed(cost)) {
src/ai/trolly/trolly.cpp
Show inline comments
 
@@ -220,9 +220,9 @@ static bool AiNew_Check_City_or_Industry
 

	
 
		// Check if the rating in a city is high enough
 
		//  If not, take a chance if we want to continue
 
		if (t->ratings[_current_player] < 0 && AI_CHANCE16(1,4)) return false;
 
		if (t->ratings[_current_player] < 0 && AI_CHANCE16(1, 4)) return false;
 

	
 
		if (t->max_pass - t->act_pass < AI_CHECKCITY_NEEDED_CARGO && !AI_CHANCE16(1,AI_CHECKCITY_CITY_CHANCE)) return false;
 
		if (t->max_pass - t->act_pass < AI_CHECKCITY_NEEDED_CARGO && !AI_CHANCE16(1, AI_CHECKCITY_CITY_CHANCE)) return false;
 

	
 
		// Check if we have build a station in this town the last 6 months
 
		//  else we don't do it. This is done, because stat updates can be slow
 
@@ -275,7 +275,7 @@ static bool AiNew_Check_City_or_Industry
 
		int count = 0;
 
		int j = 0;
 

	
 
		if (i->town != NULL && i->town->ratings[_current_player] < 0 && AI_CHANCE16(1,4)) return false;
 
		if (i->town != NULL && i->town->ratings[_current_player] < 0 && AI_CHANCE16(1, 4)) return false;
 

	
 
		// No limits on delevering stations!
 
		//  Or for industry that does not give anything yet
 
@@ -642,8 +642,8 @@ static void AiNew_State_FindStation(Play
 
		int r;
 
		uint best;
 
		uint accepts[NUM_CARGO];
 
		TileIndex found_spot[AI_FINDSTATION_TILE_RANGE*AI_FINDSTATION_TILE_RANGE*4];
 
		uint found_best[AI_FINDSTATION_TILE_RANGE*AI_FINDSTATION_TILE_RANGE*4];
 
		TileIndex found_spot[AI_FINDSTATION_TILE_RANGE*AI_FINDSTATION_TILE_RANGE * 4];
 
		uint found_best[AI_FINDSTATION_TILE_RANGE*AI_FINDSTATION_TILE_RANGE * 4];
 
		// To find a good spot we scan a range from the center, a get the point
 
		//  where we get the most cargo and where it is buildable.
 
		// TODO: also check for station of myself and make sure we are not
 
@@ -961,13 +961,13 @@ static void AiNew_State_VerifyRoute(Play
 

	
 
	// Now we can build the route, check the direction of the stations!
 
	if (p->ainew.from_direction == AI_PATHFINDER_NO_DIRECTION) {
 
		p->ainew.from_direction = AiNew_GetDirection(p->ainew.path_info.route[p->ainew.path_info.route_length-1], p->ainew.path_info.route[p->ainew.path_info.route_length-2]);
 
		p->ainew.from_direction = AiNew_GetDirection(p->ainew.path_info.route[p->ainew.path_info.route_length - 1], p->ainew.path_info.route[p->ainew.path_info.route_length - 2]);
 
	}
 
	if (p->ainew.to_direction == AI_PATHFINDER_NO_DIRECTION) {
 
		p->ainew.to_direction = AiNew_GetDirection(p->ainew.path_info.route[0], p->ainew.path_info.route[1]);
 
	}
 
	if (p->ainew.from_tile == AI_STATION_RANGE)
 
		p->ainew.from_tile = p->ainew.path_info.route[p->ainew.path_info.route_length-1];
 
		p->ainew.from_tile = p->ainew.path_info.route[p->ainew.path_info.route_length - 1];
 
	if (p->ainew.to_tile == AI_STATION_RANGE)
 
		p->ainew.to_tile = p->ainew.path_info.route[0];
 

	
src/airport_gui.cpp
Show inline comments
 
@@ -105,7 +105,7 @@ static void BuildAirToolbWndProc(Window 
 

	
 
		w = FindWindowById(WC_BUILD_STATION, 0);
 
		if (w != 0)
 
			WP(w,def_d).close = true;
 
			WP(w, def_d).close = true;
 
		break;
 

	
 
	case WE_DESTROY:
 
@@ -155,7 +155,7 @@ static void BuildAirportPickerWndProc(Wi
 
		uint32 avail_airports;
 
		const AirportFTAClass *airport;
 

	
 
		if (WP(w,def_d).close) return;
 
		if (WP(w, def_d).close) return;
 

	
 
		avail_airports = GetValidAirports();
 

	
 
@@ -207,7 +207,7 @@ static void BuildAirportPickerWndProc(Wi
 
	} break;
 

	
 
	case WE_MOUSELOOP: {
 
		if (WP(w,def_d).close) {
 
		if (WP(w, def_d).close) {
 
			DeleteWindow(w);
 
			return;
 
		}
 
@@ -216,7 +216,7 @@ static void BuildAirportPickerWndProc(Wi
 
	} break;
 

	
 
	case WE_DESTROY:
 
		if (!WP(w,def_d).close) ResetObjectToPlace();
 
		if (!WP(w, def_d).close) ResetObjectToPlace();
 
		break;
 
	}
 
}
src/autoreplace_cmd.cpp
Show inline comments
 
@@ -137,7 +137,7 @@ static CargoID GetNewCargoTypeForReplace
 
		/* Now we found a cargo type being carried on the train and we will see if it is possible to carry to this one */
 
		if (v->cargo_type == new_cargo_type) return CT_NO_REFIT;
 
		if (CanRefitTo(engine_type, v->cargo_type)) return v->cargo_type;
 
	} while ((v=v->next) != NULL);
 
	} while ((v = v->next) != NULL);
 
	return CT_NO_REFIT; // We failed to find a cargo type on the old vehicle and we will not refit the new one
 
}
 

	
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -312,19 +312,19 @@ static EngList_SortTypeFunction * const 
 
	&TrainEngineRunningCostSorter,
 
	&TrainEnginePowerVsRunningCostSorter,
 
	&EngineReliabilitySorter,
 
},{
 
}, {
 
	/* Road vehicles */
 
	&EngineNumberSorter,
 
	&EngineIntroDateSorter,
 
	&EngineNameSorter,
 
	&EngineReliabilitySorter,
 
},{
 
}, {
 
	/* Ships */
 
	&EngineNumberSorter,
 
	&EngineIntroDateSorter,
 
	&EngineNameSorter,
 
	&EngineReliabilitySorter,
 
},{
 
}, {
 
	/* Aircraft */
 
	&EngineNumberSorter,
 
	&AircraftEngineCostSorter,
 
@@ -348,21 +348,21 @@ static const StringID _sort_listing[][10
 
	STR_ENGINE_SORT_POWER_VS_RUNNING_COST,
 
	STR_SORT_BY_RELIABILITY,
 
	INVALID_STRING_ID
 
},{
 
}, {
 
	/* Road vehicles */
 
	STR_ENGINE_SORT_ENGINE_ID,
 
	STR_ENGINE_SORT_INTRO_DATE,
 
	STR_SORT_BY_DROPDOWN_NAME,
 
	STR_SORT_BY_RELIABILITY,
 
	INVALID_STRING_ID
 
},{
 
}, {
 
	/* Ships */
 
	STR_ENGINE_SORT_ENGINE_ID,
 
	STR_ENGINE_SORT_INTRO_DATE,
 
	STR_SORT_BY_DROPDOWN_NAME,
 
	STR_SORT_BY_RELIABILITY,
 
	INVALID_STRING_ID
 
},{
 
}, {
 
	/* Aircraft */
 
	STR_ENGINE_SORT_ENGINE_ID,
 
	STR_ENGINE_SORT_COST,
 
@@ -392,7 +392,7 @@ static int DrawRailWagonPurchaseInfo(int
 
	/* Wagon speed limit, displayed if above zero */
 
	if (rvi->max_speed > 0 && _patches.wagon_speed_limits) {
 
		SetDParam(0, rvi->max_speed * 10 / 16);
 
		DrawString(x,y, STR_PURCHASE_INFO_SPEED, 0);
 
		DrawString(x, y, STR_PURCHASE_INFO_SPEED, 0);
 
		y += 10;
 
	}
 
	return y;
 
@@ -406,13 +406,13 @@ static int DrawRailEnginePurchaseInfo(in
 
	/* Purchase Cost - Engine weight */
 
	SetDParam(0, rvi->base_cost * (_price.build_railvehicle >> 3) >> 5);
 
	SetDParam(1, rvi->weight << multihead);
 
	DrawString(x,y, STR_PURCHASE_INFO_COST_WEIGHT, 0);
 
	DrawString(x, y, STR_PURCHASE_INFO_COST_WEIGHT, 0);
 
	y += 10;
 

	
 
	/* Max speed - Engine power */
 
	SetDParam(0, rvi->max_speed * 10 / 16);
 
	SetDParam(1, rvi->power << multihead);
 
	DrawString(x,y, STR_PURCHASE_INFO_SPEED_POWER, 0);
 
	DrawString(x, y, STR_PURCHASE_INFO_SPEED_POWER, 0);
 
	y += 10;
 

	
 
	/* Max tractive effort - not applicable if old acceleration or maglev */
 
@@ -424,14 +424,14 @@ static int DrawRailEnginePurchaseInfo(in
 

	
 
	/* Running cost */
 
	SetDParam(0, (rvi->running_cost_base * _price.running_rail[rvi->running_cost_class] >> 8) << multihead);
 
	DrawString(x,y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
 
	DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
 
	y += 10;
 

	
 
	/* Powered wagons power - Powered wagons extra weight */
 
	if (rvi->pow_wag_power != 0) {
 
		SetDParam(0, rvi->pow_wag_power);
 
		SetDParam(1, rvi->pow_wag_weight);
 
		DrawString(x,y, STR_PURCHASE_INFO_PWAGPOWER_PWAGWEIGHT, 0);
 
		DrawString(x, y, STR_PURCHASE_INFO_PWAGPOWER_PWAGWEIGHT, 0);
 
		y += 10;
 
	};
 

	
 
@@ -444,7 +444,7 @@ static int DrawRoadVehPurchaseInfo(int x
 
	bool refittable = (_engine_info[engine_number].refit_mask != 0);
 

	
 
	/* Purchase cost - Max speed */
 
	SetDParam(0, rvi->base_cost * (_price.roadveh_base>>3)>>5);
 
	SetDParam(0, rvi->base_cost * (_price.roadveh_base >> 3) >> 5);
 
	SetDParam(1, rvi->max_speed * 10 / 32);
 
	DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, 0);
 
	y += 10;
 
@@ -468,21 +468,21 @@ static int DrawRoadVehPurchaseInfo(int x
 
static int DrawShipPurchaseInfo(int x, int y, EngineID engine_number, const ShipVehicleInfo *svi)
 
{
 
	/* Purchase cost - Max speed */
 
	SetDParam(0, svi->base_cost * (_price.ship_base>>3)>>5);
 
	SetDParam(0, svi->base_cost * (_price.ship_base >> 3) >> 5);
 
	SetDParam(1, svi->max_speed * 10 / 32);
 
	DrawString(x,y, STR_PURCHASE_INFO_COST_SPEED, 0);
 
	DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, 0);
 
	y += 10;
 

	
 
	/* Cargo type + capacity */
 
	SetDParam(0, svi->cargo_type);
 
	SetDParam(1, svi->capacity);
 
	SetDParam(2, svi->refittable ? STR_9842_REFITTABLE : STR_EMPTY);
 
	DrawString(x,y, STR_PURCHASE_INFO_CAPACITY, 0);
 
	DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, 0);
 
	y += 10;
 

	
 
	/* Running cost */
 
	SetDParam(0, svi->running_cost * _price.ship_running >> 8);
 
	DrawString(x,y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
 
	DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
 
	y += 10;
 

	
 
	return y;
 
@@ -494,7 +494,7 @@ static int DrawAircraftPurchaseInfo(int 
 
	CargoID cargo;
 

	
 
	/* Purchase cost - Max speed */
 
	SetDParam(0, avi->base_cost * (_price.aircraft_base>>3)>>5);
 
	SetDParam(0, avi->base_cost * (_price.aircraft_base >> 3) >> 5);
 
	SetDParam(1, avi->max_speed * 10 / 16);
 
	DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, 0);
 
	y += 10;
 
@@ -560,7 +560,7 @@ int DrawVehiclePurchaseInfo(int x, int y
 
				SetDParam(1, (rvi->capacity * (CountArticulatedParts(engine_number) + 1)) << multihead);
 
				SetDParam(2, refitable ? STR_9842_REFITTABLE : STR_EMPTY);
 
			}
 
			DrawString(x,y, STR_PURCHASE_INFO_CAPACITY, 0);
 
			DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, 0);
 
			y += 10;
 
		}
 
			break;
 
@@ -1001,7 +1001,7 @@ void ShowBuildVehicleWindow(TileIndex ti
 

	
 
	switch (type) {
 
		case VEH_TRAIN:
 
			WP(w,buildvehicle_d).filter.railtype = (tile == 0) ? RAILTYPE_END : GetRailType(tile);
 
			WP(w, buildvehicle_d).filter.railtype = (tile == 0) ? RAILTYPE_END : GetRailType(tile);
 
			ResizeWindow(w, 0, 16);
 
			break;
 
		case VEH_ROAD:
src/clear_cmd.cpp
Show inline comments
 
@@ -79,7 +79,7 @@ static void TerraformAddDirtyTile(Terraf
 

	
 
	if (count >= 625) return;
 

	
 
	for (t = ts->tile_table; count != 0; count--,t++) {
 
	for (t = ts->tile_table; count != 0; count--, t++) {
 
		if (*t == tile) return;
 
	}
 

	
 
@@ -141,7 +141,7 @@ static int TerraformProc(TerraformerStat
 
		}
 
	}
 

	
 
	ret = DoCommand(tile, 0,0, ts->flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR);
 
	ret = DoCommand(tile, 0, 0, ts->flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR);
 

	
 
	if (CmdFailed(ret)) {
 
		_terraform_err_tile = tile;
 
@@ -215,8 +215,8 @@ static bool TerraformTileHeight(Terrafor
 
			tile += ToTileIndexDiff(*ttm);
 

	
 
			r = TerraformGetHeightOfTile(ts, tile);
 
			if (r != height && r-direction != height && r+direction != height) {
 
				if (!TerraformTileHeight(ts, tile, r+direction))
 
			if (r != height && r - direction != height && r + direction != height) {
 
				if (!TerraformTileHeight(ts, tile, r + direction))
 
					return false;
 
			}
 
		}
 
@@ -382,8 +382,8 @@ int32 CmdLevelLand(TileIndex tile, uint3
 
	if (ey < sy) Swap(ey, sy);
 
	tile = TileXY(sx, sy);
 

	
 
	size_x = ex-sx+1;
 
	size_y = ey-sy+1;
 
	size_x = ex - sx + 1;
 
	size_y = ey - sy + 1;
 

	
 
	money = GetAvailableMoneyForCommand();
 
	cost = 0;
src/command.cpp
Show inline comments
 
@@ -407,7 +407,7 @@ int32 GetAvailableMoneyForCommand()
 
 * the callback is called when the command succeeded or failed. */
 
bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback, uint32 cmd)
 
{
 
	int32 res = 0,res2;
 
	int32 res = 0, res2;
 
	CommandProc *proc;
 
	uint32 flags;
 
	bool notest;
 
@@ -544,7 +544,7 @@ bool DoCommandP(TileIndex tile, uint32 p
 
		if (res2 != 0) ShowCostOrIncomeAnimation(x, y, GetSlopeZ(x, y), res2);
 
		if (_additional_cash_required) {
 
			SetDParam(0, _additional_cash_required);
 
			ShowErrorMessage(STR_0003_NOT_ENOUGH_CASH_REQUIRES, error_part1, x,y);
 
			ShowErrorMessage(STR_0003_NOT_ENOUGH_CASH_REQUIRES, error_part1, x, y);
 
			if (res2 == 0) goto callb_err;
 
		}
 
	}
 
@@ -558,7 +558,7 @@ bool DoCommandP(TileIndex tile, uint32 p
 
show_error:
 
	/* show error message if the command fails? */
 
	if (IsLocalPlayer() && error_part1 != 0) {
 
		ShowErrorMessage(_error_message, error_part1, x,y);
 
		ShowErrorMessage(_error_message, error_part1, x, y);
 
	}
 

	
 
callb_err:
src/command.h
Show inline comments
 
@@ -158,7 +158,7 @@ enum {
 
	CMD_ERROR = ((int32)0x80000000),
 
};
 

	
 
#define CMD_MSG(x) ((x)<<16)
 
#define CMD_MSG(x) ((x) << 16)
 

	
 
enum {
 
	CMD_AUTO                  = 0x0200,
src/disaster_cmd.cpp
Show inline comments
 
@@ -233,7 +233,7 @@ static void DisasterTick_Zeppeliner(Vehi
 

	
 
				SetDParam(0, GetStationIndex(tile));
 
				AddNewsItem(STR_B000_ZEPPELIN_DISASTER_AT,
 
					NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
 
					NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, 0),
 
					v->index,
 
					0);
 
			}
 
@@ -263,7 +263,7 @@ static void DisasterTick_Zeppeliner(Vehi
 

	
 
	x = v->x_pos;
 
	y = v->y_pos;
 
	z = GetSlopeZ(x,y);
 
	z = GetSlopeZ(x, y);
 
	if (z < v->z_pos) z = v->z_pos - 1;
 
	SetDisasterVehiclePos(v, x, y, z);
 

	
 
@@ -359,14 +359,14 @@ static void DisasterTick_Ufo(Vehicle *v)
 
		if (dist <= TILE_SIZE && z > u->z_pos) z--;
 
		SetDisasterVehiclePos(v, gp.x, gp.y, z);
 

	
 
		if (z <= u->z_pos && (u->vehstatus & VS_HIDDEN)==0) {
 
		if (z <= u->z_pos && (u->vehstatus & VS_HIDDEN) == 0) {
 
			v->age++;
 
			if (u->u.road.crashed_ctr == 0) {
 
				u->u.road.crashed_ctr++;
 
				u->vehstatus |= VS_CRASHED;
 

	
 
				AddNewsItem(STR_B001_ROAD_VEHICLE_DESTROYED,
 
					NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
 
					NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, 0),
 
					u->index,
 
					0);
 
			}
 
@@ -441,7 +441,7 @@ static void DisasterTick_Airplane(Vehicl
 
			DestructIndustry(i);
 

	
 
			SetDParam(0, i->town->index);
 
			AddNewsItem(STR_B002_OIL_REFINERY_EXPLOSION, NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy, 0);
 
			AddNewsItem(STR_B002_OIL_REFINERY_EXPLOSION, NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, 0), i->xy, 0);
 
			SndPlayTileFx(SND_12_EXPLOSION, i->xy);
 
		}
 
	} else if (v->current_order.dest == 0) {
 
@@ -514,7 +514,7 @@ static void DisasterTick_Helicopter(Vehi
 
			DestructIndustry(i);
 

	
 
			SetDParam(0, i->town->index);
 
			AddNewsItem(STR_B003_FACTORY_DESTROYED_IN_SUSPICIOUS, NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy, 0);
 
			AddNewsItem(STR_B003_FACTORY_DESTROYED_IN_SUSPICIOUS, NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, 0), i->xy, 0);
 
			SndPlayTileFx(SND_12_EXPLOSION, i->xy);
 
		}
 
	} else if (v->current_order.dest == 0) {
 
@@ -600,7 +600,7 @@ static void DisasterTick_Big_Ufo(Vehicle
 
		t = ClosestTownFromTile(v->dest_tile, (uint)-1);
 
		SetDParam(0, t->index);
 
		AddNewsItem(STR_B004_UFO_LANDS_NEAR,
 
			NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ACCIDENT, 0),
 
			NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, 0),
 
			v->tile,
 
			0);
 

	
 
@@ -951,7 +951,7 @@ static void Disaster_Small_Submarine_Ini
 
static void Disaster_Big_Submarine_Init()
 
{
 
	Vehicle *v = ForceAllocateSpecialVehicle();
 
	int x,y;
 
	int x, y;
 
	Direction dir;
 
	uint32 r;
 

	
 
@@ -986,7 +986,7 @@ static void Disaster_CoalMine_Init()
 
			if ((GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_CAN_SUBSIDENCE) && --index < 0) {
 
				SetDParam(0, i->town->index);
 
				AddNewsItem(STR_B005_COAL_MINE_SUBSIDENCE_LEAVES,
 
					NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy + TileDiffXY(1, 1), 0);
 
					NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, 0), i->xy + TileDiffXY(1, 1), 0);
 

	
 
				{
 
					TileIndex tile = i->xy;
src/dock_gui.cpp
Show inline comments
 
@@ -165,10 +165,10 @@ static void BuildDocksToolbWndProc(Windo
 
		RaiseWindowButtons(w);
 

	
 
		w = FindWindowById(WC_BUILD_STATION, 0);
 
		if (w != NULL) WP(w,def_d).close = true;
 
		if (w != NULL) WP(w, def_d).close = true;
 

	
 
		w = FindWindowById(WC_BUILD_DEPOT, 0);
 
		if (w != NULL) WP(w,def_d).close = true;
 
		if (w != NULL) WP(w, def_d).close = true;
 
		break;
 

	
 
	case WE_PLACE_PRESIZE: {
 
@@ -233,7 +233,7 @@ static void BuildDockStationWndProc(Wind
 
	case WE_PAINT: {
 
		int rad;
 

	
 
		if (WP(w,def_d).close) return;
 
		if (WP(w, def_d).close) return;
 
		DrawWindowWidgets(w);
 

	
 
		rad = (_patches.modified_catchment) ? CA_DOCK : 4;
 
@@ -258,7 +258,7 @@ static void BuildDockStationWndProc(Wind
 
		break;
 

	
 
	case WE_MOUSELOOP:
 
		if (WP(w,def_d).close) {
 
		if (WP(w, def_d).close) {
 
			DeleteWindow(w);
 
			return;
 
		}
 
@@ -267,7 +267,7 @@ static void BuildDockStationWndProc(Wind
 
		break;
 

	
 
	case WE_DESTROY:
 
		if (!WP(w,def_d).close) ResetObjectToPlace();
 
		if (!WP(w, def_d).close) ResetObjectToPlace();
 
		break;
 
	}
 
}
 
@@ -333,11 +333,11 @@ static void BuildDocksDepotWndProc(Windo
 
	} break;
 

	
 
	case WE_MOUSELOOP:
 
		if (WP(w,def_d).close) DeleteWindow(w);
 
		if (WP(w, def_d).close) DeleteWindow(w);
 
		break;
 

	
 
	case WE_DESTROY:
 
		if (!WP(w,def_d).close) ResetObjectToPlace();
 
		if (!WP(w, def_d).close) ResetObjectToPlace();
 
		break;
 
	}
 
}
src/gfx.cpp
Show inline comments
 
@@ -201,7 +201,7 @@ void GfxFillRect(int left, int top, int 
 
static void GfxSetPixel(int x, int y, int color)
 
{
 
	const DrawPixelInfo* dpi = _cur_dpi;
 
	if ((x-=dpi->left) < 0 || x>=dpi->width || (y-=dpi->top)<0 || y>=dpi->height)
 
	if ((x -= dpi->left) < 0 || x >= dpi->width || (y -= dpi->top)<0 || y >= dpi->height)
 
		return;
 
	dpi->dst_ptr[y * dpi->pitch + x] = color;
 
}
 
@@ -461,7 +461,7 @@ uint32 FormatStringLinebreaks(char *str,
 
				switch (c) {
 
					case '\0': return num + (size << 16); break;
 
					case SCC_SETX:  str++; break;
 
					case SCC_SETXY: str +=2; break;
 
					case SCC_SETXY: str += 2; break;
 
					case SCC_TINYFONT: size = FS_SMALL; break;
 
					case SCC_BIGFONT:  size = FS_LARGE; break;
 
					case '\n': goto end_of_inner_loop;
 
@@ -509,7 +509,7 @@ void DrawStringMultiCenter(int x, int y,
 

	
 
	for (;;) {
 
		w = GetStringBoundingBox(src).width;
 
		DoDrawString(src, x - (w>>1), y, 0xFE);
 
		DoDrawString(src, x - (w >> 1), y, 0xFE);
 
		_cur_fontsize = _last_fontsize;
 

	
 
		for (;;) {
 
@@ -524,7 +524,7 @@ void DrawStringMultiCenter(int x, int y,
 
			} else if (c == SCC_SETX) {
 
				src++;
 
			} else if (c == SCC_SETXY) {
 
				src+=2;
 
				src += 2;
 
			}
 
		}
 
	}
 
@@ -574,7 +574,7 @@ uint DrawStringMultiLine(int x, int y, S
 
			} else if (c == SCC_SETX) {
 
				src++;
 
			} else if (c == SCC_SETXY) {
 
				src+=2;
 
				src += 2;
 
			}
 
		}
 
	}
 
@@ -643,7 +643,7 @@ int DoDrawString(const char *string, int
 

	
 
	if (color != 0xFE) {
 
		if (x >= dpi->left + dpi->width ||
 
				x + _screen.width*2 <= dpi->left ||
 
				x + _screen.width * 2 <= dpi->left ||
 
				y >= dpi->top + dpi->height ||
 
				y + _screen.height <= dpi->top)
 
					return x;
src/graph_gui.cpp
Show inline comments
 
@@ -222,7 +222,7 @@ static void DrawGraph(const GraphDrawer 
 
					y = gw->top + x_axis_offset - (x_axis_offset * datapoint) / highest_value;
 

	
 
					/* Draw the point. */
 
					GfxFillRect(x-1, y-1, x+1, y+1, color);
 
					GfxFillRect(x - 1, y - 1, x + 1, y + 1, color);
 

	
 
					/* Draw the line connected to the previous point. */
 
					if (prev_x != INVALID_DATAPOINT_POS) GfxDrawLine(prev_x, prev_y, x, y, color);
 
@@ -268,7 +268,7 @@ static void GraphLegendWndProc(Window *w
 
			FOR_ALL_PLAYERS(p) {
 
				if (!p->is_active) continue;
 

	
 
				DrawPlayerIcon(p->index, 4, 18+p->index*12);
 
				DrawPlayerIcon(p->index, 4, 18 + p->index * 12);
 

	
 
				SetDParam(0, p->name_1);
 
				SetDParam(1, p->name_2);
 
@@ -330,7 +330,7 @@ static void SetupGraphDrawerForPlayers(G
 
	const Player* p;
 
	uint excluded_players = _legend_excluded_players;
 
	byte nums;
 
	int mo,yr;
 
	int mo, yr;
 

	
 
	/* Exclude the players which aren't valid */
 
	FOR_ALL_PLAYERS(p) {
 
@@ -908,7 +908,7 @@ static const WindowDesc _company_league_
 

	
 
void ShowCompanyLeagueTable()
 
{
 
	AllocateWindowDescFront(&_company_league_desc,0);
 
	AllocateWindowDescFront(&_company_league_desc, 0);
 
}
 

	
 
/*****************************/
src/industry_cmd.cpp
Show inline comments
 
@@ -69,7 +69,7 @@ IndustryType GetIndustryType(TileIndex t
 

	
 
	for (iloop = IT_COAL_MINE; iloop < IT_END; iloop += 1) {
 
		if (IS_BYTE_INSIDE(this_type, industry_gfx_Solver[iloop].MinGfx,
 
				industry_gfx_Solver[iloop].MaxGfx+1)) {
 
				industry_gfx_Solver[iloop].MaxGfx + 1)) {
 
			return iloop;
 
		}
 
	}
 
@@ -496,7 +496,7 @@ static void AnimateTile_Industry(TileInd
 
	case GFX_OILWELL_ANIMATED_2:
 
	case GFX_OILWELL_ANIMATED_3:
 
		if ((_tick_counter & 7) == 0) {
 
			bool b = CHANCE16(1,7);
 
			bool b = CHANCE16(1, 7);
 
			IndustryGfx gfx = GetIndustryGfx(tile);
 

	
 
			m = GetIndustryAnimationState(tile) + 1;
 
@@ -705,7 +705,7 @@ static void TileLoop_Industry(TileIndex 
 
		break;
 

	
 
	case GFX_POWERPLANT_SPARKS:
 
		if (CHANCE16(1,3)) {
 
		if (CHANCE16(1, 3)) {
 
			SndPlayTileFx(SND_0C_ELECTRIC_SPARK, tile);
 
			AddAnimatedTile(tile);
 
		}
 
@@ -964,7 +964,7 @@ static void ProduceIndustryGoods(Industr
 

	
 
	/* play a sound? */
 
	if ((i->counter & 0x3F) == 0) {
 
		if (CHANCE16R(1,14,r) && (num=_industry_sounds[i->type][0]) != 0) {
 
		if (CHANCE16R(1, 14, r) && (num = _industry_sounds[i->type][0]) != 0) {
 
			SndPlayTileFx(
 
				(SoundFx)(_industry_sounds[i->type][1] + (((r >> 16) * num) >> 16)),
 
				i->xy);
 
@@ -1668,7 +1668,7 @@ static void ExtChangeIndustryProduction(
 
					SetDParam(1, i->index);
 
					AddNewsItem(
 
						percent >= 0 ? STR_INDUSTRY_PROD_GOUP : STR_INDUSTRY_PROD_GODOWN,
 
						NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY, 0),
 
						NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ECONOMY, 0),
 
						i->xy + TileDiffXY(1, 1), 0
 
					);
 
				}
 
@@ -1682,7 +1682,7 @@ static void ExtChangeIndustryProduction(
 
		SetDParam(0, i->index);
 
		AddNewsItem(
 
			indspec->closure_text,
 
			NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_OPENCLOSE, 0),
 
			NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_OPENCLOSE, 0),
 
			i->xy + TileDiffXY(1, 1), 0
 
		);
 
	}
 
@@ -1698,7 +1698,7 @@ static void UpdateIndustryStatistics(Ind
 
		pct = 0;
 
		if (i->last_mo_production[0] != 0) {
 
			i->last_prod_year = _cur_year;
 
			pct = min(i->last_mo_transported[0] * 256 / i->last_mo_production[0],255);
 
			pct = min(i->last_mo_transported[0] * 256 / i->last_mo_production[0], 255);
 
		}
 
		i->pct_transported[0] = pct;
 

	
 
@@ -1714,7 +1714,7 @@ static void UpdateIndustryStatistics(Ind
 
		pct = 0;
 
		if (i->last_mo_production[1] != 0) {
 
			i->last_prod_year = _cur_year;
 
			pct = min(i->last_mo_transported[1] * 256 / i->last_mo_production[1],255);
 
			pct = min(i->last_mo_transported[1] * 256 / i->last_mo_production[1], 255);
 
		}
 
		i->pct_transported[1] = pct;
 

	
 
@@ -1791,7 +1791,7 @@ static void MaybeNewIndustry(void)
 
	SetDParam(0, ind_spc->name);
 
	SetDParam(1, ind->town->index);
 
	AddNewsItem(ind_spc->new_industry_text,
 
		NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_OPENCLOSE, 0), ind->xy, 0);
 
		NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_OPENCLOSE, 0), ind->xy, 0);
 
}
 

	
 
static void ChangeIndustryProduction(Industry *i)
 
@@ -1810,9 +1810,9 @@ static void ChangeIndustryProduction(Ind
 
			if ((indspec->behaviour & INDUSTRYBEH_DONT_INCR_PROD) && _opt.landscape == LT_TEMPERATE)
 
				only_decrease = true;
 

	
 
			if (only_decrease || CHANCE16(1,3)) {
 
			if (only_decrease || CHANCE16(1, 3)) {
 
				/* If you transport > 60%, 66% chance we increase, else 33% chance we increase */
 
				if (!only_decrease && (i->pct_transported[0] > 153) != CHANCE16(1,3)) {
 
				if (!only_decrease && (i->pct_transported[0] > 153) != CHANCE16(1, 3)) {
 
					/* Increase production */
 
					if (i->prod_level != 0x80) {
 
						byte b;
 
@@ -1849,7 +1849,7 @@ static void ChangeIndustryProduction(Ind
 

	
 
		case INDUSTRYLIFE_CLOSABLE:
 
			/* maybe close */
 
			if ( (byte)(_cur_year - i->last_prod_year) >= 5 && CHANCE16(1,2)) {
 
			if ( (byte)(_cur_year - i->last_prod_year) >= 5 && CHANCE16(1, 2)) {
 
				i->prod_level = 0;
 
				str = indspec->closure_text;
 
			}
 
@@ -1858,7 +1858,7 @@ static void ChangeIndustryProduction(Ind
 

	
 
	if (str != STR_NULL) {
 
		SetDParam(0, i->index);
 
		AddNewsItem(str, NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, str == indspec->closure_text ? NT_OPENCLOSE : NT_ECONOMY, 0), i->xy + TileDiffXY(1, 1), 0);
 
		AddNewsItem(str, NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, str == indspec->closure_text ? NT_OPENCLOSE : NT_ECONOMY, 0), i->xy + TileDiffXY(1, 1), 0);
 
	}
 
}
 

	
src/industry_gui.cpp
Show inline comments
 
@@ -37,7 +37,7 @@ static void BuildIndustryWndProc(Window 
 
	case WE_PAINT:
 
		DrawWindowWidgets(w);
 
		if (_thd.place_mode == 1 && _thd.window_class == WC_BUILD_INDUSTRY) {
 
			int ind_type = _build_industry_types[_opt_ptr->landscape][WP(w,def_d).data_1];
 
			int ind_type = _build_industry_types[_opt_ptr->landscape][WP(w, def_d).data_1];
 

	
 
			SetDParam(0, (_price.build_industry >> 5) * GetIndustrySpec(ind_type)->cost_multiplier);
 
			DrawStringCentered(85, w->height - 21, STR_482F_COST, 0);
 
@@ -48,12 +48,12 @@ static void BuildIndustryWndProc(Window 
 
		int wid = e->we.click.widget;
 
		if (wid >= 3) {
 
			if (HandlePlacePushButton(w, wid, SPR_CURSOR_INDUSTRY, 1, NULL))
 
				WP(w,def_d).data_1 = wid - 3;
 
				WP(w, def_d).data_1 = wid - 3;
 
		}
 
	} break;
 

	
 
	case WE_PLACE_OBJ:
 
		if (DoCommandP(e->we.place.tile, _build_industry_types[_opt_ptr->landscape][WP(w,def_d).data_1], 0, NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY)))
 
		if (DoCommandP(e->we.place.tile, _build_industry_types[_opt_ptr->landscape][WP(w, def_d).data_1], 0, NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY)))
 
			ResetObjectToPlace();
 
		break;
 

	
 
@@ -274,7 +274,7 @@ static const WindowDesc * const _industr
 
void ShowBuildIndustryWindow()
 
{
 
	if (!IsValidPlayer(_current_player)) return;
 
	AllocateWindowDescFront(_industry_window_desc[_patches.build_rawmaterial_ind][_opt_ptr->landscape],0);
 
	AllocateWindowDescFront(_industry_window_desc[_patches.build_rawmaterial_ind][_opt_ptr->landscape], 0);
 
}
 

	
 
static inline bool isProductionMinimum(const Industry *i, int pt) {
 
@@ -330,7 +330,7 @@ static void IndustryViewWndProc(Window *
 
			DrawString(4 + (IsProductionAlterable(i) ? 30 : 0), 127, STR_482B_TRANSPORTED, 0);
 
			/* Let's put out those buttons.. */
 
			if (IsProductionAlterable(i)) {
 
				DrawArrowButtons(5, 127, 3, (WP(w,vp2_d).data_2 == 1) ? WP(w,vp2_d).data_3 : 0,
 
				DrawArrowButtons(5, 127, 3, (WP(w, vp2_d).data_2 == 1) ? WP(w, vp2_d).data_3 : 0,
 
						!isProductionMinimum(i, 0), !isProductionMaximum(i, 0));
 
			}
 

	
 
@@ -341,7 +341,7 @@ static void IndustryViewWndProc(Window *
 
				DrawString(4 + (IsProductionAlterable(i) ? 30 : 0), 137, STR_482B_TRANSPORTED, 0);
 
				/* Let's put out those buttons.. */
 
				if (IsProductionAlterable(i)) {
 
					DrawArrowButtons(5, 137, 3, (WP(w,vp2_d).data_2 == 2) ? WP(w,vp2_d).data_3 : 0,
 
					DrawArrowButtons(5, 137, 3, (WP(w, vp2_d).data_2 == 2) ? WP(w, vp2_d).data_3 : 0,
 
						!isProductionMinimum(i, 1), !isProductionMaximum(i, 1));
 
				}
 
			}
 
@@ -379,11 +379,11 @@ static void IndustryViewWndProc(Window *
 
					UpdateIndustryProduction(i);
 
					SetWindowDirty(w);
 
					w->flags4 |= 5 << WF_TIMEOUT_SHL;
 
					WP(w,vp2_d).data_2 = line+1;
 
					WP(w,vp2_d).data_3 = (x < 15 ? 1 : 2);
 
					WP(w, vp2_d).data_2 = line + 1;
 
					WP(w, vp2_d).data_3 = (x < 15 ? 1 : 2);
 
				} else if (IS_INT_INSIDE(x, 34, 160)) {
 
					/* clicked the text */
 
					WP(w,vp2_d).data_1 = line;
 
					WP(w, vp2_d).data_1 = line;
 
					SetDParam(0, i->production_rate[line] * 8);
 
					ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_CONFIG_GAME_PRODUCTION, 10, 100, w, CS_ALPHANUMERAL);
 
				}
 
@@ -397,15 +397,15 @@ static void IndustryViewWndProc(Window *
 
		}
 
		break;
 
	case WE_TIMEOUT:
 
		WP(w,vp2_d).data_2 = 0;
 
		WP(w,vp2_d).data_3 = 0;
 
		WP(w, vp2_d).data_2 = 0;
 
		WP(w, vp2_d).data_3 = 0;
 
		SetWindowDirty(w);
 
		break;
 

	
 
	case WE_ON_EDIT_TEXT:
 
		if (e->we.edittext.str[0] != '\0') {
 
			Industry* i = GetIndustry(w->window_number);
 
			int line = WP(w,vp2_d).data_1;
 
			int line = WP(w, vp2_d).data_1;
 

	
 
			i->production_rate[line] = clampu(atoi(e->we.edittext.str), 0, 255);
 
			UpdateIndustryProduction(i);
 
@@ -449,9 +449,9 @@ void ShowIndustryViewWindow(int industry
 

	
 
	if (w != NULL) {
 
		w->flags4 |= WF_DISABLE_VP_SCROLL;
 
		WP(w,vp2_d).data_1 = 0;
 
		WP(w,vp2_d).data_2 = 0;
 
		WP(w,vp2_d).data_3 = 0;
 
		WP(w, vp2_d).data_1 = 0;
 
		WP(w, vp2_d).data_2 = 0;
 
		WP(w, vp2_d).data_3 = 0;
 
		AssignWindowViewport(w, 3, 17, 0xFE, 0x56, GetIndustry(w->window_number)->xy + TileDiffXY(1, 1), 1);
 
	}
 
}
 
@@ -599,7 +599,7 @@ static void IndustryDirectoryWndProc(Win
 
		SetVScrollCount(w, _num_industry_sort);
 

	
 
		DrawWindowWidgets(w);
 
		DoDrawString(_industry_sort_order & 1 ? DOWNARROW : UPARROW, _indicator_positions[_industry_sort_order>>1], 15, 0x10);
 
		DoDrawString(_industry_sort_order & 1 ? DOWNARROW : UPARROW, _indicator_positions[_industry_sort_order >> 1], 15, 0x10);
 

	
 
		p = w->vscroll.pos;
 
		n = 0;
 
@@ -617,13 +617,13 @@ static void IndustryDirectoryWndProc(Win
 
					SetDParam(4, i->total_production[1]);
 
					SetDParam(5, i->pct_transported[0] * 100 >> 8);
 
					SetDParam(6, i->pct_transported[1] * 100 >> 8);
 
					DrawString(4, 28+n*10, STR_INDUSTRYDIR_ITEM_TWO, 0);
 
					DrawString(4, 28 + n * 10, STR_INDUSTRYDIR_ITEM_TWO, 0);
 
				} else {
 
					SetDParam(3, i->pct_transported[0] * 100 >> 8);
 
					DrawString(4, 28+n*10, STR_INDUSTRYDIR_ITEM, 0);
 
					DrawString(4, 28 + n * 10, STR_INDUSTRYDIR_ITEM, 0);
 
				}
 
			} else {
 
				DrawString(4, 28+n*10, STR_INDUSTRYDIR_ITEM_NOPROD, 0);
 
				DrawString(4, 28 + n * 10, STR_INDUSTRYDIR_ITEM_NOPROD, 0);
 
			}
 
			p++;
 
			if (++n == w->vscroll.cap) break;
 
@@ -633,25 +633,25 @@ static void IndustryDirectoryWndProc(Win
 
	case WE_CLICK:
 
		switch (e->we.click.widget) {
 
		case 3: {
 
			_industry_sort_order = _industry_sort_order==0 ? 1 : 0;
 
			_industry_sort_order = _industry_sort_order == 0 ? 1 : 0;
 
			_industry_sort_dirty = true;
 
			SetWindowDirty(w);
 
		} break;
 

	
 
		case 4: {
 
			_industry_sort_order = _industry_sort_order==2 ? 3 : 2;
 
			_industry_sort_order = _industry_sort_order == 2 ? 3 : 2;
 
			_industry_sort_dirty = true;
 
			SetWindowDirty(w);
 
		} break;
 

	
 
		case 5: {
 
			_industry_sort_order = _industry_sort_order==4 ? 5 : 4;
 
			_industry_sort_order = _industry_sort_order == 4 ? 5 : 4;
 
			_industry_sort_dirty = true;
 
			SetWindowDirty(w);
 
		} break;
 

	
 
		case 6: {
 
			_industry_sort_order = _industry_sort_order==6 ? 7 : 6;
 
			_industry_sort_order = _industry_sort_order == 6 ? 7 : 6;
 
			_industry_sort_dirty = true;
 
			SetWindowDirty(w);
 
		} break;
src/landscape.cpp
Show inline comments
 
@@ -76,13 +76,13 @@ uint GetPartialZ(int x, int y, Slope cor
 
		break;
 

	
 
	case SLOPE_S:
 
		y^=0xF;
 
		y ^= 0xF;
 
		if ( (x - y) >= 0)
 
			z = (x - y) >> 1;
 
		break;
 

	
 
	case SLOPE_SW:
 
		z = (x>>1) + 1;
 
		z = (x >> 1) + 1;
 
		break;
 

	
 
	case SLOPE_E:
 
@@ -97,12 +97,12 @@ uint GetPartialZ(int x, int y, Slope cor
 
		break;
 

	
 
	case SLOPE_SE:
 
		z = (y>>1) + 1;
 
		z = (y >> 1) + 1;
 
		break;
 

	
 
	case SLOPE_WSE:
 
		z = 8;
 
		y^=0xF;
 
		y ^= 0xF;
 
		if (x - y < 0)
 
			z += (x - y) >> 1;
 
		break;
 
@@ -114,7 +114,7 @@ uint GetPartialZ(int x, int y, Slope cor
 
		break;
 

	
 
	case SLOPE_NW:
 
		z = (y^0xF)>>1;
 
		z = (y ^ 0xF) >> 1;
 
		break;
 

	
 
	case SLOPE_NWS:
 
@@ -124,7 +124,7 @@ uint GetPartialZ(int x, int y, Slope cor
 
		break;
 

	
 
	case SLOPE_NE:
 
		z = (x^0xF)>>1;
 
		z = (x ^ 0xF) >> 1;
 
		break;
 

	
 
	case SLOPE_ENW:
 
@@ -141,19 +141,19 @@ uint GetPartialZ(int x, int y, Slope cor
 
		break;
 

	
 
	case SLOPE_STEEP_S:
 
		z = 1 + ((x+y)>>1);
 
		z = 1 + ((x + y) >> 1);
 
		break;
 

	
 
	case SLOPE_STEEP_W:
 
		z = 1 + ((x+(y^0xF))>>1);
 
		z = 1 + ((x + (y ^ 0xF)) >> 1);
 
		break;
 

	
 
	case SLOPE_STEEP_N:
 
		z = 1 + (((x^0xF)+(y^0xF))>>1);
 
		z = 1 + (((x ^ 0xF) + (y ^ 0xF)) >> 1);
 
		break;
 

	
 
	case SLOPE_STEEP_E:
 
		z = 1 + (((x^0xF)+(y^0xF))>>1);
 
		z = 1 + (((x ^ 0xF) + (y ^ 0xF)) >> 1);
 
		break;
 

	
 
		default: break;
 
@@ -385,8 +385,8 @@ int32 CmdClearArea(TileIndex tile, uint3
 
	int32 cost, ret, money;
 
	int ex;
 
	int ey;
 
	int sx,sy;
 
	int x,y;
 
	int sx, sy;
 
	int x, y;
 
	bool success = false;
 

	
 
	if (p1 >= MapSize()) return CMD_ERROR;
 
@@ -435,7 +435,7 @@ int32 CmdClearArea(TileIndex tile, uint3
 

	
 
#define TILELOOP_BITS 4
 
#define TILELOOP_SIZE (1 << TILELOOP_BITS)
 
#define TILELOOP_ASSERTMASK ((TILELOOP_SIZE-1) + ((TILELOOP_SIZE-1) << MapLogX()))
 
#define TILELOOP_ASSERTMASK ((TILELOOP_SIZE - 1) + ((TILELOOP_SIZE - 1) << MapLogX()))
 
#define TILELOOP_CHKMASK (((1 << (MapLogX() - TILELOOP_BITS))-1) << TILELOOP_BITS)
 

	
 
void RunTileLoop()
src/macros.h
Show inline comments
 
@@ -82,9 +82,9 @@ template<typename T> static inline T TOG
 

	
 

	
 
/* checking more bits. Maybe unneccessary, but easy to use */
 
#define HASBITS(x,y) ((x) & (y))
 
#define SETBITS(x,y) ((x) |= (y))
 
#define CLRBITS(x,y) ((x) &= ~(y))
 
#define HASBITS(x, y) ((x) & (y))
 
#define SETBITS(x, y) ((x) |= (y))
 
#define CLRBITS(x, y) ((x) &= ~(y))
 

	
 
#define GENERAL_SPRITE_COLOR(color) ((color) + PALETTE_RECOLOR_START)
 
#define PLAYER_SPRITE_COLOR(owner) (GENERAL_SPRITE_COLOR(_player_colors[owner]))
 
@@ -98,7 +98,7 @@ extern const byte _ffb_64[128];
 
/* Returns x with the first bit that is not zero, counted from the left, set
 
 * to zero. So, 10110100 returns 10110000, 00000001 returns 00000000, etc.
 
 */
 
#define KILL_FIRST_BIT(x) _ffb_64[(x)+64]
 
#define KILL_FIRST_BIT(x) _ffb_64[(x) + 64]
 

	
 
static inline int FindFirstBit2x64(int value)
 
{
 
@@ -133,13 +133,13 @@ static inline int KillFirstBit2x64(int v
 
#define HAS_SINGLE_BIT(a) ( ((a) & ((a) - 1)) == 0)
 

	
 
/* [min,max), strictly less than */
 
#define IS_BYTE_INSIDE(a,min,max) ((byte)((a)-(min)) < (byte)((max)-(min)))
 
#define IS_INT_INSIDE(a,min,max) ((uint)((a)-(min)) < (uint)((max)-(min)))
 
#define IS_BYTE_INSIDE(a, min, max) ((byte)((a) - (min)) < (byte)((max) - (min)))
 
#define IS_INT_INSIDE(a, min, max) ((uint)((a) - (min)) < (uint)((max) - (min)))
 

	
 

	
 
#define CHANCE16(a,b) ((uint16)Random() <= (uint16)((65536 * (a)) / (b)))
 
#define CHANCE16R(a,b,r) ((uint16)(r=Random()) <= (uint16)((65536 * (a)) / (b)))
 
#define CHANCE16I(a,b,v) ((uint16)(v) <= (uint16)((65536 * (a)) / (b)))
 
#define CHANCE16(a, b) ((uint16)Random() <= (uint16)((65536 * (a)) / (b)))
 
#define CHANCE16R(a, b, r) ((uint16)(r = Random()) <= (uint16)((65536 * (a)) / (b)))
 
#define CHANCE16I(a, b, v) ((uint16)(v) <= (uint16)((65536 * (a)) / (b)))
 

	
 

	
 
#define for_each_bit(_i, _b)            \
src/map.cpp
Show inline comments
 
@@ -86,9 +86,9 @@ TileIndex TileAdd(TileIndex tile, TileIn
 
#endif
 
	}
 

	
 
	assert(TileXY(x,y) == TILE_MASK(tile + add));
 
	assert(TileXY(x, y) == TILE_MASK(tile + add));
 

	
 
	return TileXY(x,y);
 
	return TileXY(x, y);
 
}
 
#endif
 

	
 
@@ -98,7 +98,7 @@ uint ScaleByMapSize(uint n)
 
	/* First shift by 12 to prevent integer overflow for large values of n.
 
	 * >>12 is safe since the min mapsize is 64x64
 
	 * Add (1<<4)-1 to round upwards. */
 
	return (n * (MapSize() >> 12) + (1<<4) - 1) >> 4;
 
	return (n * (MapSize() >> 12) + (1 << 4) - 1) >> 4;
 
}
 

	
 

	
 
@@ -109,7 +109,7 @@ uint ScaleByMapSize1D(uint n)
 
	 * Note, not actually taking the full circumference into account,
 
	 * just half of it.
 
	 * (1<<9) - 1 is there to scale upwards. */
 
	return (n * (MapSizeX() + MapSizeY()) + (1<<9) - 1) >> 9;
 
	return (n * (MapSizeX() + MapSizeY()) + (1 << 9) - 1) >> 9;
 
}
 

	
 

	
src/map.h
Show inline comments
 
@@ -147,7 +147,7 @@ uint DistanceMaxPlusManhattan(TileIndex,
 
uint DistanceFromEdge(TileIndex); ///< shortest distance from any edge of the map
 

	
 

	
 
#define BEGIN_TILE_LOOP(var,w,h,tile)                      \
 
#define BEGIN_TILE_LOOP(var, w, h, tile)                      \
 
	{                                                        \
 
		int h_cur = h;                                         \
 
		uint var = tile;                                       \
 
@@ -155,7 +155,7 @@ uint DistanceFromEdge(TileIndex); ///< s
 
			int w_cur = w;                                       \
 
			do {
 

	
 
#define END_TILE_LOOP(var,w,h,tile)                        \
 
#define END_TILE_LOOP(var, w, h, tile)                        \
 
			} while (++var, --w_cur != 0);                       \
 
		} while (var += TileDiffXY(0, 1) - (w), --h_cur != 0); \
 
	}
src/misc.cpp
Show inline comments
 
@@ -286,7 +286,7 @@ static void Load_NAME()
 
	int index;
 

	
 
	while ((index = SlIterateArray()) != -1) {
 
		SlArray(_name_array[index],SlGetFieldLength(),SLE_UINT8);
 
		SlArray(_name_array[index], SlGetFieldLength(), SLE_UINT8);
 
	}
 
}
 

	
src/misc_gui.cpp
Show inline comments
 
@@ -1457,7 +1457,7 @@ static void SaveLoadDlgWndProc(Window *w
 
		}
 

	
 
		if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO) {
 
			DrawEditBox(w, &WP(w,querystr_d), 10);
 
			DrawEditBox(w, &WP(w, querystr_d), 10);
 
		}
 
		break;
 
	}
 
@@ -1550,7 +1550,7 @@ static void SaveLoadDlgWndProc(Window *w
 
		if (!(_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO)) break;
 

	
 
		if (IsWindowWidgetLowered(w, 11)) { // Delete button clicked
 
			if (!FiosDelete(WP(w,querystr_d).text.buf)) {
 
			if (!FiosDelete(WP(w, querystr_d).text.buf)) {
 
				ShowErrorMessage(INVALID_STRING_ID, STR_4008_UNABLE_TO_DELETE_FILE, 0, 0);
 
			} else {
 
				BuildFileList();
 
@@ -1562,7 +1562,7 @@ static void SaveLoadDlgWndProc(Window *w
 
			SetWindowDirty(w);
 
		} else if (IsWindowWidgetLowered(w, 12)) { // Save button clicked
 
			_switch_mode = SM_SAVE;
 
			FiosMakeSavegameName(_file_to_saveload.name, WP(w,querystr_d).text.buf, sizeof(_file_to_saveload.name));
 
			FiosMakeSavegameName(_file_to_saveload.name, WP(w, querystr_d).text.buf, sizeof(_file_to_saveload.name));
 

	
 
			/* In the editor set up the vehicle engines correctly (date might have changed) */
 
			if (_game_mode == GM_EDITOR) StartupEngines();
src/music_gui.cpp
Show inline comments
 
@@ -207,8 +207,8 @@ static void MusicTrackSelectionWndProc(W
 
		LowerWindowWidget(w, 4);
 
		DrawWindowWidgets(w);
 

	
 
		GfxFillRect(3, 23, 3+177,23+191,0);
 
		GfxFillRect(251, 23, 251+177,23+191,0);
 
		GfxFillRect(3, 23, 3 + 177, 23 + 191, 0);
 
		GfxFillRect(251, 23, 251 + 177, 23 + 191, 0);
 

	
 
		DrawStringCentered(92, 15, STR_01EE_TRACK_INDEX, 0);
 

	
 
@@ -219,14 +219,14 @@ static void MusicTrackSelectionWndProc(W
 
			SetDParam(0, i);
 
			SetDParam(2, i);
 
			SetDParam(1, SPECSTR_SONGNAME);
 
			DrawString(4, 23+(i-1)*6, (i < 10) ? STR_01EC_0 : STR_01ED, 0);
 
			DrawString(4, 23 + (i - 1) * 6, (i < 10) ? STR_01EC_0 : STR_01ED, 0);
 
		}
 

	
 
		for (i = 0; i != 6; i++) {
 
			DrawStringCentered(216, 45 + i * 8, STR_01D5_ALL + i, (i == msf.playlist) ? 0xC : 0x10);
 
		}
 

	
 
		DrawStringCentered(216, 45+8*6+16, STR_01F0_CLEAR, 0);
 
		DrawStringCentered(216, 45 + 8 * 6 + 16, STR_01F0_CLEAR, 0);
 
#if 0
 
		DrawStringCentered(216, 45 + 8 * 6 + 16 * 2, STR_01F1_SAVE, 0);
 
#endif
src/namegen.cpp
Show inline comments
 
@@ -90,7 +90,7 @@ static byte MakeEnglishAdditionalTownNam
 
	/* optional first segment */
 
	i = SeedChanceBias(0, lengthof(name_additional_english_prefix), seed, 50);
 
	if (i >= 0)
 
		strecat(buf,name_additional_english_prefix[i], last);
 
		strecat(buf, name_additional_english_prefix[i], last);
 

	
 
	if (SeedChance(3, 20, seed) >= 14) {
 
		strecat(buf, name_additional_english_1a[SeedChance(6, lengthof(name_additional_english_1a), seed)], last);
 
@@ -176,13 +176,13 @@ static byte MakeGermanTownName(char *buf
 
	/* optional prefix */
 
	if (seed_derivative == 12 || seed_derivative == 19) {
 
		i = SeedChance(2, lengthof(name_german_pre), seed);
 
		strecat(buf,name_german_pre[i], last);
 
		strecat(buf, name_german_pre[i], last);
 
	}
 

	
 
	/* mandatory middle segments including option of hardcoded name */
 
	i = SeedChance(3, lengthof(name_german_real) + lengthof(name_german_1), seed);
 
	if (i < lengthof(name_german_real)) {
 
		strecat(buf,name_german_real[i], last);
 
		strecat(buf, name_german_real[i], last);
 
	} else {
 
		strecat(buf, name_german_1[i - lengthof(name_german_real)], last);
 

	
 
@@ -679,7 +679,7 @@ static byte MakeItalianTownName(char *bu
 

	
 
		if (SeedModChance(3, 3, seed) == 0) {
 
			strecat(buf, name_italian_2[SeedModChance(11, lengthof(name_italian_2), seed)], last);
 
			strecat(buf,mascul_femin_italian[i], last);
 
			strecat(buf, mascul_femin_italian[i], last);
 
		} else {
 
			strecat(buf, name_italian_2i[SeedModChance(16, lengthof(name_italian_2i), seed)], last);
 
		}
src/network/core/os_abstraction.h
Show inline comments
 
@@ -161,7 +161,7 @@ typedef unsigned long in_addr_t;
 
/* Make the names compatible */
 
#	define closesocket(s) CloseSocket(s)
 
#	define GET_LAST_ERROR() Errno()
 
#	define ioctlsocket(s,request,status) IoctlSocket((LONG)s,(ULONG)request,(char*)status)
 
#	define ioctlsocket(s, request, status) IoctlSocket((LONG)s, (ULONG)request, (char*)status)
 
#	define ioctl ioctlsocket
 

	
 
	typedef unsigned int in_addr_t;
src/network/network_gui.cpp
Show inline comments
 
@@ -789,7 +789,7 @@ static void ShowNetworkStartServerWindow
 
	_saveload_mode = SLD_NEW_GAME;
 
	BuildFileList();
 
	w->vscroll.cap = 12;
 
	w->vscroll.count = _fios_num+1;
 
	w->vscroll.count = _fios_num + 1;
 

	
 
	WP(w, network_ql_d).q.afilter = CS_ALPHANUMERAL;
 
	InitializeTextBuffer(&WP(w, network_ql_d).q.text, _edit_str_buf, lengthof(_edit_str_buf), 160);
src/newgrf.cpp
Show inline comments
 
@@ -1523,7 +1523,7 @@ static bool GlobalVarChangeInfo(uint gvi
 
				uint32 tempfix = grf_load_dword(&buf);
 

	
 
				if (curidx < NUM_CURRENCY) {
 
					memcpy(&_currency_specs[curidx].suffix,&tempfix,4);
 
					memcpy(&_currency_specs[curidx].suffix, &tempfix, 4);
 
					_currency_specs[curidx].suffix[4] = 0;
 
				} else {
 
					grfmsg(1, "GlobalVarChangeInfo: Currency symbol %d out of range, ignoring", curidx);
 
@@ -2796,7 +2796,7 @@ static void FeatureNewName(byte *buf, in
 
				case GSF_CANAL :
 
				case GSF_BRIDGE :
 
					AddGRFString(_cur_spriteid, id, lang, name);
 
					switch (GB(id, 8,8)) {
 
					switch (GB(id, 8, 8)) {
 
						case 0xC9: // House name
 
						default:
 
							grfmsg(7, "FeatureNewName: Unsupported ID (0x%04X)", id);
src/news.h
Show inline comments
 
@@ -24,7 +24,7 @@ typedef bool ValidationProc ( uint data_
 
typedef void DrawNewsCallbackProc(Window *w);
 
typedef StringID GetNewsStringCallbackProc(const NewsItem *ni);
 

	
 
#define NEWS_FLAGS(mode,flag,type,cb) ((cb)<<24 | (type)<<16 | (flag)<<8 | (mode))
 
#define NEWS_FLAGS(mode, flag, type, cb) ((cb) << 24 | (type) << 16 | (flag) << 8 | (mode))
 
void AddNewsItem(StringID string, uint32 flags, uint data_a, uint data_b);
 
void NewsLoop();
 
void DrawNewsBorder(const Window *w);
src/oldloader.cpp
Show inline comments
 
@@ -149,7 +149,7 @@ static byte ReadByte(LoadgameState *ls)
 
	/* Old savegames have a nice compression algorithm (RLE)
 
	which means that we have a chunk, which starts with a length
 
	byte. If that byte is negative, we have to repeat the next byte
 
	that many times (+1). Else, we need to read that amount of bytes.
 
	that many times ( + 1). Else, we need to read that amount of bytes.
 
	Works pretty good if you have many zero's behind eachother */
 

	
 
	if (ls->chunk_size == 0) {
 
@@ -433,7 +433,7 @@ static const OldChunks town_chunk[] = {
 
	OCL_SVAR( OC_UINT16, Town, ratings[7] ),
 

	
 
	/* XXX - This is pretty odd.. we read 32bit, but only write 8bit.. sure there is
 
	nothing changed?? */
 
	nothing changed ? ? */
 
	OCL_SVAR( OC_FILE_U32 | OC_VAR_U8, Town, have_ratings ),
 
	OCL_SVAR( OC_FILE_U32 | OC_VAR_U8, Town, statues ),
 
	OCL_SVAR( OC_UINT16, Town, num_houses ),
 
@@ -1219,8 +1219,8 @@ static bool LoadOldVehicle(LoadgameState
 

	
 
static const OldChunks sign_chunk[] = {
 
	OCL_SVAR( OC_UINT16, Sign, str ),
 
	OCL_SVAR( OC_FILE_U16 | OC_VAR_I32,Sign, x ),
 
	OCL_SVAR( OC_FILE_U16 | OC_VAR_I32,Sign, y ),
 
	OCL_SVAR( OC_FILE_U16 | OC_VAR_I32, Sign, x ),
 
	OCL_SVAR( OC_FILE_U16 | OC_VAR_I32, Sign, y ),
 
	OCL_SVAR( OC_FILE_U16 | OC_VAR_I8, Sign, z ),
 

	
 
	OCL_NULL( 6 ),         ///< Width of sign, no longer in use
src/openttd.cpp
Show inline comments
 
@@ -348,7 +348,7 @@ int ttd_main(int argc, char *argv[])
 
	int i;
 
	const char *optformat;
 
	char musicdriver[32], sounddriver[32], videodriver[32];
 
	int resolution[2] = {0,0};
 
	int resolution[2] = {0, 0};
 
	Year startyear = INVALID_YEAR;
 
	uint generation_seed = GENERATE_NEW_SEED;
 
	bool save_config = true;
 
@@ -379,7 +379,7 @@ int ttd_main(int argc, char *argv[])
 
#endif
 
	;
 

	
 
	MyGetOptData mgo(argc-1, argv+1, optformat);
 
	MyGetOptData mgo(argc - 1, argv + 1, optformat);
 

	
 
	while ((i = MyGetOpt(&mgo)) != -1) {
 
		switch (i) {
src/pathfind.cpp
Show inline comments
 
@@ -821,7 +821,7 @@ start_at:
 
			}
 

	
 
			/* If we reach here, the tile has exactly one track, and this
 
			 track is reachable => Rail segment continues */
 
			 track is reachable = > Rail segment continues */
 

	
 
			track = _new_trackdir[FIND_FIRST_BIT(bits)][direction];
 
			assert(track != INVALID_TRACKDIR);
src/player_gui.cpp
Show inline comments
 
@@ -29,7 +29,7 @@ static void DoShowPlayerFinances(PlayerI
 

	
 
static void DrawPlayerEconomyStats(const Player *p, byte mode)
 
{
 
	int x,y,i,j,year;
 
	int x, y, i, j, year;
 
	const int64 (*tbl)[13];
 
	int64 sum, cost;
 
	StringID str;
 
@@ -38,8 +38,8 @@ static void DrawPlayerEconomyStats(const
 
		/* draw categories */
 
		DrawStringCenterUnderline(61, 15, STR_700F_EXPENDITURE_INCOME, 0);
 
		for (i = 0; i != 13; i++)
 
			DrawString(2, 27 + i*10, STR_7011_CONSTRUCTION + i, 0);
 
		DrawStringRightAligned(111, 27 + 10*13 + 2, STR_7020_TOTAL, 0);
 
			DrawString(2, 27 + i * 10, STR_7011_CONSTRUCTION + i, 0);
 
		DrawStringRightAligned(111, 27 + 10 * 13 + 2, STR_7020_TOTAL, 0);
 

	
 
		/* draw the price columns */
 
		year = _cur_year - 2;
 
@@ -60,16 +60,16 @@ static void DrawPlayerEconomyStats(const
 
						str = STR_701E;
 
						if (cost < 0) { cost = -cost; str++; }
 
						SetDParam64(0, cost);
 
						DrawStringRightAligned(x, 27+i*10, str, 0);
 
						DrawStringRightAligned(x, 27 + i * 10, str, 0);
 
					}
 
				}
 

	
 
				str = STR_701E;
 
				if (sum < 0) { sum = -sum; str++; }
 
				SetDParam64(0, sum);
 
				DrawStringRightAligned(x, 27 + 13*10 + 2, str, 0);
 
				DrawStringRightAligned(x, 27 + 13 * 10 + 2, str, 0);
 

	
 
				GfxFillRect(x - 75, 27 + 10*13, x, 27 + 10*13, 215);
 
				GfxFillRect(x - 75, 27 + 10 * 13, x, 27 + 10 * 13, 215);
 
				x += 95;
 
			}
 
			year++;
 
@@ -80,7 +80,7 @@ static void DrawPlayerEconomyStats(const
 

	
 
		/* draw max loan aligned to loan below (y += 10) */
 
		SetDParam64(0, (uint64)_economy.max_loan);
 
		DrawString(202, y+10, STR_MAX_LOAN, 0);
 
		DrawString(202, y + 10, STR_MAX_LOAN, 0);
 
	} else {
 
		y = 15;
 
	}
 
@@ -97,7 +97,7 @@ static void DrawPlayerEconomyStats(const
 

	
 
	y += 12;
 

	
 
	GfxFillRect(182 - 75, y-2, 182, y-2, 215);
 
	GfxFillRect(182 - 75, y - 2, 182, y - 2, 215);
 

	
 
	SetDParam64(0, p->money64 - p->current_loan);
 
	DrawStringRightAligned(182, y, STR_7028, 0);
 
@@ -166,13 +166,13 @@ static void PlayerFinancesWndProc(Window
 
		SetDParam(4, 10000);
 
		DrawWindowWidgets(w);
 

	
 
		DrawPlayerEconomyStats(p, (byte)WP(w,def_d).data_1);
 
		DrawPlayerEconomyStats(p, (byte)WP(w, def_d).data_1);
 
	} break;
 

	
 
	case WE_CLICK:
 
		switch (e->we.click.widget) {
 
		case 2: {/* toggle size */
 
			byte mode = (byte)WP(w,def_d).data_1;
 
			byte mode = (byte)WP(w, def_d).data_1;
 
			bool stickied = !!(w->flags4 & WF_STICKY);
 
			PlayerID player = (PlayerID)w->window_number;
 
			DeleteWindow(w);
 
@@ -239,7 +239,7 @@ static void DoShowPlayerFinances(PlayerI
 
	w = AllocateWindowDescFront(desc_table[mode], player);
 
	if (w != NULL) {
 
		w->caption_color = w->window_number;
 
		WP(w,def_d).data_1 = mode;
 
		WP(w, def_d).data_1 = mode;
 
		if (show_stickied) w->flags4 |= WF_STICKY;
 
	}
 
}
 
@@ -554,14 +554,14 @@ static void SelectPlayerFaceWndProc(Wind
 
		LowerWindowWidget(w, WP(w, facesel_d).gender + 5);
 
		DrawWindowWidgets(w);
 
		p = GetPlayer((PlayerID)w->window_number);
 
		DrawPlayerFace(WP(w,facesel_d).face, p->player_color, 2, 16);
 
		DrawPlayerFace(WP(w, facesel_d).face, p->player_color, 2, 16);
 
	} break;
 

	
 
	case WE_CLICK:
 
		switch (e->we.click.widget) {
 
		case 3: DeleteWindow(w); break;
 
		case 4: /* ok click */
 
			DoCommandP(0, 0, WP(w,facesel_d).face, NULL, CMD_SET_PLAYER_FACE);
 
			DoCommandP(0, 0, WP(w, facesel_d).face, NULL, CMD_SET_PLAYER_FACE);
 
			DeleteWindow(w);
 
			break;
 
		case 5: /* male click */
 
@@ -572,7 +572,7 @@ static void SelectPlayerFaceWndProc(Wind
 
			SetWindowDirty(w);
 
			break;
 
		case 7:
 
			WP(w,facesel_d).face = ConvertFromOldPlayerFace((WP(w, facesel_d).gender << 31) + GB(InteractiveRandom(), 0, 31));
 
			WP(w, facesel_d).face = ConvertFromOldPlayerFace((WP(w, facesel_d).gender << 31) + GB(InteractiveRandom(), 0, 31));
 
			SetWindowDirty(w);
 
			break;
 
		}
 
@@ -656,8 +656,8 @@ static void DrawPlayerVehiclesAmount(Pla
 
		}
 
	}
 

	
 
	if (train+road+air+ship == 0) {
 
		DrawString(x+70, y, STR_7042_NONE, 0);
 
	if (train + road + air + ship == 0) {
 
		DrawString(x + 70, y, STR_7042_NONE, 0);
 
	} else {
 
		if (train != 0) {
 
			SetDParam(0, train);
 
@@ -762,7 +762,7 @@ static void PlayerCompanyWndProc(Window 
 

	
 
			DrawPlayerVehiclesAmount((PlayerID)w->window_number);
 

	
 
			DrawString(110,48, STR_7006_COLOR_SCHEME, 0);
 
			DrawString(110, 48, STR_7006_COLOR_SCHEME, 0);
 
			/* Draw company-colour bus */
 
			DrawSprite(SPR_VEH_BUS_SW_VIEW, PLAYER_SPRITE_COLOR(p->index), 215, 49);
 

	
 
@@ -786,8 +786,8 @@ static void PlayerCompanyWndProc(Window 
 
					Window *wf = AllocateWindowDescFront(&_select_player_face_desc, w->window_number);
 
					if (wf != NULL) {
 
						wf->caption_color = w->window_number;
 
						WP(wf,facesel_d).face = GetPlayer((PlayerID)wf->window_number)->face;
 
						WP(wf,facesel_d).gender = 0;
 
						WP(wf, facesel_d).face = GetPlayer((PlayerID)wf->window_number)->face;
 
						WP(wf, facesel_d).gender = 0;
 
					}
 
					break;
 
				}
 
@@ -796,8 +796,8 @@ static void PlayerCompanyWndProc(Window 
 
					Window *wf = AllocateWindowDescFront(_have_2cc ? &_select_player_livery_2cc_desc : &_select_player_livery_desc, w->window_number);
 
					if (wf != NULL) {
 
						wf->caption_color = wf->window_number;
 
						WP(wf,livery_d).livery_class = LC_OTHER;
 
						WP(wf,livery_d).sel = 1;
 
						WP(wf, livery_d).livery_class = LC_OTHER;
 
						WP(wf, livery_d).sel = 1;
 
						LowerWindowWidget(wf, 2);
 
					}
 
					break;
 
@@ -813,7 +813,7 @@ static void PlayerCompanyWndProc(Window 
 

	
 
				case PCW_WIDGET_COMPANY_NAME: {
 
					Player *p = GetPlayer((PlayerID)w->window_number);
 
					WP(w,def_d).byte_1 = 1;
 
					WP(w, def_d).byte_1 = 1;
 
					SetDParam(0, p->name_2);
 
					ShowQueryString(p->name_1, STR_700A_COMPANY_NAME, 31, 150, w, CS_ALPHANUMERAL);
 
					break;
 
@@ -852,7 +852,7 @@ static void PlayerCompanyWndProc(Window 
 
				#ifdef ENABLE_NETWORK
 
				case PCW_WIDGET_COMPANY_PASSWORD:
 
					if (w->window_number == _local_player) {
 
						WP(w,def_d).byte_1 = 2;
 
						WP(w, def_d).byte_1 = 2;
 
						ShowQueryString(BindCString(_network_player_info[_local_player].password),
 
							STR_SET_COMPANY_PASSWORD, sizeof(_network_player_info[_local_player].password), 250, w, CS_ALPHANUMERAL);
 
					}
 
@@ -885,10 +885,10 @@ static void PlayerCompanyWndProc(Window 
 
			char *b = e->we.edittext.str;
 

	
 
			/* empty string is allowed for password */
 
			if (*b == '\0' && WP(w,def_d).byte_1 != 2) return;
 
			if (*b == '\0' && WP(w, def_d).byte_1 != 2) return;
 

	
 
			_cmd_text = b;
 
			switch (WP(w,def_d).byte_1) {
 
			switch (WP(w, def_d).byte_1) {
 
				case 0: /* Change president name */
 
					DoCommandP(0, 0, 0, NULL, CMD_CHANGE_PRESIDENT_NAME | CMD_MSG(STR_700D_CAN_T_CHANGE_PRESIDENT));
 
					break;
src/rail.cpp
Show inline comments
 
@@ -68,8 +68,8 @@ extern const TrackBits _track_crosses_tr
 
/* Maps a trackdir to the (4-way) direction the tile is exited when following
 
 * that trackdir */
 
extern const DiagDirection _trackdir_to_exitdir[] = {
 
	DIAGDIR_NE,DIAGDIR_SE,DIAGDIR_NE,DIAGDIR_SE,DIAGDIR_SW,DIAGDIR_SE, DIAGDIR_NE,DIAGDIR_NE,
 
	DIAGDIR_SW,DIAGDIR_NW,DIAGDIR_NW,DIAGDIR_SW,DIAGDIR_NW,DIAGDIR_NE,
 
	DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_SW, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_NE,
 
	DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NW, DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NE,
 
};
 

	
 
extern const Trackdir _track_exitdir_to_trackdir[][DIAGDIR_END] = {
src/road_cmd.cpp
Show inline comments
 
@@ -60,10 +60,10 @@ bool CheckAllowRemoveRoad(TileIndex tile
 
	/* Get a bitmask of which neighbouring roads has a tile */
 
	n = ROAD_NONE;
 
	present = GetAnyRoadBits(tile);
 
	if (present & ROAD_NE && GetAnyRoadBits(TILE_ADDXY(tile,-1, 0)) & ROAD_SW) n |= ROAD_NE;
 
	if (present & ROAD_NE && GetAnyRoadBits(TILE_ADDXY(tile, -1, 0)) & ROAD_SW) n |= ROAD_NE;
 
	if (present & ROAD_SE && GetAnyRoadBits(TILE_ADDXY(tile, 0, 1)) & ROAD_NW) n |= ROAD_SE;
 
	if (present & ROAD_SW && GetAnyRoadBits(TILE_ADDXY(tile, 1, 0)) & ROAD_NE) n |= ROAD_SW;
 
	if (present & ROAD_NW && GetAnyRoadBits(TILE_ADDXY(tile, 0,-1)) & ROAD_SE) n |= ROAD_NW;
 
	if (present & ROAD_NW && GetAnyRoadBits(TILE_ADDXY(tile, 0, -1)) & ROAD_SE) n |= ROAD_NW;
 

	
 
	/* If 0 or 1 bits are set in n, or if no bits that match the bits to remove,
 
	 * then allow it */
 
@@ -431,7 +431,7 @@ int32 CmdBuildLongRoad(TileIndex end_til
 
		TileIndex t = start_tile;
 
		start_tile = end_tile;
 
		end_tile = t;
 
		p2 ^= IS_INT_INSIDE(p2&3, 1, 3) ? 3 : 0;
 
		p2 ^= IS_INT_INSIDE(p2 & 3, 1, 3) ? 3 : 0;
 
	}
 

	
 
	cost = 0;
src/road_gui.cpp
Show inline comments
 
@@ -257,11 +257,11 @@ static void BuildRoadToolbWndProc(Window
 
		InvalidateWidget(w, RTW_REMOVE);
 

	
 
		w = FindWindowById(WC_BUS_STATION, 0);
 
		if (w != NULL) WP(w,def_d).close = true;
 
		if (w != NULL) WP(w, def_d).close = true;
 
		w = FindWindowById(WC_TRUCK_STATION, 0);
 
		if (w != NULL) WP(w,def_d).close = true;
 
		if (w != NULL) WP(w, def_d).close = true;
 
		w = FindWindowById(WC_BUILD_DEPOT, 0);
 
		if (w != NULL) WP(w,def_d).close = true;
 
		if (w != NULL) WP(w, def_d).close = true;
 
		break;
 

	
 
	case WE_PLACE_DRAG: {
 
@@ -414,11 +414,11 @@ static void BuildRoadDepotWndProc(Window
 
	}	break;
 

	
 
	case WE_MOUSELOOP:
 
		if (WP(w,def_d).close) DeleteWindow(w);
 
		if (WP(w, def_d).close) DeleteWindow(w);
 
		break;
 

	
 
	case WE_DESTROY:
 
		if (!WP(w,def_d).close) ResetObjectToPlace();
 
		if (!WP(w, def_d).close) ResetObjectToPlace();
 
		break;
 
	}
 
}
 
@@ -458,7 +458,7 @@ static void RoadStationPickerWndProc(Win
 
	case WE_PAINT: {
 
		int image;
 

	
 
		if (WP(w,def_d).close) return;
 
		if (WP(w, def_d).close) return;
 

	
 
		DrawWindowWidgets(w);
 

	
 
@@ -472,9 +472,9 @@ static void RoadStationPickerWndProc(Win
 
		image = (w->window_class == WC_BUS_STATION) ? GFX_BUS_BASE : GFX_TRUCK_BASE;
 

	
 
		StationPickerDrawSprite(103, 35, RAILTYPE_BEGIN, image);
 
		StationPickerDrawSprite(103, 85, RAILTYPE_BEGIN, image+1);
 
		StationPickerDrawSprite(35, 85, RAILTYPE_BEGIN, image+2);
 
		StationPickerDrawSprite(35, 35, RAILTYPE_BEGIN, image+3);
 
		StationPickerDrawSprite(103, 85, RAILTYPE_BEGIN, image + 1);
 
		StationPickerDrawSprite(35, 85, RAILTYPE_BEGIN, image + 2);
 
		StationPickerDrawSprite(35, 35, RAILTYPE_BEGIN, image + 3);
 

	
 
		image = (w->window_class == WC_BUS_STATION) ? GFX_BUS_BASE_EXT : GFX_TRUCK_BASE_EXT;
 

	
 
@@ -482,7 +482,7 @@ static void RoadStationPickerWndProc(Win
 
		StationPickerDrawSprite(171, 85, RAILTYPE_BEGIN, image + 1);
 

	
 
		DrawStationCoverageAreaText(2, 146,
 
			((w->window_class == WC_BUS_STATION) ? (1<<CT_PASSENGERS) : ~(1<<CT_PASSENGERS)),
 
			((w->window_class == WC_BUS_STATION) ? (1 << CT_PASSENGERS) : ~(1 << CT_PASSENGERS)),
 
			3);
 

	
 
	} break;
 
@@ -507,7 +507,7 @@ static void RoadStationPickerWndProc(Win
 
	} break;
 

	
 
	case WE_MOUSELOOP: {
 
		if (WP(w,def_d).close) {
 
		if (WP(w, def_d).close) {
 
			DeleteWindow(w);
 
			return;
 
		}
 
@@ -516,7 +516,7 @@ static void RoadStationPickerWndProc(Win
 
	} break;
 

	
 
	case WE_DESTROY:
 
		if (!WP(w,def_d).close) ResetObjectToPlace();
 
		if (!WP(w, def_d).close) ResetObjectToPlace();
 
		break;
 
	}
 
}
src/roadveh_cmd.cpp
Show inline comments
 
@@ -168,11 +168,11 @@ int32 CmdBuildRoadVeh(TileIndex tile, ui
 
		y = TileY(tile) * TILE_SIZE + TILE_SIZE / 2;
 
		v->x_pos = x;
 
		v->y_pos = y;
 
		v->z_pos = GetSlopeZ(x,y);
 
		v->z_pos = GetSlopeZ(x, y);
 
		v->z_height = 6;
 

	
 
		v->u.road.state = RVSB_IN_DEPOT;
 
		v->vehstatus = VS_HIDDEN|VS_STOPPED|VS_DEFPAL;
 
		v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL;
 

	
 
		v->spritenum = rvi->image_index;
 
		v->cargo_type = rvi->cargo_type;
src/saveload.cpp
Show inline comments
 
@@ -251,14 +251,14 @@ static void SlWriteSimpleGamma(uint i)
 
		if (i >= (1 << 14)) {
 
			if (i >= (1 << 21)) {
 
				assert(i < (1 << 28));
 
				SlWriteByte((byte)0xE0 | (i>>24));
 
				SlWriteByte((byte)(i>>16));
 
				SlWriteByte((byte)0xE0 | (i >> 24));
 
				SlWriteByte((byte)(i >> 16));
 
			} else {
 
				SlWriteByte((byte)0xC0 | (i>>16));
 
				SlWriteByte((byte)0xC0 | (i >> 16));
 
			}
 
			SlWriteByte((byte)(i>>8));
 
			SlWriteByte((byte)(i >> 8));
 
		} else {
 
			SlWriteByte((byte)(0x80 | (i>>8)));
 
			SlWriteByte((byte)(0x80 | (i >> 8)));
 
		}
 
	}
 
	SlWriteByte(i);
 
@@ -925,7 +925,7 @@ static const ChunkHandler *SlFindChunkHa
 
{
 
	const ChunkHandler *ch;
 
	const ChunkHandler *const *chsc;
 
	for (chsc = _sl.chs; (ch=*chsc++) != NULL;) {
 
	for (chsc = _sl.chs; (ch = *chsc++) != NULL;) {
 
		for (;;) {
 
			if (ch->id == id) return ch;
 
			if (ch->flags & CH_LAST) break;
 
@@ -1030,7 +1030,7 @@ static void WriteNoComp(uint size)
 
static bool InitNoComp()
 
{
 
	_sl.bufsize = LZO_SIZE;
 
	_sl.buf = _sl.buf_ori =(byte*)malloc(LZO_SIZE);
 
	_sl.buf = _sl.buf_ori = (byte*)malloc(LZO_SIZE);
 
	return true;
 
}
 

	
src/screenshot.cpp
Show inline comments
 
@@ -268,7 +268,7 @@ struct PcxHeader {
 
	uint32 unused;
 
	uint16 xmax, ymax;
 
	uint16 hdpi, vdpi;
 
	byte pal_small[16*3];
 
	byte pal_small[16 * 3];
 
	byte reserved;
 
	byte planes;
 
	uint16 pitch;
src/settings.cpp
Show inline comments
 
@@ -1140,15 +1140,15 @@ static int32 CheckInterval(int32 p1)
 
	const Patches *ptc = (_game_mode == GM_MENU) ? &_patches_newgame : &_patches;
 

	
 
	if (p1) {
 
		warning = ( (IS_INT_INSIDE(ptc->servint_trains,   5, 90+1) || ptc->servint_trains   == 0) &&
 
								(IS_INT_INSIDE(ptc->servint_roadveh,  5, 90+1) || ptc->servint_roadveh  == 0) &&
 
								(IS_INT_INSIDE(ptc->servint_aircraft, 5, 90+1) || ptc->servint_aircraft == 0) &&
 
								(IS_INT_INSIDE(ptc->servint_ships,    5, 90+1) || ptc->servint_ships    == 0) );
 
		warning = ( (IS_INT_INSIDE(ptc->servint_trains,   5, 90 + 1) || ptc->servint_trains   == 0) &&
 
								(IS_INT_INSIDE(ptc->servint_roadveh,  5, 90 + 1) || ptc->servint_roadveh  == 0) &&
 
								(IS_INT_INSIDE(ptc->servint_aircraft, 5, 90 + 1) || ptc->servint_aircraft == 0) &&
 
								(IS_INT_INSIDE(ptc->servint_ships,    5, 90 + 1) || ptc->servint_ships    == 0) );
 
	} else {
 
		warning = ( (IS_INT_INSIDE(ptc->servint_trains,   30, 800+1) || ptc->servint_trains   == 0) &&
 
								(IS_INT_INSIDE(ptc->servint_roadveh,  30, 800+1) || ptc->servint_roadveh  == 0) &&
 
								(IS_INT_INSIDE(ptc->servint_aircraft, 30, 800+1) || ptc->servint_aircraft == 0) &&
 
								(IS_INT_INSIDE(ptc->servint_ships,    30, 800+1) || ptc->servint_ships    == 0) );
 
		warning = ( (IS_INT_INSIDE(ptc->servint_trains,   30, 800 + 1) || ptc->servint_trains   == 0) &&
 
								(IS_INT_INSIDE(ptc->servint_roadveh,  30, 800 + 1) || ptc->servint_roadveh  == 0) &&
 
								(IS_INT_INSIDE(ptc->servint_aircraft, 30, 800 + 1) || ptc->servint_aircraft == 0) &&
 
								(IS_INT_INSIDE(ptc->servint_ships,    30, 800 + 1) || ptc->servint_ships    == 0) );
 
	}
 

	
 
	if (!warning)
 
@@ -1280,7 +1280,7 @@ static const SettingDesc _gameopt_settin
 
	 * and why not byte for example? */
 
	SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 17, 0, 0, 0, 0, NULL, STR_NULL, NULL, NULL, 0, 3),
 
	SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 18, 0, 0, 0, 0, NULL, STR_NULL, NULL, NULL, 4, SL_MAX_VERSION),
 
	    SDT_VAR(GameOptions, diff_level,SLE_UINT8, 0, 0, 0, 0,  3, 0, STR_NULL, NULL),
 
	    SDT_VAR(GameOptions, diff_level, SLE_UINT8, 0, 0, 0, 0,  3, 0, STR_NULL, NULL),
 
	  SDT_OMANY(GameOptions, currency,  SLE_UINT8, N, 0, 0, CUSTOM_CURRENCY_ID, "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|ROL|RUR|SIT|SEK|YTL|SKK|BRR|custom", STR_NULL, NULL, NULL),
 
	  SDT_OMANY(GameOptions, units,     SLE_UINT8, N, 0, 1,     2, "imperial|metric|si", STR_NULL, NULL, NULL),
 
	  SDT_OMANY(GameOptions, town_name, SLE_UINT8, 0, 0, 0,    20, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian|catalan", STR_NULL, NULL, NULL),
 
@@ -1527,7 +1527,7 @@ const SettingDesc _patch_settings[] = {
 
static const SettingDesc _currency_settings[] = {
 
	SDT_VAR(CurrencySpec, rate,    SLE_UINT16, S, 0,  1, 0, 100, 0, STR_NULL, NULL),
 
	SDT_CHR(CurrencySpec, separator,           S, 0,        ".",    STR_NULL, NULL),
 
	SDT_VAR(CurrencySpec, to_euro,  SLE_INT32, S, 0,  0, 0,3000, 0, STR_NULL, NULL),
 
	SDT_VAR(CurrencySpec, to_euro,  SLE_INT32, S, 0,  0, 0, 3000, 0, STR_NULL, NULL),
 
	SDT_STR(CurrencySpec, prefix,   SLE_STRBQ, S, 0,       NULL,    STR_NULL, NULL),
 
	SDT_STR(CurrencySpec, suffix,   SLE_STRBQ, S, 0, " credits",    STR_NULL, NULL),
 
	SDT_END()
src/ship_cmd.cpp
Show inline comments
 
@@ -551,7 +551,7 @@ static inline NPFFoundTargetData PerfNPF
 
 * direction in which we are entering the tile */
 
static Track ChooseShipTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks)
 
{
 
	assert(enterdir>=0 && enterdir<=3);
 
	assert(enterdir >= 0 && enterdir <= 3);
 

	
 
	if (_patches.yapf.ship_use_yapf) {
 
		Trackdir trackdir = YapfChooseShipTrack(v, tile, enterdir, tracks);
 
@@ -654,11 +654,11 @@ static const byte _ship_subcoord[4][6][3
 
	},
 
	{
 
		{ 0, 0, 0},
 
		{ 8,15, 7},
 
		{ 8, 15, 7},
 
		{ 0, 0, 0},
 
		{ 8,15, 6},
 
		{ 8, 15, 6},
 
		{ 0, 0, 0},
 
		{ 7,15, 0},
 
		{ 7, 15, 0},
 
	}
 
};
 

	
 
@@ -880,7 +880,7 @@ int32 CmdBuildShip(TileIndex tile, uint3
 
		y = TileY(tile) * TILE_SIZE + TILE_SIZE / 2;
 
		v->x_pos = x;
 
		v->y_pos = y;
 
		v->z_pos = GetSlopeZ(x,y);
 
		v->z_pos = GetSlopeZ(x, y);
 

	
 
		v->z_height = 6;
 
		v->sprite_width = 6;
src/ship_gui.cpp
Show inline comments
 
@@ -78,7 +78,7 @@ static void ShipDetailsWndProc(Window *w
 
		{
 
			SetDParam(0, v->service_interval);
 
			SetDParam(1, v->date_of_last_service);
 
			DrawString(13, 102, _patches.servint_ispercent?STR_SERVICING_INTERVAL_PERCENT:STR_883C_SERVICING_INTERVAL_DAYS, 0);
 
			DrawString(13, 102, _patches.servint_ispercent ? STR_SERVICING_INTERVAL_PERCENT : STR_883C_SERVICING_INTERVAL_DAYS, 0);
 
		}
 

	
 
		DrawShipImage(v, 3, 57, INVALID_VEHICLE);
 
@@ -120,7 +120,7 @@ static void ShipDetailsWndProc(Window *w
 
			mod = _ctrl_pressed? 5 : 10;
 
			goto do_change_service_int;
 
		case 6: /* decrease int */
 
			mod = _ctrl_pressed?- 5 : -10;
 
			mod = _ctrl_pressed ? - 5 : -10;
 
do_change_service_int:
 
			v = GetVehicle(w->window_number);
 

	
 
@@ -157,7 +157,7 @@ static const Widget _ship_details_widget
 

	
 
static const WindowDesc _ship_details_desc = {
 
	WDP_AUTO, WDP_AUTO, 405, 113,
 
	WC_VEHICLE_DETAILS,WC_VEHICLE_VIEW,
 
	WC_VEHICLE_DETAILS, WC_VEHICLE_VIEW,
 
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
 
	_ship_details_widgets,
 
	ShipDetailsWndProc
 
@@ -326,7 +326,7 @@ static const Widget _ship_view_widgets[]
 
{ WWT_PUSHIMGBTN, RESIZE_LR,    14, 232, 249,  32,  49, SPR_SEND_SHIP_TODEPOT,   STR_982A_SEND_SHIP_TO_DEPOT},
 
{ WWT_PUSHIMGBTN, RESIZE_LR,    14, 232, 249,  50,  67, SPR_REFIT_VEHICLE,       STR_983A_REFIT_CARGO_SHIP_TO_CARRY},
 
{ WWT_PUSHIMGBTN, RESIZE_LR,    14, 232, 249,  68,  85, SPR_SHOW_ORDERS,         STR_9828_SHOW_SHIP_S_ORDERS},
 
{ WWT_PUSHIMGBTN, RESIZE_LR,    14, 232, 249,  86, 103, SPR_SHOW_VEHICLE_DETAILS,STR_982B_SHOW_SHIP_DETAILS},
 
{ WWT_PUSHIMGBTN, RESIZE_LR,    14, 232, 249,  86, 103, SPR_SHOW_VEHICLE_DETAILS, STR_982B_SHOW_SHIP_DETAILS},
 
{ WWT_PUSHIMGBTN, RESIZE_LR,    14, 232, 249,  32,  49, SPR_CLONE_SHIP,          STR_CLONE_SHIP_INFO},
 
{      WWT_PANEL, RESIZE_LRB,   14, 232, 249, 104, 103, 0x0,                     STR_NULL },
 
{  WWT_RESIZEBOX, RESIZE_LRTB,  14, 238, 249, 104, 115, 0x0,                     STR_NULL },
src/signs.cpp
Show inline comments
 
@@ -136,7 +136,7 @@ int32 CmdPlaceSign(TileIndex tile, uint3
 
		si->x = x;
 
		si->y = y;
 
		si->owner = _current_player; // owner of the sign; just eyecandy
 
		si->z = GetSlopeZ(x,y);
 
		si->z = GetSlopeZ(x, y);
 
		UpdateSignVirtCoords(si);
 
		MarkSignDirty(si);
 
		InvalidateWindow(WC_SIGN_LIST, 0);
src/station_cmd.cpp
Show inline comments
 
@@ -199,7 +199,7 @@ static bool GenerateStationName(Station 
 
		Station *s;
 

	
 
		FOR_ALL_STATIONS(s) {
 
			if (s != st && s->town==t) {
 
			if (s != st && s->town == t) {
 
				uint str = M(s->string_id);
 
				if (str <= 0x20) {
 
					if (str == M(STR_SV_STNAME_FOREST))
 
@@ -230,7 +230,7 @@ static bool GenerateStationName(Station 
 
	}
 

	
 
	/* check close enough to town to get central as name? */
 
	if (DistanceMax(tile,t->xy) < 8) {
 
	if (DistanceMax(tile, t->xy) < 8) {
 
		found = M(STR_SV_STNAME);
 
		if (HASBIT(free_names, M(STR_SV_STNAME))) goto done;
 

	
 
@@ -272,10 +272,10 @@ static bool GenerateStationName(Station 
 
	/* check direction compared to town */
 
	{
 
		static const int8 _direction_and_table[] = {
 
			~( (1<<M(STR_SV_STNAME_WEST)) | (1<<M(STR_SV_STNAME_EAST)) | (1<<M(STR_SV_STNAME_NORTH)) ),
 
			~( (1<<M(STR_SV_STNAME_SOUTH)) | (1<<M(STR_SV_STNAME_WEST)) | (1<<M(STR_SV_STNAME_NORTH)) ),
 
			~( (1<<M(STR_SV_STNAME_SOUTH)) | (1<<M(STR_SV_STNAME_EAST)) | (1<<M(STR_SV_STNAME_NORTH)) ),
 
			~( (1<<M(STR_SV_STNAME_SOUTH)) | (1<<M(STR_SV_STNAME_WEST)) | (1<<M(STR_SV_STNAME_EAST)) ),
 
			~( (1 << M(STR_SV_STNAME_WEST)) | (1 << M(STR_SV_STNAME_EAST)) | (1 << M(STR_SV_STNAME_NORTH)) ),
 
			~( (1 << M(STR_SV_STNAME_SOUTH)) | (1 << M(STR_SV_STNAME_WEST)) | (1 << M(STR_SV_STNAME_NORTH)) ),
 
			~( (1 << M(STR_SV_STNAME_SOUTH)) | (1 << M(STR_SV_STNAME_EAST)) | (1 << M(STR_SV_STNAME_NORTH)) ),
 
			~( (1 << M(STR_SV_STNAME_SOUTH)) | (1 << M(STR_SV_STNAME_WEST)) | (1 << M(STR_SV_STNAME_EAST)) ),
 
		};
 

	
 
		free_names &= _direction_and_table[
 
@@ -283,7 +283,7 @@ static bool GenerateStationName(Station 
 
			(TileY(tile) < TileY(t->xy)) * 2];
 
	}
 

	
 
	tmp = free_names & ((1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<6)|(1<<7)|(1<<12)|(1<<26)|(1<<27)|(1<<28)|(1<<29)|(1<<30));
 
	tmp = free_names & ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 6) | (1 << 7) | (1 << 12) | (1 << 26) | (1 << 27) | (1 << 28) | (1 << 29) | (1 << 30));
 
	if (tmp == 0) {
 
		_error_message = STR_3007_TOO_MANY_STATIONS_LOADING;
 
		return false;
 
@@ -368,7 +368,7 @@ static void ShowRejectOrAcceptNews(const
 
	}
 

	
 
	SetDParam(0, st->index);
 
	AddNewsItem(msg, NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_TILE, NT_ACCEPTANCE, 0), st->xy, 0);
 
	AddNewsItem(msg, NEWS_FLAGS(NM_SMALL, NF_VIEWPORT | NF_TILE, NT_ACCEPTANCE, 0), st->xy, 0);
 
}
 

	
 
// Get a list of the cargo types being produced around the tile.
 
@@ -646,10 +646,10 @@ int32 CheckFlatLandBelow(TileIndex tile,
 
		int flat_z = z;
 
		if (tileh != SLOPE_FLAT) {
 
			// need to check so the entrance to the station is not pointing at a slope.
 
			if ((invalid_dirs&1 && !(tileh & SLOPE_NE) && (uint)w_cur == w) ||
 
					(invalid_dirs&2 && !(tileh & SLOPE_SE) && h_cur == 1) ||
 
					(invalid_dirs&4 && !(tileh & SLOPE_SW) && w_cur == 1) ||
 
					(invalid_dirs&8 && !(tileh & SLOPE_NW) && (uint)h_cur == h)) {
 
			if ((invalid_dirs & 1 && !(tileh & SLOPE_NE) && (uint)w_cur == w) ||
 
					(invalid_dirs & 2 && !(tileh & SLOPE_SE) && h_cur == 1) ||
 
					(invalid_dirs & 4 && !(tileh & SLOPE_SW) && w_cur == 1) ||
 
					(invalid_dirs & 8 && !(tileh & SLOPE_NW) && (uint)h_cur == h)) {
 
				return_cmd_error(STR_0007_FLAT_LAND_REQUIRED);
 
			}
 
			cost += _price.terraform;
 
@@ -748,7 +748,7 @@ static inline byte *CreateSingle(byte *l
 
{
 
	int i = n;
 
	do *layout++ = 0; while (--i);
 
	layout[((n-1) >> 1)-n] = 2;
 
	layout[((n - 1) >> 1) - n] = 2;
 
	return layout;
 
}
 

	
 
@@ -757,8 +757,8 @@ static inline byte *CreateMulti(byte *la
 
	int i = n;
 
	do *layout++ = b; while (--i);
 
	if (n > 4) {
 
		layout[0-n] = 0;
 
		layout[n-1-n] = 0;
 
		layout[0 - n] = 0;
 
		layout[n - 1 - n] = 0;
 
	}
 
	return layout;
 
}
 
@@ -1623,7 +1623,7 @@ static int32 RemoveAirport(Station *st, 
 
			DeleteAnimatedTile(tile_cur);
 
			DoClearSquare(tile_cur);
 
		}
 
	} END_TILE_LOOP(tile_cur, w,h,tile)
 
	} END_TILE_LOOP(tile_cur, w, h, tile)
 

	
 
	if (flags & DC_EXEC) {
 
		for (uint i = 0; i < afc->nof_depots; ++i) {
src/strgen/strgen.cpp
Show inline comments
 
@@ -730,7 +730,7 @@ static bool CheckCommandsMatch(char *a, 
 
{
 
	ParsedCommandStruct templ;
 
	ParsedCommandStruct lang;
 
	int i,j;
 
	int i, j;
 
	bool result = true;
 

	
 
	ExtractCommandString(&templ, b, true);
 
@@ -914,7 +914,7 @@ static void ParseFile(const char *file, 
 
	in = fopen(file, "r");
 
	if (in == NULL) fatal("Cannot open file");
 
	_cur_line = 1;
 
	while (fgets(buf, sizeof(buf),in) != NULL) {
 
	while (fgets(buf, sizeof(buf), in) != NULL) {
 
		rstrip(buf);
 
		HandleString(buf, english);
 
		_cur_line++;
src/strings.cpp
Show inline comments
 
@@ -63,7 +63,7 @@ static inline int64 GetInt64(const int32
 

	
 
	assert(argv);
 
	result = (uint32)(*argv)[0] + ((uint64)(uint32)(*argv)[1] << 32);
 
	(*argv)+=2;
 
	(*argv) += 2;
 
	return result;
 
}
 

	
 
@@ -421,37 +421,37 @@ static int DeterminePluralForm(int32 n)
 
	 * Used in:
 
	 *   Latvian */
 
	case 3:
 
		return n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2;
 
		return n%10 == 1 && n%100 != 11 ? 0 : n != 0 ? 1 : 2;
 

	
 
	/* Three forms, special case for one and two
 
	 * Used in:
 
	 *   Gaelige (Irish) */
 
	case 4:
 
		return n==1 ? 0 : n==2 ? 1 : 2;
 
		return n == 1 ? 0 : n == 2 ? 1 : 2;
 

	
 
	/* Three forms, special case for numbers ending in 1[2-9]
 
	 * Used in:
 
	 *   Lithuanian */
 
	case 5:
 
		return n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2;
 
		return n%10 == 1 && n%100 != 11 ? 0 : n%10 >= 2 && (n%100<10 || n%100 >= 20) ? 1 : 2;
 

	
 
	/* Three forms, special cases for numbers ending in 1 and 2, 3, 4, except those ending in 1[1-4]
 
	 * Used in:
 
	 *   Croatian, Czech, Russian, Slovak, Ukrainian */
 
	case 6:
 
		return n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;
 
		return n%10 == 1 && n%100 != 11 ? 0 : n%10 >= 2 && n%10 <= 4 && (n%100<10 || n%100 >= 20) ? 1 : 2;
 

	
 
	/* Three forms, special case for one and some numbers ending in 2, 3, or 4
 
	 * Used in:
 
	 *   Polish */
 
	case 7:
 
		return n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;
 
		return n == 1 ? 0 : n%10 >= 2 && n%10 <= 4 && (n%100<10 || n%100 >= 20) ? 1 : 2;
 

	
 
	/* Four forms, special case for one and all numbers ending in 02, 03, or 04
 
	 * Used in:
 
	 *   Slovenian */
 
	case 8:
 
		return n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3;
 
		return n%100 == 1 ? 0 : n%100 == 2 ? 1 : n%100 == 3 || n%100 == 4 ? 2 : 3;
 
	}
 
}
 

	
 
@@ -459,7 +459,7 @@ static const char *ParseStringChoice(con
 
{
 
	//<NUM> {Length of each string} {each string}
 
	uint n = (byte)*b++;
 
	uint pos,i, mylen=0,mypos=0;
 
	uint pos, i, mylen = 0, mypos = 0;
 

	
 
	for (i = pos = 0; i != n; i++) {
 
		uint len = (byte)*b++;
src/table/ai_rail.h
Show inline comments
 
@@ -21,7 +21,7 @@ struct AiDefaultRoadBlock {
 
};
 

	
 

	
 
#define MKHDR(a,b,c,d,e) a,b,c,d,e,
 
#define MKHDR(a, b, c, d, e) a, b, c, d, e,
 
#define MKDEPOT(a, b, c)   {0, a, {b, c}}
 
#define MKSTATION(a, b, c) {1, a, {b, c}}
 
#define MKRAIL(a, b, c)    {2, a, {b, c}}
 
@@ -424,17 +424,17 @@ static const AiDefaultRailBlock * const 
 

	
 
#undef MKHDR
 

	
 
#define MKHDR(a) a,{
 
#define MKHDR(a) a, {
 

	
 
static const AiDefaultBlockData _roaddata_ai_0_data[] = {
 
	MKDEPOT(2, -1,1),
 
	MKSTATION(0x2, -1,0),
 
	MKRAIL(0xC, 0,0),
 
	MKRAIL(0x9, 0,1),
 
	MKCLRRAIL(0, 0,-1),
 
	MKCLRRAIL(0, 1,0),
 
	MKCLRRAIL(0, 1,1),
 
	MKCLRRAIL(0, 0,2),
 
	MKDEPOT(2, -1, 1),
 
	MKSTATION(0x2, -1, 0),
 
	MKRAIL(0xC, 0, 0),
 
	MKRAIL(0x9, 0, 1),
 
	MKCLRRAIL(0, 0, -1),
 
	MKCLRRAIL(0, 1, 0),
 
	MKCLRRAIL(0, 1, 1),
 
	MKCLRRAIL(0, 0, 2),
 
	MKEND
 
};
 

	
 
@@ -443,14 +443,14 @@ static const AiDefaultRoadBlock _roaddat
 
};
 

	
 
static const AiDefaultBlockData _roaddata_ai_1_data[] = {
 
	MKDEPOT(1, 0,-1),
 
	MKSTATION(0x1, 1,-1),
 
	MKRAIL(0x3, 0,0),
 
	MKRAIL(0x9, 1,0),
 
	MKCLRRAIL(0, -1,0),
 
	MKCLRRAIL(0, 0,1),
 
	MKCLRRAIL(0, 1,1),
 
	MKCLRRAIL(0, 2,0),
 
	MKDEPOT(1, 0, -1),
 
	MKSTATION(0x1, 1, -1),
 
	MKRAIL(0x3, 0, 0),
 
	MKRAIL(0x9, 1, 0),
 
	MKCLRRAIL(0, -1, 0),
 
	MKCLRRAIL(0, 0, 1),
 
	MKCLRRAIL(0, 1, 1),
 
	MKCLRRAIL(0, 2, 0),
 
	MKEND
 
};
 

	
 
@@ -459,14 +459,14 @@ static const AiDefaultRoadBlock _roaddat
 
};
 

	
 
static const AiDefaultBlockData _roaddata_ai_2_data[] = {
 
	MKDEPOT(3, 1,1),
 
	MKSTATION(0x3, 0,1),
 
	MKRAIL(0x6, 0,0),
 
	MKRAIL(0xC, 1,0),
 
	MKCLRRAIL(0, -1,0),
 
	MKCLRRAIL(0, 0,-1),
 
	MKCLRRAIL(0, 1,-1),
 
	MKCLRRAIL(0, 2,0),
 
	MKDEPOT(3, 1, 1),
 
	MKSTATION(0x3, 0, 1),
 
	MKRAIL(0x6, 0, 0),
 
	MKRAIL(0xC, 1, 0),
 
	MKCLRRAIL(0, -1, 0),
 
	MKCLRRAIL(0, 0, -1),
 
	MKCLRRAIL(0, 1, -1),
 
	MKCLRRAIL(0, 2, 0),
 
	MKEND
 
};
 

	
 
@@ -475,14 +475,14 @@ static const AiDefaultRoadBlock _roaddat
 
};
 

	
 
static const AiDefaultBlockData _roaddata_ai_3_data[] = {
 
	MKDEPOT(0, 1,0),
 
	MKSTATION(0x0, 1,1),
 
	MKRAIL(0x6, 0,0),
 
	MKRAIL(0x3, 0,1),
 
	MKCLRRAIL(0, 0,-1),
 
	MKCLRRAIL(0, -1,0),
 
	MKCLRRAIL(0, -1,1),
 
	MKCLRRAIL(0, 0,2),
 
	MKDEPOT(0, 1, 0),
 
	MKSTATION(0x0, 1, 1),
 
	MKRAIL(0x6, 0, 0),
 
	MKRAIL(0x3, 0, 1),
 
	MKCLRRAIL(0, 0, -1),
 
	MKCLRRAIL(0, -1, 0),
 
	MKCLRRAIL(0, -1, 1),
 
	MKCLRRAIL(0, 0, 2),
 
	MKEND
 
};
 

	
 
@@ -491,11 +491,11 @@ static const AiDefaultRoadBlock _roaddat
 
};
 

	
 
static const AiDefaultBlockData _roaddata_ai_4_data[] = {
 
	MKSTATION(0x2, -1,0),
 
	MKRAIL(0x8, 0,0),
 
	MKCLRRAIL(0, 0,-1),
 
	MKCLRRAIL(0, 1,0),
 
	MKCLRRAIL(0, 0,1),
 
	MKSTATION(0x2, -1, 0),
 
	MKRAIL(0x8, 0, 0),
 
	MKCLRRAIL(0, 0, -1),
 
	MKCLRRAIL(0, 1, 0),
 
	MKCLRRAIL(0, 0, 1),
 
	MKEND
 
};
 

	
 
@@ -504,11 +504,11 @@ static const AiDefaultRoadBlock _roaddat
 
};
 

	
 
static const AiDefaultBlockData _roaddata_ai_5_data[] = {
 
	MKSTATION(0x3, 0,1),
 
	MKRAIL(0x4, 0,0),
 
	MKCLRRAIL(0, -1,0),
 
	MKCLRRAIL(0, 0,-1),
 
	MKCLRRAIL(0, 1,0),
 
	MKSTATION(0x3, 0, 1),
 
	MKRAIL(0x4, 0, 0),
 
	MKCLRRAIL(0, -1, 0),
 
	MKCLRRAIL(0, 0, -1),
 
	MKCLRRAIL(0, 1, 0),
 
	MKEND
 
};
 

	
 
@@ -517,11 +517,11 @@ static const AiDefaultRoadBlock _roaddat
 
};
 

	
 
static const AiDefaultBlockData _roaddata_ai_6_data[] = {
 
	MKSTATION(0x0, 1,1),
 
	MKRAIL(0x2, 0,1),
 
	MKCLRRAIL(0, 0,0),
 
	MKCLRRAIL(0, -1,0),
 
	MKCLRRAIL(0, 0,2),
 
	MKSTATION(0x0, 1, 1),
 
	MKRAIL(0x2, 0, 1),
 
	MKCLRRAIL(0, 0, 0),
 
	MKCLRRAIL(0, -1, 0),
 
	MKCLRRAIL(0, 0, 2),
 
	MKEND
 
};
 

	
 
@@ -530,11 +530,11 @@ static const AiDefaultRoadBlock _roaddat
 
};
 

	
 
static const AiDefaultBlockData _roaddata_ai_7_data[] = {
 
	MKSTATION(0x1, 1,-1),
 
	MKRAIL(0x1, 1,0),
 
	MKCLRRAIL(0, 0,0),
 
	MKCLRRAIL(0, 1,1),
 
	MKCLRRAIL(0, 2,0),
 
	MKSTATION(0x1, 1, -1),
 
	MKRAIL(0x1, 1, 0),
 
	MKCLRRAIL(0, 0, 0),
 
	MKCLRRAIL(0, 1, 1),
 
	MKCLRRAIL(0, 2, 0),
 
	MKEND
 
};
 

	
src/table/build_industry.h
Show inline comments
 
@@ -5,54 +5,54 @@
 
#ifndef BUILD_INDUSTRY_H
 
#define BUILD_INDUSTRY_H
 

	
 
#define MK(x,y, m) {{x, y}, m}
 
#define MK(x, y, m) {{x, y}, m}
 

	
 
#define MKEND {{-0x80, 0}, 0}
 

	
 
static const IndustryTileTable _tile_table_coal_mine_0[] = {
 
	MK(1,1, 0),
 
	MK(1,2, 2),
 
	MK(0,0, 5),
 
	MK(1,0, 6),
 
	MK(2,0, 3),
 
	MK(2,2, 3),
 
	MK(1, 1, 0),
 
	MK(1, 2, 2),
 
	MK(0, 0, 5),
 
	MK(1, 0, 6),
 
	MK(2, 0, 3),
 
	MK(2, 2, 3),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_coal_mine_1[] = {
 
	MK(1,1, 0),
 
	MK(1,2, 2),
 
	MK(2,0, 0),
 
	MK(2,1, 2),
 
	MK(1,0, 3),
 
	MK(0,0, 3),
 
	MK(0,1, 4),
 
	MK(0,2, 4),
 
	MK(2,2, 4),
 
	MK(1, 1, 0),
 
	MK(1, 2, 2),
 
	MK(2, 0, 0),
 
	MK(2, 1, 2),
 
	MK(1, 0, 3),
 
	MK(0, 0, 3),
 
	MK(0, 1, 4),
 
	MK(0, 2, 4),
 
	MK(2, 2, 4),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_coal_mine_2[] = {
 
	MK(0,0, 0),
 
	MK(0,1, 2),
 
	MK(0,2, 5),
 
	MK(1,0, 3),
 
	MK(1,1, 3),
 
	MK(1,2, 6),
 
	MK(0, 0, 0),
 
	MK(0, 1, 2),
 
	MK(0, 2, 5),
 
	MK(1, 0, 3),
 
	MK(1, 1, 3),
 
	MK(1, 2, 6),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_coal_mine_3[] = {
 
	MK(0,1, 0),
 
	MK(0,2, 2),
 
	MK(0,3, 4),
 
	MK(1,0, 5),
 
	MK(1,1, 0),
 
	MK(1,2, 2),
 
	MK(1,3, 3),
 
	MK(2,0, 6),
 
	MK(2,1, 4),
 
	MK(2,2, 3),
 
	MK(0, 1, 0),
 
	MK(0, 2, 2),
 
	MK(0, 3, 4),
 
	MK(1, 0, 5),
 
	MK(1, 1, 0),
 
	MK(1, 2, 2),
 
	MK(1, 3, 3),
 
	MK(2, 0, 6),
 
	MK(2, 1, 4),
 
	MK(2, 2, 3),
 
	MKEND
 
};
 

	
 
@@ -64,36 +64,36 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_power_station_0[] = {
 
	MK(0,0, 7),
 
	MK(0,1, 9),
 
	MK(1,0, 7),
 
	MK(1,1, 8),
 
	MK(2,0, 7),
 
	MK(2,1, 8),
 
	MK(3,0, 10),
 
	MK(3,1, 10),
 
	MK(0, 0, 7),
 
	MK(0, 1, 9),
 
	MK(1, 0, 7),
 
	MK(1, 1, 8),
 
	MK(2, 0, 7),
 
	MK(2, 1, 8),
 
	MK(3, 0, 10),
 
	MK(3, 1, 10),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_power_station_1[] = {
 
	MK(0,1, 7),
 
	MK(0,2, 7),
 
	MK(1,0, 8),
 
	MK(1,1, 8),
 
	MK(1,2, 7),
 
	MK(2,0, 9),
 
	MK(2,1, 10),
 
	MK(2,2, 9),
 
	MK(0, 1, 7),
 
	MK(0, 2, 7),
 
	MK(1, 0, 8),
 
	MK(1, 1, 8),
 
	MK(1, 2, 7),
 
	MK(2, 0, 9),
 
	MK(2, 1, 10),
 
	MK(2, 2, 9),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_power_station_2[] = {
 
	MK(0,0, 7),
 
	MK(0,1, 7),
 
	MK(1,0, 9),
 
	MK(1,1, 8),
 
	MK(2,0, 10),
 
	MK(2,1, 9),
 
	MK(0, 0, 7),
 
	MK(0, 1, 7),
 
	MK(1, 0, 9),
 
	MK(1, 1, 8),
 
	MK(2, 0, 10),
 
	MK(2, 1, 9),
 
	MKEND
 
};
 

	
 
@@ -104,26 +104,26 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_sawmill_0[] = {
 
	MK(1,0, 14),
 
	MK(1,1, 12),
 
	MK(1,2, 11),
 
	MK(2,0, 14),
 
	MK(2,1, 13),
 
	MK(0,0, 15),
 
	MK(0,1, 15),
 
	MK(0,2, 12),
 
	MK(1, 0, 14),
 
	MK(1, 1, 12),
 
	MK(1, 2, 11),
 
	MK(2, 0, 14),
 
	MK(2, 1, 13),
 
	MK(0, 0, 15),
 
	MK(0, 1, 15),
 
	MK(0, 2, 12),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_sawmill_1[] = {
 
	MK(0,0, 15),
 
	MK(0,1, 11),
 
	MK(0,2, 14),
 
	MK(1,0, 15),
 
	MK(1,1, 13),
 
	MK(1,2, 12),
 
	MK(2,0, 11),
 
	MK(2,1, 13),
 
	MK(0, 0, 15),
 
	MK(0, 1, 11),
 
	MK(0, 2, 14),
 
	MK(1, 0, 15),
 
	MK(1, 1, 13),
 
	MK(1, 2, 12),
 
	MK(2, 0, 11),
 
	MK(2, 1, 13),
 
	MKEND
 
};
 

	
 
@@ -133,51 +133,51 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_forest_0[] = {
 
	MK(0,0, 16),
 
	MK(0,1, 16),
 
	MK(0,2, 16),
 
	MK(0,3, 16),
 
	MK(1,0, 16),
 
	MK(1,1, 16),
 
	MK(1,2, 16),
 
	MK(1,3, 16),
 
	MK(2,0, 16),
 
	MK(2,1, 16),
 
	MK(2,2, 16),
 
	MK(2,3, 16),
 
	MK(3,0, 16),
 
	MK(3,1, 16),
 
	MK(3,2, 16),
 
	MK(3,3, 16),
 
	MK(1,4, 16),
 
	MK(2,4, 16),
 
	MK(0, 0, 16),
 
	MK(0, 1, 16),
 
	MK(0, 2, 16),
 
	MK(0, 3, 16),
 
	MK(1, 0, 16),
 
	MK(1, 1, 16),
 
	MK(1, 2, 16),
 
	MK(1, 3, 16),
 
	MK(2, 0, 16),
 
	MK(2, 1, 16),
 
	MK(2, 2, 16),
 
	MK(2, 3, 16),
 
	MK(3, 0, 16),
 
	MK(3, 1, 16),
 
	MK(3, 2, 16),
 
	MK(3, 3, 16),
 
	MK(1, 4, 16),
 
	MK(2, 4, 16),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_forest_1[] = {
 
	MK(0,0, 16),
 
	MK(1,0, 16),
 
	MK(2,0, 16),
 
	MK(3,0, 16),
 
	MK(4,0, 16),
 
	MK(0,1, 16),
 
	MK(1,1, 16),
 
	MK(2,1, 16),
 
	MK(3,1, 16),
 
	MK(4,1, 16),
 
	MK(0,2, 16),
 
	MK(1,2, 16),
 
	MK(2,2, 16),
 
	MK(3,2, 16),
 
	MK(4,2, 16),
 
	MK(0,3, 16),
 
	MK(1,3, 16),
 
	MK(2,3, 16),
 
	MK(3,3, 16),
 
	MK(4,3, 16),
 
	MK(1,4, 16),
 
	MK(2,4, 16),
 
	MK(3,4, 16),
 
	MK(0, 0, 16),
 
	MK(1, 0, 16),
 
	MK(2, 0, 16),
 
	MK(3, 0, 16),
 
	MK(4, 0, 16),
 
	MK(0, 1, 16),
 
	MK(1, 1, 16),
 
	MK(2, 1, 16),
 
	MK(3, 1, 16),
 
	MK(4, 1, 16),
 
	MK(0, 2, 16),
 
	MK(1, 2, 16),
 
	MK(2, 2, 16),
 
	MK(3, 2, 16),
 
	MK(4, 2, 16),
 
	MK(0, 3, 16),
 
	MK(1, 3, 16),
 
	MK(2, 3, 16),
 
	MK(3, 3, 16),
 
	MK(4, 3, 16),
 
	MK(1, 4, 16),
 
	MK(2, 4, 16),
 
	MK(3, 4, 16),
 
	MKEND
 
};
 

	
 
@@ -187,40 +187,40 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_oil_refinery_0[] = {
 
	MK(0,0, 20),
 
	MK(0,1, 21),
 
	MK(0,2, 22),
 
	MK(0,3, 21),
 
	MK(1,0, 20),
 
	MK(1,1, 19),
 
	MK(1,2, 22),
 
	MK(1,3, 20),
 
	MK(2,1, 18),
 
	MK(2,2, 18),
 
	MK(2,3, 18),
 
	MK(3,2, 18),
 
	MK(3,3, 18),
 
	MK(2,0, 23),
 
	MK(3,1, 23),
 
	MK(0, 0, 20),
 
	MK(0, 1, 21),
 
	MK(0, 2, 22),
 
	MK(0, 3, 21),
 
	MK(1, 0, 20),
 
	MK(1, 1, 19),
 
	MK(1, 2, 22),
 
	MK(1, 3, 20),
 
	MK(2, 1, 18),
 
	MK(2, 2, 18),
 
	MK(2, 3, 18),
 
	MK(3, 2, 18),
 
	MK(3, 3, 18),
 
	MK(2, 0, 23),
 
	MK(3, 1, 23),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_oil_refinery_1[] = {
 
	MK(0,0, 18),
 
	MK(0,1, 18),
 
	MK(0,2, 21),
 
	MK(0,3, 22),
 
	MK(0,4, 20),
 
	MK(1,0, 18),
 
	MK(1,1, 18),
 
	MK(1,2, 19),
 
	MK(1,3, 20),
 
	MK(2,0, 18),
 
	MK(2,1, 18),
 
	MK(2,2, 19),
 
	MK(2,3, 22),
 
	MK(1,4, 23),
 
	MK(2,4, 23),
 
	MK(0, 0, 18),
 
	MK(0, 1, 18),
 
	MK(0, 2, 21),
 
	MK(0, 3, 22),
 
	MK(0, 4, 20),
 
	MK(1, 0, 18),
 
	MK(1, 1, 18),
 
	MK(1, 2, 19),
 
	MK(1, 3, 20),
 
	MK(2, 0, 18),
 
	MK(2, 1, 18),
 
	MK(2, 2, 19),
 
	MK(2, 3, 22),
 
	MK(1, 4, 23),
 
	MK(2, 4, 23),
 
	MKEND
 
};
 

	
 
@@ -230,51 +230,51 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_oil_rig_0[] = {
 
	MK(0,0, 24),
 
	MK(0,1, 24),
 
	MK(0,2, 25),
 
	MK(1,0, 26),
 
	MK(1,1, 27),
 
	MK(1,2, 28),
 
	MK(-4,-5, 255),
 
	MK(-4,-4, 255),
 
	MK(-4,-3, 255),
 
	MK(-4,-2, 255),
 
	MK(-4,-1, 255),
 
	MK(-4,0, 255),
 
	MK(-4,1, 255),
 
	MK(-4,2, 255),
 
	MK(-4,3, 255),
 
	MK(-4,4, 255),
 
	MK(-4,5, 255),
 
	MK(-3,5, 255),
 
	MK(-2,5, 255),
 
	MK(-1,5, 255),
 
	MK(0,6, 255),
 
	MK(1,6, 255),
 
	MK(2,6, 255),
 
	MK(3,6, 255),
 
	MK(4,6, 255),
 
	MK(5,6, 255),
 
	MK(5,5, 255),
 
	MK(5,4, 255),
 
	MK(5,3, 255),
 
	MK(5,2, 255),
 
	MK(5,1, 255),
 
	MK(5,0, 255),
 
	MK(5,-1, 255),
 
	MK(5,-2, 255),
 
	MK(5,-3, 255),
 
	MK(5,-4, 255),
 
	MK(4,-4, 255),
 
	MK(3,-4, 255),
 
	MK(2,-4, 255),
 
	MK(1,-4, 255),
 
	MK(0,-4, 255),
 
	MK(-1,-5, 255),
 
	MK(-2,-5, 255),
 
	MK(-3,-5, 255),
 
	MK(2,0, 255),
 
	MK(0, 0, 24),
 
	MK(0, 1, 24),
 
	MK(0, 2, 25),
 
	MK(1, 0, 26),
 
	MK(1, 1, 27),
 
	MK(1, 2, 28),
 
	MK(-4, -5, 255),
 
	MK(-4, -4, 255),
 
	MK(-4, -3, 255),
 
	MK(-4, -2, 255),
 
	MK(-4, -1, 255),
 
	MK(-4, 0, 255),
 
	MK(-4, 1, 255),
 
	MK(-4, 2, 255),
 
	MK(-4, 3, 255),
 
	MK(-4, 4, 255),
 
	MK(-4, 5, 255),
 
	MK(-3, 5, 255),
 
	MK(-2, 5, 255),
 
	MK(-1, 5, 255),
 
	MK(0, 6, 255),
 
	MK(1, 6, 255),
 
	MK(2, 6, 255),
 
	MK(3, 6, 255),
 
	MK(4, 6, 255),
 
	MK(5, 6, 255),
 
	MK(5, 5, 255),
 
	MK(5, 4, 255),
 
	MK(5, 3, 255),
 
	MK(5, 2, 255),
 
	MK(5, 1, 255),
 
	MK(5, 0, 255),
 
	MK(5, -1, 255),
 
	MK(5, -2, 255),
 
	MK(5, -3, 255),
 
	MK(5, -4, 255),
 
	MK(4, -4, 255),
 
	MK(3, -4, 255),
 
	MK(2, -4, 255),
 
	MK(1, -4, 255),
 
	MK(0, -4, 255),
 
	MK(-1, -5, 255),
 
	MK(-2, -5, 255),
 
	MK(-3, -5, 255),
 
	MK(2, 0, 255),
 
	MKEND
 
};
 

	
 
@@ -283,34 +283,34 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_factory_0[] = {
 
	MK(0,0, 39),
 
	MK(0,1, 40),
 
	MK(1,0, 41),
 
	MK(1,1, 42),
 
	MK(0,2, 39),
 
	MK(0,3, 40),
 
	MK(1,2, 41),
 
	MK(1,3, 42),
 
	MK(2,1, 39),
 
	MK(2,2, 40),
 
	MK(3,1, 41),
 
	MK(3,2, 42),
 
	MK(0, 0, 39),
 
	MK(0, 1, 40),
 
	MK(1, 0, 41),
 
	MK(1, 1, 42),
 
	MK(0, 2, 39),
 
	MK(0, 3, 40),
 
	MK(1, 2, 41),
 
	MK(1, 3, 42),
 
	MK(2, 1, 39),
 
	MK(2, 2, 40),
 
	MK(3, 1, 41),
 
	MK(3, 2, 42),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_factory_1[] = {
 
	MK(0,0, 39),
 
	MK(0,1, 40),
 
	MK(1,0, 41),
 
	MK(1,1, 42),
 
	MK(2,0, 39),
 
	MK(2,1, 40),
 
	MK(3,0, 41),
 
	MK(3,1, 42),
 
	MK(1,2, 39),
 
	MK(1,3, 40),
 
	MK(2,2, 41),
 
	MK(2,3, 42),
 
	MK(0, 0, 39),
 
	MK(0, 1, 40),
 
	MK(1, 0, 41),
 
	MK(1, 1, 42),
 
	MK(2, 0, 39),
 
	MK(2, 1, 40),
 
	MK(3, 0, 41),
 
	MK(3, 1, 42),
 
	MK(1, 2, 39),
 
	MK(1, 3, 40),
 
	MK(2, 2, 41),
 
	MK(2, 3, 42),
 
	MKEND
 
};
 

	
 
@@ -320,34 +320,34 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_printing_works_0[] = {
 
	MK(0,0, 43),
 
	MK(0,1, 44),
 
	MK(1,0, 45),
 
	MK(1,1, 46),
 
	MK(0,2, 43),
 
	MK(0,3, 44),
 
	MK(1,2, 45),
 
	MK(1,3, 46),
 
	MK(2,1, 43),
 
	MK(2,2, 44),
 
	MK(3,1, 45),
 
	MK(3,2, 46),
 
	MK(0, 0, 43),
 
	MK(0, 1, 44),
 
	MK(1, 0, 45),
 
	MK(1, 1, 46),
 
	MK(0, 2, 43),
 
	MK(0, 3, 44),
 
	MK(1, 2, 45),
 
	MK(1, 3, 46),
 
	MK(2, 1, 43),
 
	MK(2, 2, 44),
 
	MK(3, 1, 45),
 
	MK(3, 2, 46),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_printing_works_1[] = {
 
	MK(0,0, 43),
 
	MK(0,1, 44),
 
	MK(1,0, 45),
 
	MK(1,1, 46),
 
	MK(2,0, 43),
 
	MK(2,1, 44),
 
	MK(3,0, 45),
 
	MK(3,1, 46),
 
	MK(1,2, 43),
 
	MK(1,3, 44),
 
	MK(2,2, 45),
 
	MK(2,3, 46),
 
	MK(0, 0, 43),
 
	MK(0, 1, 44),
 
	MK(1, 0, 45),
 
	MK(1, 1, 46),
 
	MK(2, 0, 43),
 
	MK(2, 1, 44),
 
	MK(3, 0, 45),
 
	MK(3, 1, 46),
 
	MK(1, 2, 43),
 
	MK(1, 3, 44),
 
	MK(2, 2, 45),
 
	MK(2, 3, 46),
 
	MKEND
 
};
 

	
 
@@ -357,36 +357,36 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_steel_mill_0[] = {
 
	MK(2,1, 52),
 
	MK(2,2, 53),
 
	MK(3,1, 54),
 
	MK(3,2, 55),
 
	MK(0,0, 56),
 
	MK(1,0, 57),
 
	MK(0,1, 56),
 
	MK(1,1, 57),
 
	MK(0,2, 56),
 
	MK(1,2, 57),
 
	MK(2,0, 56),
 
	MK(3,0, 57),
 
	MK(2, 1, 52),
 
	MK(2, 2, 53),
 
	MK(3, 1, 54),
 
	MK(3, 2, 55),
 
	MK(0, 0, 56),
 
	MK(1, 0, 57),
 
	MK(0, 1, 56),
 
	MK(1, 1, 57),
 
	MK(0, 2, 56),
 
	MK(1, 2, 57),
 
	MK(2, 0, 56),
 
	MK(3, 0, 57),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_steel_mill_1[] = {
 
	MK(0,0, 52),
 
	MK(0,1, 53),
 
	MK(1,0, 54),
 
	MK(1,1, 55),
 
	MK(2,0, 52),
 
	MK(2,1, 53),
 
	MK(3,0, 54),
 
	MK(3,1, 55),
 
	MK(0,2, 56),
 
	MK(1,2, 57),
 
	MK(2,2, 56),
 
	MK(3,2, 57),
 
	MK(1,3, 56),
 
	MK(2,3, 57),
 
	MK(0, 0, 52),
 
	MK(0, 1, 53),
 
	MK(1, 0, 54),
 
	MK(1, 1, 55),
 
	MK(2, 0, 52),
 
	MK(2, 1, 53),
 
	MK(3, 0, 54),
 
	MK(3, 1, 55),
 
	MK(0, 2, 56),
 
	MK(1, 2, 57),
 
	MK(2, 2, 56),
 
	MK(3, 2, 57),
 
	MK(1, 3, 56),
 
	MK(2, 3, 57),
 
	MKEND
 
};
 

	
 
@@ -396,47 +396,47 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_farm_0[] = {
 
	MK(1,0, 33),
 
	MK(1,1, 34),
 
	MK(1,2, 36),
 
	MK(0,0, 37),
 
	MK(0,1, 37),
 
	MK(0,2, 36),
 
	MK(2,0, 35),
 
	MK(2,1, 38),
 
	MK(2,2, 38),
 
	MK(1, 0, 33),
 
	MK(1, 1, 34),
 
	MK(1, 2, 36),
 
	MK(0, 0, 37),
 
	MK(0, 1, 37),
 
	MK(0, 2, 36),
 
	MK(2, 0, 35),
 
	MK(2, 1, 38),
 
	MK(2, 2, 38),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_farm_1[] = {
 
	MK(1,1, 33),
 
	MK(1,2, 34),
 
	MK(0,0, 35),
 
	MK(0,1, 36),
 
	MK(0,2, 36),
 
	MK(0,3, 35),
 
	MK(1,0, 37),
 
	MK(1,3, 38),
 
	MK(2,0, 37),
 
	MK(2,1, 37),
 
	MK(2,2, 38),
 
	MK(2,3, 38),
 
	MK(1, 1, 33),
 
	MK(1, 2, 34),
 
	MK(0, 0, 35),
 
	MK(0, 1, 36),
 
	MK(0, 2, 36),
 
	MK(0, 3, 35),
 
	MK(1, 0, 37),
 
	MK(1, 3, 38),
 
	MK(2, 0, 37),
 
	MK(2, 1, 37),
 
	MK(2, 2, 38),
 
	MK(2, 3, 38),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_farm_2[] = {
 
	MK(2,0, 33),
 
	MK(2,1, 34),
 
	MK(0,0, 36),
 
	MK(0,1, 36),
 
	MK(0,2, 37),
 
	MK(0,3, 37),
 
	MK(1,0, 35),
 
	MK(1,1, 38),
 
	MK(1,2, 38),
 
	MK(1,3, 37),
 
	MK(2,2, 37),
 
	MK(2,3, 35),
 
	MK(2, 0, 33),
 
	MK(2, 1, 34),
 
	MK(0, 0, 36),
 
	MK(0, 1, 36),
 
	MK(0, 2, 37),
 
	MK(0, 3, 37),
 
	MK(1, 0, 35),
 
	MK(1, 1, 38),
 
	MK(1, 2, 38),
 
	MK(1, 3, 37),
 
	MK(2, 2, 37),
 
	MK(2, 3, 35),
 
	MKEND
 
};
 

	
 
@@ -447,27 +447,27 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_copper_mine_0[] = {
 
	MK(0,0, 47),
 
	MK(0,1, 49),
 
	MK(0,2, 51),
 
	MK(1,0, 47),
 
	MK(1,1, 49),
 
	MK(1,2, 50),
 
	MK(2,0, 51),
 
	MK(2,1, 51),
 
	MK(0, 0, 47),
 
	MK(0, 1, 49),
 
	MK(0, 2, 51),
 
	MK(1, 0, 47),
 
	MK(1, 1, 49),
 
	MK(1, 2, 50),
 
	MK(2, 0, 51),
 
	MK(2, 1, 51),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_copper_mine_1[] = {
 
	MK(0,0, 50),
 
	MK(0,1, 47),
 
	MK(0,2, 49),
 
	MK(1,0, 47),
 
	MK(1,1, 49),
 
	MK(1,2, 51),
 
	MK(2,0, 51),
 
	MK(2,1, 47),
 
	MK(2,2, 49),
 
	MK(0, 0, 50),
 
	MK(0, 1, 47),
 
	MK(0, 2, 49),
 
	MK(1, 0, 47),
 
	MK(1, 1, 49),
 
	MK(1, 2, 51),
 
	MK(2, 0, 51),
 
	MK(2, 1, 47),
 
	MK(2, 2, 49),
 
	MKEND
 
};
 

	
 
@@ -477,20 +477,20 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_oil_well_0[] = {
 
	MK(0,0, 29),
 
	MK(1,0, 29),
 
	MK(2,0, 29),
 
	MK(0,1, 29),
 
	MK(0,2, 29),
 
	MK(0, 0, 29),
 
	MK(1, 0, 29),
 
	MK(2, 0, 29),
 
	MK(0, 1, 29),
 
	MK(0, 2, 29),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_oil_well_1[] = {
 
	MK(0,0, 29),
 
	MK(1,0, 29),
 
	MK(1,1, 29),
 
	MK(2,2, 29),
 
	MK(2,3, 29),
 
	MK(0, 0, 29),
 
	MK(1, 0, 29),
 
	MK(1, 1, 29),
 
	MK(2, 2, 29),
 
	MK(2, 3, 29),
 
	MKEND
 
};
 

	
 
@@ -500,8 +500,8 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_bank_0[] = {
 
	MK(0,0, 58),
 
	MK(1,0, 59),
 
	MK(0, 0, 58),
 
	MK(1, 0, 59),
 
	MKEND
 
};
 

	
 
@@ -510,36 +510,36 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_food_process_0[] = {
 
	MK(0,0, 60),
 
	MK(1,0, 60),
 
	MK(2,0, 60),
 
	MK(0,1, 60),
 
	MK(1,1, 60),
 
	MK(2,1, 60),
 
	MK(0,2, 61),
 
	MK(1,2, 61),
 
	MK(2,2, 63),
 
	MK(0,3, 62),
 
	MK(1,3, 62),
 
	MK(2,3, 63),
 
	MK(0, 0, 60),
 
	MK(1, 0, 60),
 
	MK(2, 0, 60),
 
	MK(0, 1, 60),
 
	MK(1, 1, 60),
 
	MK(2, 1, 60),
 
	MK(0, 2, 61),
 
	MK(1, 2, 61),
 
	MK(2, 2, 63),
 
	MK(0, 3, 62),
 
	MK(1, 3, 62),
 
	MK(2, 3, 63),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_food_process_1[] = {
 
	MK(0,0, 61),
 
	MK(1,0, 60),
 
	MK(2,0, 61),
 
	MK(3,0, 61),
 
	MK(0,1, 62),
 
	MK(1,1, 63),
 
	MK(2,1, 63),
 
	MK(3,1, 63),
 
	MK(0,2, 60),
 
	MK(1,2, 60),
 
	MK(2,2, 60),
 
	MK(3,2, 60),
 
	MK(0,3, 62),
 
	MK(1,3, 62),
 
	MK(0, 0, 61),
 
	MK(1, 0, 60),
 
	MK(2, 0, 61),
 
	MK(3, 0, 61),
 
	MK(0, 1, 62),
 
	MK(1, 1, 63),
 
	MK(2, 1, 63),
 
	MK(3, 1, 63),
 
	MK(0, 2, 60),
 
	MK(1, 2, 60),
 
	MK(2, 2, 60),
 
	MK(3, 2, 60),
 
	MK(0, 3, 62),
 
	MK(1, 3, 62),
 
	MKEND
 
};
 

	
 
@@ -549,18 +549,18 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_paper_mill_0[] = {
 
	MK(0,0, 64),
 
	MK(1,0, 65),
 
	MK(2,0, 66),
 
	MK(3,0, 67),
 
	MK(0,1, 68),
 
	MK(1,1, 69),
 
	MK(2,1, 67),
 
	MK(3,1, 67),
 
	MK(0,2, 66),
 
	MK(1,2, 71),
 
	MK(2,2, 71),
 
	MK(3,2, 70),
 
	MK(0, 0, 64),
 
	MK(1, 0, 65),
 
	MK(2, 0, 66),
 
	MK(3, 0, 67),
 
	MK(0, 1, 68),
 
	MK(1, 1, 69),
 
	MK(2, 1, 67),
 
	MK(3, 1, 67),
 
	MK(0, 2, 66),
 
	MK(1, 2, 71),
 
	MK(2, 2, 71),
 
	MK(3, 2, 70),
 
	MKEND
 
};
 

	
 
@@ -569,22 +569,22 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_gold_mine_0[] = {
 
	MK(0,0, 72),
 
	MK(0,1, 73),
 
	MK(0,2, 74),
 
	MK(0,3, 75),
 
	MK(1,0, 76),
 
	MK(1,1, 77),
 
	MK(1,2, 78),
 
	MK(1,3, 79),
 
	MK(2,0, 80),
 
	MK(2,1, 81),
 
	MK(2,2, 82),
 
	MK(2,3, 83),
 
	MK(3,0, 84),
 
	MK(3,1, 85),
 
	MK(3,2, 86),
 
	MK(3,3, 87),
 
	MK(0, 0, 72),
 
	MK(0, 1, 73),
 
	MK(0, 2, 74),
 
	MK(0, 3, 75),
 
	MK(1, 0, 76),
 
	MK(1, 1, 77),
 
	MK(1, 2, 78),
 
	MK(1, 3, 79),
 
	MK(2, 0, 80),
 
	MK(2, 1, 81),
 
	MK(2, 2, 82),
 
	MK(2, 3, 83),
 
	MK(3, 0, 84),
 
	MK(3, 1, 85),
 
	MK(3, 2, 86),
 
	MK(3, 3, 87),
 
	MKEND
 
};
 

	
 
@@ -593,8 +593,8 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_bank2_0[] = {
 
	MK(0,0, 89),
 
	MK(1,0, 90),
 
	MK(0, 0, 89),
 
	MK(1, 0, 90),
 
	MKEND
 
};
 

	
 
@@ -603,15 +603,15 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_diamond_mine_0[] = {
 
	MK(0,0, 91),
 
	MK(0,1, 92),
 
	MK(0,2, 93),
 
	MK(1,0, 94),
 
	MK(1,1, 95),
 
	MK(1,2, 96),
 
	MK(2,0, 97),
 
	MK(2,1, 98),
 
	MK(2,2, 99),
 
	MK(0, 0, 91),
 
	MK(0, 1, 92),
 
	MK(0, 2, 93),
 
	MK(1, 0, 94),
 
	MK(1, 1, 95),
 
	MK(1, 2, 96),
 
	MK(2, 0, 97),
 
	MK(2, 1, 98),
 
	MK(2, 2, 99),
 
	MKEND
 
};
 

	
 
@@ -620,22 +620,22 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_iron_mine_0[] = {
 
	MK(0,0, 100),
 
	MK(0,1, 101),
 
	MK(0,2, 102),
 
	MK(0,3, 103),
 
	MK(1,0, 104),
 
	MK(1,1, 105),
 
	MK(1,2, 106),
 
	MK(1,3, 107),
 
	MK(2,0, 108),
 
	MK(2,1, 109),
 
	MK(2,2, 110),
 
	MK(2,3, 111),
 
	MK(3,0, 112),
 
	MK(3,1, 113),
 
	MK(3,2, 114),
 
	MK(3,3, 115),
 
	MK(0, 0, 100),
 
	MK(0, 1, 101),
 
	MK(0, 2, 102),
 
	MK(0, 3, 103),
 
	MK(1, 0, 104),
 
	MK(1, 1, 105),
 
	MK(1, 2, 106),
 
	MK(1, 3, 107),
 
	MK(2, 0, 108),
 
	MK(2, 1, 109),
 
	MK(2, 2, 110),
 
	MK(2, 3, 111),
 
	MK(3, 0, 112),
 
	MK(3, 1, 113),
 
	MK(3, 2, 114),
 
	MK(3, 3, 115),
 
	MKEND
 
};
 

	
 
@@ -644,26 +644,26 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_fruit_plantation_0[] = {
 
	MK(0,0, 116),
 
	MK(0,1, 116),
 
	MK(0,2, 116),
 
	MK(0,3, 116),
 
	MK(1,0, 116),
 
	MK(1,1, 116),
 
	MK(1,2, 116),
 
	MK(1,3, 116),
 
	MK(2,0, 116),
 
	MK(2,1, 116),
 
	MK(2,2, 116),
 
	MK(2,3, 116),
 
	MK(3,0, 116),
 
	MK(3,1, 116),
 
	MK(3,2, 116),
 
	MK(3,3, 116),
 
	MK(4,0, 116),
 
	MK(4,1, 116),
 
	MK(4,2, 116),
 
	MK(4,3, 116),
 
	MK(0, 0, 116),
 
	MK(0, 1, 116),
 
	MK(0, 2, 116),
 
	MK(0, 3, 116),
 
	MK(1, 0, 116),
 
	MK(1, 1, 116),
 
	MK(1, 2, 116),
 
	MK(1, 3, 116),
 
	MK(2, 0, 116),
 
	MK(2, 1, 116),
 
	MK(2, 2, 116),
 
	MK(2, 3, 116),
 
	MK(3, 0, 116),
 
	MK(3, 1, 116),
 
	MK(3, 2, 116),
 
	MK(3, 3, 116),
 
	MK(4, 0, 116),
 
	MK(4, 1, 116),
 
	MK(4, 2, 116),
 
	MK(4, 3, 116),
 
	MKEND
 
};
 

	
 
@@ -672,26 +672,26 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_rubber_plantation_0[] = {
 
	MK(0,0, 117),
 
	MK(0,1, 117),
 
	MK(0,2, 117),
 
	MK(0,3, 117),
 
	MK(1,0, 117),
 
	MK(1,1, 117),
 
	MK(1,2, 117),
 
	MK(1,3, 117),
 
	MK(2,0, 117),
 
	MK(2,1, 117),
 
	MK(2,2, 117),
 
	MK(2,3, 117),
 
	MK(3,0, 117),
 
	MK(3,1, 117),
 
	MK(3,2, 117),
 
	MK(3,3, 117),
 
	MK(4,0, 117),
 
	MK(4,1, 117),
 
	MK(4,2, 117),
 
	MK(4,3, 117),
 
	MK(0, 0, 117),
 
	MK(0, 1, 117),
 
	MK(0, 2, 117),
 
	MK(0, 3, 117),
 
	MK(1, 0, 117),
 
	MK(1, 1, 117),
 
	MK(1, 2, 117),
 
	MK(1, 3, 117),
 
	MK(2, 0, 117),
 
	MK(2, 1, 117),
 
	MK(2, 2, 117),
 
	MK(2, 3, 117),
 
	MK(3, 0, 117),
 
	MK(3, 1, 117),
 
	MK(3, 2, 117),
 
	MK(3, 3, 117),
 
	MK(4, 0, 117),
 
	MK(4, 1, 117),
 
	MK(4, 2, 117),
 
	MK(4, 3, 117),
 
	MKEND
 
};
 

	
 
@@ -700,10 +700,10 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_water_supply_0[] = {
 
	MK(0,0, 118),
 
	MK(0,1, 119),
 
	MK(1,0, 118),
 
	MK(1,1, 119),
 
	MK(0, 0, 118),
 
	MK(0, 1, 119),
 
	MK(1, 0, 118),
 
	MK(1, 1, 119),
 
	MKEND
 
};
 

	
 
@@ -712,7 +712,7 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_water_tower_0[] = {
 
	MK(0,0, 120),
 
	MK(0, 0, 120),
 
	MKEND
 
};
 

	
 
@@ -721,26 +721,26 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_factory2_0[] = {
 
	MK(0,0, 121),
 
	MK(0,1, 122),
 
	MK(1,0, 123),
 
	MK(1,1, 124),
 
	MK(0,2, 121),
 
	MK(0,3, 122),
 
	MK(1,2, 123),
 
	MK(1,3, 124),
 
	MK(0, 0, 121),
 
	MK(0, 1, 122),
 
	MK(1, 0, 123),
 
	MK(1, 1, 124),
 
	MK(0, 2, 121),
 
	MK(0, 3, 122),
 
	MK(1, 2, 123),
 
	MK(1, 3, 124),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_factory2_1[] = {
 
	MK(0,0, 121),
 
	MK(0,1, 122),
 
	MK(1,0, 123),
 
	MK(1,1, 124),
 
	MK(2,0, 121),
 
	MK(2,1, 122),
 
	MK(3,0, 123),
 
	MK(3,1, 124),
 
	MK(0, 0, 121),
 
	MK(0, 1, 122),
 
	MK(1, 0, 123),
 
	MK(1, 1, 124),
 
	MK(2, 0, 121),
 
	MK(2, 1, 122),
 
	MK(3, 0, 123),
 
	MK(3, 1, 124),
 
	MKEND
 
};
 

	
 
@@ -750,47 +750,47 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_farm2_0[] = {
 
	MK(1,0, 33),
 
	MK(1,1, 34),
 
	MK(1,2, 36),
 
	MK(0,0, 37),
 
	MK(0,1, 37),
 
	MK(0,2, 36),
 
	MK(2,0, 35),
 
	MK(2,1, 38),
 
	MK(2,2, 38),
 
	MK(1, 0, 33),
 
	MK(1, 1, 34),
 
	MK(1, 2, 36),
 
	MK(0, 0, 37),
 
	MK(0, 1, 37),
 
	MK(0, 2, 36),
 
	MK(2, 0, 35),
 
	MK(2, 1, 38),
 
	MK(2, 2, 38),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_farm2_1[] = {
 
	MK(1,1, 33),
 
	MK(1,2, 34),
 
	MK(0,0, 35),
 
	MK(0,1, 36),
 
	MK(0,2, 36),
 
	MK(0,3, 35),
 
	MK(1,0, 37),
 
	MK(1,3, 38),
 
	MK(2,0, 37),
 
	MK(2,1, 37),
 
	MK(2,2, 38),
 
	MK(2,3, 38),
 
	MK(1, 1, 33),
 
	MK(1, 2, 34),
 
	MK(0, 0, 35),
 
	MK(0, 1, 36),
 
	MK(0, 2, 36),
 
	MK(0, 3, 35),
 
	MK(1, 0, 37),
 
	MK(1, 3, 38),
 
	MK(2, 0, 37),
 
	MK(2, 1, 37),
 
	MK(2, 2, 38),
 
	MK(2, 3, 38),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_farm2_2[] = {
 
	MK(2,0, 33),
 
	MK(2,1, 34),
 
	MK(0,0, 36),
 
	MK(0,1, 36),
 
	MK(0,2, 37),
 
	MK(0,3, 37),
 
	MK(1,0, 35),
 
	MK(1,1, 38),
 
	MK(1,2, 38),
 
	MK(1,3, 37),
 
	MK(2,2, 37),
 
	MK(2,3, 35),
 
	MK(2, 0, 33),
 
	MK(2, 1, 34),
 
	MK(0, 0, 36),
 
	MK(0, 1, 36),
 
	MK(0, 2, 37),
 
	MK(0, 3, 37),
 
	MK(1, 0, 35),
 
	MK(1, 1, 38),
 
	MK(1, 2, 38),
 
	MK(1, 3, 37),
 
	MK(2, 2, 37),
 
	MK(2, 3, 35),
 
	MKEND
 
};
 

	
 
@@ -801,10 +801,10 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_lumber_mill_0[] = {
 
	MK(0,0, 125),
 
	MK(0,1, 126),
 
	MK(1,0, 127),
 
	MK(1,1, 128),
 
	MK(0, 0, 125),
 
	MK(0, 1, 126),
 
	MK(1, 0, 127),
 
	MK(1, 1, 128),
 
	MKEND
 
};
 

	
 
@@ -813,51 +813,51 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_cotton_candy_0[] = {
 
	MK(0,0, 129),
 
	MK(0,1, 129),
 
	MK(0,2, 129),
 
	MK(0,3, 129),
 
	MK(1,0, 129),
 
	MK(1,1, 129),
 
	MK(1,2, 129),
 
	MK(1,3, 129),
 
	MK(2,0, 129),
 
	MK(2,1, 129),
 
	MK(2,2, 129),
 
	MK(2,3, 129),
 
	MK(3,0, 129),
 
	MK(3,1, 129),
 
	MK(3,2, 129),
 
	MK(3,3, 129),
 
	MK(1,4, 129),
 
	MK(2,4, 129),
 
	MK(0, 0, 129),
 
	MK(0, 1, 129),
 
	MK(0, 2, 129),
 
	MK(0, 3, 129),
 
	MK(1, 0, 129),
 
	MK(1, 1, 129),
 
	MK(1, 2, 129),
 
	MK(1, 3, 129),
 
	MK(2, 0, 129),
 
	MK(2, 1, 129),
 
	MK(2, 2, 129),
 
	MK(2, 3, 129),
 
	MK(3, 0, 129),
 
	MK(3, 1, 129),
 
	MK(3, 2, 129),
 
	MK(3, 3, 129),
 
	MK(1, 4, 129),
 
	MK(2, 4, 129),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_cotton_candy_1[] = {
 
	MK(0,0, 129),
 
	MK(1,0, 129),
 
	MK(2,0, 129),
 
	MK(3,0, 129),
 
	MK(4,0, 129),
 
	MK(0,1, 129),
 
	MK(1,1, 129),
 
	MK(2,1, 129),
 
	MK(3,1, 129),
 
	MK(4,1, 129),
 
	MK(0,2, 129),
 
	MK(1,2, 129),
 
	MK(2,2, 129),
 
	MK(3,2, 129),
 
	MK(4,2, 129),
 
	MK(0,3, 129),
 
	MK(1,3, 129),
 
	MK(2,3, 129),
 
	MK(3,3, 129),
 
	MK(4,3, 129),
 
	MK(1,4, 129),
 
	MK(2,4, 129),
 
	MK(3,4, 129),
 
	MK(0, 0, 129),
 
	MK(1, 0, 129),
 
	MK(2, 0, 129),
 
	MK(3, 0, 129),
 
	MK(4, 0, 129),
 
	MK(0, 1, 129),
 
	MK(1, 1, 129),
 
	MK(2, 1, 129),
 
	MK(3, 1, 129),
 
	MK(4, 1, 129),
 
	MK(0, 2, 129),
 
	MK(1, 2, 129),
 
	MK(2, 2, 129),
 
	MK(3, 2, 129),
 
	MK(4, 2, 129),
 
	MK(0, 3, 129),
 
	MK(1, 3, 129),
 
	MK(2, 3, 129),
 
	MK(3, 3, 129),
 
	MK(4, 3, 129),
 
	MK(1, 4, 129),
 
	MK(2, 4, 129),
 
	MK(3, 4, 129),
 
	MKEND
 
};
 

	
 
@@ -867,34 +867,34 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_candy_factory_0[] = {
 
	MK(0,0, 131),
 
	MK(0,1, 132),
 
	MK(1,0, 133),
 
	MK(1,1, 134),
 
	MK(0,2, 131),
 
	MK(0,3, 132),
 
	MK(1,2, 133),
 
	MK(1,3, 134),
 
	MK(2,1, 131),
 
	MK(2,2, 132),
 
	MK(3,1, 133),
 
	MK(3,2, 134),
 
	MK(0, 0, 131),
 
	MK(0, 1, 132),
 
	MK(1, 0, 133),
 
	MK(1, 1, 134),
 
	MK(0, 2, 131),
 
	MK(0, 3, 132),
 
	MK(1, 2, 133),
 
	MK(1, 3, 134),
 
	MK(2, 1, 131),
 
	MK(2, 2, 132),
 
	MK(3, 1, 133),
 
	MK(3, 2, 134),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_candy_factory_1[] = {
 
	MK(0,0, 131),
 
	MK(0,1, 132),
 
	MK(1,0, 133),
 
	MK(1,1, 134),
 
	MK(2,0, 131),
 
	MK(2,1, 132),
 
	MK(3,0, 133),
 
	MK(3,1, 134),
 
	MK(1,2, 131),
 
	MK(1,3, 132),
 
	MK(2,2, 133),
 
	MK(2,3, 134),
 
	MK(0, 0, 131),
 
	MK(0, 1, 132),
 
	MK(1, 0, 133),
 
	MK(1, 1, 134),
 
	MK(2, 0, 131),
 
	MK(2, 1, 132),
 
	MK(3, 0, 133),
 
	MK(3, 1, 134),
 
	MK(1, 2, 131),
 
	MK(1, 3, 132),
 
	MK(2, 2, 133),
 
	MK(2, 3, 134),
 
	MKEND
 
};
 

	
 
@@ -904,26 +904,26 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_battery_farm_0[] = {
 
	MK(0,0, 135),
 
	MK(0,1, 135),
 
	MK(0,2, 135),
 
	MK(0,3, 135),
 
	MK(1,0, 135),
 
	MK(1,1, 135),
 
	MK(1,2, 135),
 
	MK(1,3, 135),
 
	MK(2,0, 135),
 
	MK(2,1, 135),
 
	MK(2,2, 135),
 
	MK(2,3, 135),
 
	MK(3,0, 135),
 
	MK(3,1, 135),
 
	MK(3,2, 135),
 
	MK(3,3, 135),
 
	MK(4,0, 135),
 
	MK(4,1, 135),
 
	MK(4,2, 135),
 
	MK(4,3, 135),
 
	MK(0, 0, 135),
 
	MK(0, 1, 135),
 
	MK(0, 2, 135),
 
	MK(0, 3, 135),
 
	MK(1, 0, 135),
 
	MK(1, 1, 135),
 
	MK(1, 2, 135),
 
	MK(1, 3, 135),
 
	MK(2, 0, 135),
 
	MK(2, 1, 135),
 
	MK(2, 2, 135),
 
	MK(2, 3, 135),
 
	MK(3, 0, 135),
 
	MK(3, 1, 135),
 
	MK(3, 2, 135),
 
	MK(3, 3, 135),
 
	MK(4, 0, 135),
 
	MK(4, 1, 135),
 
	MK(4, 2, 135),
 
	MK(4, 3, 135),
 
	MKEND
 
};
 

	
 
@@ -932,25 +932,25 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_cola_wells_0[] = {
 
	MK(0,0, 137),
 
	MK(0,1, 137),
 
	MK(0,2, 137),
 
	MK(1,0, 137),
 
	MK(1,1, 137),
 
	MK(1,2, 137),
 
	MK(2,1, 137),
 
	MK(2,2, 137),
 
	MK(0, 0, 137),
 
	MK(0, 1, 137),
 
	MK(0, 2, 137),
 
	MK(1, 0, 137),
 
	MK(1, 1, 137),
 
	MK(1, 2, 137),
 
	MK(2, 1, 137),
 
	MK(2, 2, 137),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_cola_wells_1[] = {
 
	MK(0,1, 137),
 
	MK(0,2, 137),
 
	MK(0,3, 137),
 
	MK(1,0, 137),
 
	MK(1,1, 137),
 
	MK(1,2, 137),
 
	MK(2,1, 137),
 
	MK(0, 1, 137),
 
	MK(0, 2, 137),
 
	MK(0, 3, 137),
 
	MK(1, 0, 137),
 
	MK(1, 1, 137),
 
	MK(1, 2, 137),
 
	MK(2, 1, 137),
 
	MKEND
 
};
 

	
 
@@ -960,10 +960,10 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_toy_shop_0[] = {
 
	MK(0,0, 138),
 
	MK(0,1, 139),
 
	MK(1,0, 140),
 
	MK(1,1, 141),
 
	MK(0, 0, 138),
 
	MK(0, 1, 139),
 
	MK(1, 0, 140),
 
	MK(1, 1, 141),
 
	MKEND
 
};
 

	
 
@@ -972,14 +972,14 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_toy_factory_0[] = {
 
	MK(0,0, 147),
 
	MK(0,1, 142),
 
	MK(1,0, 147),
 
	MK(1,1, 143),
 
	MK(2,0, 147),
 
	MK(2,1, 144),
 
	MK(3,0, 146),
 
	MK(3,1, 145),
 
	MK(0, 0, 147),
 
	MK(0, 1, 142),
 
	MK(1, 0, 147),
 
	MK(1, 1, 143),
 
	MK(2, 0, 147),
 
	MK(2, 1, 144),
 
	MK(3, 0, 146),
 
	MK(3, 1, 145),
 
	MKEND
 
};
 

	
 
@@ -988,16 +988,16 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_plastic_fountain_0[] = {
 
	MK(0,0, 148),
 
	MK(0,1, 151),
 
	MK(0,2, 154),
 
	MK(0, 0, 148),
 
	MK(0, 1, 151),
 
	MK(0, 2, 154),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_plastic_fountain_1[] = {
 
	MK(0,0, 148),
 
	MK(1,0, 151),
 
	MK(2,0, 154),
 
	MK(0, 0, 148),
 
	MK(1, 0, 151),
 
	MK(2, 0, 154),
 
	MKEND
 
};
 

	
 
@@ -1007,10 +1007,10 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_fizzy_drink_0[] = {
 
	MK(0,0, 156),
 
	MK(0,1, 157),
 
	MK(1,0, 158),
 
	MK(1,1, 159),
 
	MK(0, 0, 156),
 
	MK(0, 1, 157),
 
	MK(1, 0, 158),
 
	MK(1, 1, 159),
 
	MKEND
 
};
 

	
 
@@ -1019,18 +1019,18 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_bubble_generator_0[] = {
 
	MK(0,0, 163),
 
	MK(0,1, 160),
 
	MK(1,0, 163),
 
	MK(1,1, 161),
 
	MK(2,0, 163),
 
	MK(2,1, 162),
 
	MK(0,2, 163),
 
	MK(0,3, 160),
 
	MK(1,2, 163),
 
	MK(1,3, 161),
 
	MK(2,2, 163),
 
	MK(2,3, 162),
 
	MK(0, 0, 163),
 
	MK(0, 1, 160),
 
	MK(1, 0, 163),
 
	MK(1, 1, 161),
 
	MK(2, 0, 163),
 
	MK(2, 1, 162),
 
	MK(0, 2, 163),
 
	MK(0, 3, 160),
 
	MK(1, 2, 163),
 
	MK(1, 3, 161),
 
	MK(2, 2, 163),
 
	MK(2, 3, 162),
 
	MKEND
 
};
 

	
 
@@ -1039,9 +1039,9 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_toffee_quarry_0[] = {
 
	MK(0,0, 164),
 
	MK(1,0, 165),
 
	MK(2,0, 166),
 
	MK(0, 0, 164),
 
	MK(1, 0, 165),
 
	MK(2, 0, 166),
 
	MKEND
 
};
 

	
 
@@ -1050,14 +1050,14 @@ static const IndustryTileTable * const _
 
};
 

	
 
static const IndustryTileTable _tile_table_sugar_mine_0[] = {
 
	MK(0,0, 167),
 
	MK(0,1, 168),
 
	MK(1,0, 169),
 
	MK(1,1, 170),
 
	MK(2,0, 171),
 
	MK(2,1, 172),
 
	MK(3,0, 173),
 
	MK(3,1, 174),
 
	MK(0, 0, 167),
 
	MK(0, 1, 168),
 
	MK(1, 0, 169),
 
	MK(1, 1, 170),
 
	MK(2, 0, 171),
 
	MK(2, 1, 172),
 
	MK(3, 0, 173),
 
	MK(3, 1, 174),
 
	MKEND
 
};
 

	
 
@@ -1103,7 +1103,7 @@ static const IndustryTileTable * const _
 
 * @param s3   text for production down
 
 */
 

	
 
#define MI(tbl, d, ai1, ai2, ai3, ai4, ag1, ag2, ag3, ag4, col,\
 
#define MI(tbl, d, ai1, ai2, ai3, ai4, ag1, ag2, ag3, ag4, col, \
 
           c1, c2, c3, proc, p1, r1, p2, r2, m, a1, a2, a3, pr, clim, bev, in, intx, s1, s2, s3) \
 
	{tbl, lengthof(tbl), d, {c1, c2, c3}, proc, {p1, p2}, {r1, r2}, m,            \
 
	 {a1, a2, a3}, pr, clim, bev, col, in, intx, s1, s2, s3, {ai1, ai2, ai3, ai4}, {ag1, ag2, ag3, ag4}, 0, 0, 0, 0}
src/table/namegen.h
Show inline comments
 
@@ -1931,7 +1931,7 @@ static const char *name_czech_suffix[] =
 

	
 

	
 

	
 
static const char *name_romanian_real[]= {
 
static const char *name_romanian_real[] = {
 
	"Adjud",
 
	"Alba Iulia",
 
	"Alexandria",
src/table/station_land.h
Show inline comments
 
@@ -34,7 +34,7 @@ static const DrawTileSeqStruct _station_
 
	{  0,  0,  0, 16,  5,  7, SPR_RAIL_PLATFORM_PILLARS_X_REAR | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
 
	{  0, 11,  0, 16,  5,  2, SPR_RAIL_PLATFORM_X_FRONT        | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
 
	{  0,  0, 16, 16, 16, 10, SPR_RAIL_ROOF_STRUCTURE_X_TILE_A | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
 
	{  0,  0,(byte)0x80, 0,  0,  0, SPR_RAIL_ROOF_GLASS_X_TILE_A     | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
 
	{  0,  0, (byte)0x80, 0,  0,  0, SPR_RAIL_ROOF_GLASS_X_TILE_A     | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
 
	TILE_SEQ_END()
 
};
 

	
 
@@ -42,7 +42,7 @@ static const DrawTileSeqStruct _station_
 
	{  0,  0,  0,  5, 16,  2, SPR_RAIL_PLATFORM_PILLARS_Y_REAR | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
 
	{ 11,  0,  0,  5, 16,  2, SPR_RAIL_PLATFORM_Y_FRONT        | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
 
	{  0,  0, 16, 16, 16, 10, SPR_RAIL_ROOF_STRUCTURE_Y_TILE_A | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
 
	{  0,  0,(byte)0x80, 0,  0,  0, SPR_RAIL_ROOF_GLASS_Y_TILE_A     | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
 
	{  0,  0, (byte)0x80, 0,  0,  0, SPR_RAIL_ROOF_GLASS_Y_TILE_A     | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
 
	TILE_SEQ_END()
 
};
 

	
 
@@ -50,7 +50,7 @@ static const DrawTileSeqStruct _station_
 
	{  0,  0,  0, 16,  5,  2, SPR_RAIL_PLATFORM_X_REAR          | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
 
	{  0, 11,  0, 16,  5,  2, SPR_RAIL_PLATFORM_PILLARS_X_FRONT | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
 
	{  0,  0, 16, 16, 16, 10, SPR_RAIL_ROOF_STRUCTURE_X_TILE_B  | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
 
	{  0,  0,(byte)0x80, 0,  0,  0, SPR_RAIL_ROOF_GLASS_X_TILE_B      | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
 
	{  0,  0, (byte)0x80, 0,  0,  0, SPR_RAIL_ROOF_GLASS_X_TILE_B      | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
 
	TILE_SEQ_END()
 
};
 

	
 
@@ -58,7 +58,7 @@ static const DrawTileSeqStruct _station_
 
	{  0,  0,  0,  5, 16,  2, SPR_RAIL_PLATFORM_Y_REAR          | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
 
	{ 11,  0,  0,  5, 16,  2, SPR_RAIL_PLATFORM_PILLARS_Y_FRONT | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
 
	{  0,  0, 16, 16, 16, 10, SPR_RAIL_ROOF_STRUCTURE_Y_TILE_B  | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
 
	{  0,  0,(byte)0x80, 0,  0,  0, SPR_RAIL_ROOF_GLASS_Y_TILE_B      | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
 
	{  0,  0, (byte)0x80, 0,  0,  0, SPR_RAIL_ROOF_GLASS_Y_TILE_B      | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
 
	TILE_SEQ_END()
 
};
 

	
src/table/tree_land.h
Show inline comments
 
@@ -25,7 +25,7 @@ static const TreePos _tree_layout_xy[][4
 
	{ { 3, 9 }, { 8, 2 }, { 9, 9 }, { 1, 5 } }
 
};
 

	
 
static const PalSpriteID _tree_layout_sprite[164+(79-48+1)][4] = {
 
static const PalSpriteID _tree_layout_sprite[164 + (79 - 48 + 1)][4] = {
 
	{ { 0x652, PAL_NONE }, { 0x659, PAL_NONE }, { 0x660, PAL_NONE }, { 0x667, PAL_NONE } }, /* 0 */
 
	{ { 0x652, PAL_NONE }, { 0x667, PAL_NONE }, { 0x66e, PAL_NONE }, { 0x675, PAL_NONE } }, /* 1 */
 
	{ { 0x652, PAL_NONE }, { 0x66e, PAL_NONE }, { 0x659, PAL_NONE }, { 0x675, PAL_NONE } }, /* 2 */
src/terraform_gui.cpp
Show inline comments
 
@@ -273,7 +273,7 @@ static const Widget _terraform_widgets[]
 
};
 

	
 
static const WindowDesc _terraform_desc = {
 
	WDP_ALIGN_TBR, 22+36, 158, 36,
 
	WDP_ALIGN_TBR, 22 + 36, 158, 36,
 
	WC_SCEN_LAND_GEN, WC_NONE,
 
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
 
	_terraform_widgets,
src/town_cmd.cpp
Show inline comments
 
@@ -246,9 +246,9 @@ static bool IsCloseToTown(TileIndex tile
 
static void MarkTownSignDirty(Town *t)
 
{
 
	MarkAllViewportsDirty(
 
		t->sign.left-6,
 
		t->sign.top-3,
 
		t->sign.left+t->sign.width_1*4+12,
 
		t->sign.left - 6,
 
		t->sign.top - 3,
 
		t->sign.left + t->sign.width_1 * 4 + 12,
 
		t->sign.top + 45
 
	);
 
}
 
@@ -530,10 +530,10 @@ static bool IsRoadAllowedHere(TileIndex 
 
no_slope:
 
			/* Tile has no slope
 
			 * Disallow the road if any neighboring tile has a road. */
 
			if (HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir+1]))), dir^2) ||
 
					HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir+3]))), dir^2) ||
 
					HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir+1]) + ToTileIndexDiff(_roadblock_tileadd[dir+2]))), dir) ||
 
					HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir+3]) + ToTileIndexDiff(_roadblock_tileadd[dir+2]))), dir))
 
			if (HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir + 1]))), dir ^ 2) ||
 
					HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir + 3]))), dir ^ 2) ||
 
					HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir + 1]) + ToTileIndexDiff(_roadblock_tileadd[dir + 2]))), dir) ||
 
					HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir + 3]) + ToTileIndexDiff(_roadblock_tileadd[dir + 2]))), dir))
 
				return false;
 

	
 
			/* Otherwise allow */
 
@@ -644,7 +644,7 @@ static void GrowTownInTile(TileIndex* ti
 
		}
 
		rcmd = (RoadBits)((1 << a) + (1 << b));
 

	
 
	} else if (block < 5 && !HASBIT(mask,block^2)) {
 
	} else if (block < 5 && !HASBIT(mask, block ^ 2)) {
 
		/* Continue building on a partial road.
 
		 * Always OK. */
 
		_grow_town_result = 0;
 
@@ -771,7 +771,7 @@ static int GrowTownAtRoad(Town *t, TileI
 

	
 
		/* Select a random bit from the blockmask, walk a step
 
		 * and continue the search from there. */
 
		do block = Random() & 3; while (!HASBIT(mask,block));
 
		do block = Random() & 3; while (!HASBIT(mask, block));
 
		tile += ToTileIndexDiff(_roadblock_tileadd[block]);
 

	
 
		if (IsTileType(tile, MP_STREET)) {
src/train_cmd.cpp
Show inline comments
 
@@ -2988,7 +2988,7 @@ static void TrainController(Vehicle *v, 
 
						} else if (HasSignalOnTrackdir(gp.new_tile, i)) {
 
							v->cur_speed = 0;
 
							v->subspeed = 0;
 
							v->progress = 255-10;
 
							v->progress = 255 - 10;
 
							if (++v->load_unload_time_rem < _patches.wait_twoway_signal * 73) {
 
								TileIndex o_tile = gp.new_tile + TileOffsByDiagDir(enterdir);
 
								VehicleAtSignalData vasd;
src/tree_cmd.cpp
Show inline comments
 
@@ -317,7 +317,7 @@ int32 CmdPlantTree(TileIndex tile, uint3
 
struct TreeListEnt {
 
	SpriteID image;
 
	SpriteID pal;
 
	byte x,y;
 
	byte x, y;
 
};
 

	
 
static void DrawTile_Trees(TileInfo *ti)
src/variables.h
Show inline comments
 
@@ -390,8 +390,8 @@ void SetDParamStr(uint n, const char *st
 
StringID BindCString(const char *str);
 

	
 

	
 
#define COPY_IN_DPARAM(offs,src,num) memcpy(_decode_parameters + offs, src, sizeof(uint32) * (num))
 
#define COPY_OUT_DPARAM(dst,offs,num) memcpy(dst,_decode_parameters + offs, sizeof(uint32) * (num))
 
#define COPY_IN_DPARAM(offs, src, num) memcpy(_decode_parameters + offs, src, sizeof(uint32) * (num))
 
#define COPY_OUT_DPARAM(dst, offs, num) memcpy(dst, _decode_parameters + offs, sizeof(uint32) * (num))
 

	
 

	
 
#define SET_EXPENSES_TYPE(x) _yearly_expenses_type = x;
src/vehicle.cpp
Show inline comments
 
@@ -188,9 +188,9 @@ Vehicle *FindVehicleBetween(TileIndex fr
 
	}
 
	FOR_ALL_VEHICLES(veh) {
 
		if (without_crashed && (veh->vehstatus & VS_CRASHED) != 0) continue;
 
		if ((veh->type == VEH_TRAIN || veh->type == VEH_ROAD) && (z==0xFF || veh->z_pos == z)) {
 
			if ((veh->x_pos>>4) >= x1 && (veh->x_pos>>4) <= x2 &&
 
					(veh->y_pos>>4) >= y1 && (veh->y_pos>>4) <= y2) {
 
		if ((veh->type == VEH_TRAIN || veh->type == VEH_ROAD) && (z == 0xFF || veh->z_pos == z)) {
 
			if ((veh->x_pos >> 4) >= x1 && (veh->x_pos >> 4) <= x2 &&
 
					(veh->y_pos >> 4) >= y1 && (veh->y_pos >> 4) <= y2) {
 
				return veh;
 
			}
 
		}
 
@@ -421,7 +421,7 @@ static void UpdateVehiclePosHash(Vehicle
 
	int old_x = v->left_coord;
 
	int old_y = v->top_coord;
 

	
 
	new_hash = (x == INVALID_COORD) ? NULL : &_vehicle_position_hash[GEN_HASH(x,y)];
 
	new_hash = (x == INVALID_COORD) ? NULL : &_vehicle_position_hash[GEN_HASH(x, y)];
 
	old_hash = (old_x == INVALID_COORD) ? NULL : &_vehicle_position_hash[GEN_HASH(old_x, old_y)];
 

	
 
	if (old_hash == new_hash) return;
src/vehicle_gui.cpp
Show inline comments
 
@@ -343,16 +343,16 @@ static void VehicleRefitWndProc(Window *
 
			SetDParam(1, v->unitnumber);
 
			DrawWindowWidgets(w);
 

	
 
			WP(w,refit_d).cargo = DrawVehicleRefitWindow(WP(w, refit_d).list, WP(w, refit_d).sel, w->vscroll.pos, w->vscroll.cap, w->resize.step_height);
 
			WP(w, refit_d).cargo = DrawVehicleRefitWindow(WP(w, refit_d).list, WP(w, refit_d).sel, w->vscroll.pos, w->vscroll.cap, w->resize.step_height);
 

	
 
			if (WP(w,refit_d).cargo != NULL) {
 
			if (WP(w, refit_d).cargo != NULL) {
 
				int32 cost;
 

	
 
				cost = DoCommand(v->tile, v->index, WP(w,refit_d).cargo->cargo | WP(w,refit_d).cargo->subtype << 8,
 
				cost = DoCommand(v->tile, v->index, WP(w, refit_d).cargo->cargo | WP(w, refit_d).cargo->subtype << 8,
 
								 DC_QUERY_COST, GetCmdRefitVeh(GetVehicle(w->window_number)->type));
 

	
 
				if (!CmdFailed(cost)) {
 
					SetDParam(0, WP(w,refit_d).cargo->cargo);
 
					SetDParam(0, WP(w, refit_d).cargo->cargo);
 
					SetDParam(1, _returned_refit_capacity);
 
					SetDParam(2, cost);
 
					DrawString(2, w->widget[5].top + 1, STR_9840_NEW_CAPACITY_COST_OF_REFIT, 0);
 
@@ -365,12 +365,12 @@ static void VehicleRefitWndProc(Window *
 
				case 3: { // listbox
 
					int y = e->we.click.pt.y - w->widget[3].top;
 
					if (y >= 0) {
 
						WP(w,refit_d).sel = (y / (int)w->resize.step_height) + w->vscroll.pos;
 
						WP(w, refit_d).sel = (y / (int)w->resize.step_height) + w->vscroll.pos;
 
						SetWindowDirty(w);
 
					}
 
				} break;
 
				case 6: // refit button
 
					if (WP(w,refit_d).cargo != NULL) {
 
					if (WP(w, refit_d).cargo != NULL) {
 
						const Vehicle *v = GetVehicle(w->window_number);
 

	
 
						if (WP(w, refit_d).order == INVALID_VEH_ORDER_ID) {
 
@@ -382,9 +382,9 @@ static void VehicleRefitWndProc(Window *
 
								case VEH_SHIP:     command = CMD_REFIT_SHIP         | CMD_MSG(STR_9841_CAN_T_REFIT_SHIP);     break;
 
								case VEH_AIRCRAFT: command = CMD_REFIT_AIRCRAFT     | CMD_MSG(STR_A042_CAN_T_REFIT_AIRCRAFT); break;
 
							}
 
							if (DoCommandP(v->tile, v->index, WP(w,refit_d).cargo->cargo | WP(w,refit_d).cargo->subtype << 8, NULL, command)) DeleteWindow(w);
 
							if (DoCommandP(v->tile, v->index, WP(w, refit_d).cargo->cargo | WP(w, refit_d).cargo->subtype << 8, NULL, command)) DeleteWindow(w);
 
						} else {
 
							if (DoCommandP(v->tile, v->index, WP(w,refit_d).cargo->cargo | WP(w,refit_d).cargo->subtype << 8 | WP(w, refit_d).order << 16, NULL, CMD_ORDER_REFIT)) DeleteWindow(w);
 
							if (DoCommandP(v->tile, v->index, WP(w, refit_d).cargo->cargo | WP(w, refit_d).cargo->subtype << 8 | WP(w, refit_d).order << 16, NULL, CMD_ORDER_REFIT)) DeleteWindow(w);
 
						}
 
					}
 
					break;
 
@@ -418,7 +418,7 @@ static const Widget _vehicle_refit_widge
 

	
 
static const WindowDesc _vehicle_refit_desc = {
 
	WDP_AUTO, WDP_AUTO, 240, 174,
 
	WC_VEHICLE_REFIT,WC_VEHICLE_VIEW,
 
	WC_VEHICLE_REFIT, WC_VEHICLE_VIEW,
 
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE,
 
	_vehicle_refit_widgets,
 
	VehicleRefitWndProc,
 
@@ -426,7 +426,7 @@ static const WindowDesc _vehicle_refit_d
 

	
 
/** Show the refit window for a vehicle
 
* @param *v The vehicle to show the refit window for
 
* @param order of the vehicle (?)
 
* @param order of the vehicle ( ? )
 
*/
 
void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order)
 
{
src/video/win32_v.cpp
Show inline comments
 
@@ -45,7 +45,7 @@ static void MakePalette()
 
	LOGPALETTE *pal;
 
	uint i;
 

	
 
	pal = (LOGPALETTE*)alloca(sizeof(LOGPALETTE) + (256-1) * sizeof(PALETTEENTRY));
 
	pal = (LOGPALETTE*)alloca(sizeof(LOGPALETTE) + (256 - 1) * sizeof(PALETTEENTRY));
 

	
 
	pal->palVersion = 0x300;
 
	pal->palNumEntries = 256;
 
@@ -653,8 +653,8 @@ static bool AllocateDibSection(int w, in
 
		_wnd.alloced_bits = NULL;
 
	}
 

	
 
	bi = (BITMAPINFO*)alloca(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256);
 
	memset(bi, 0, sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256);
 
	bi = (BITMAPINFO*)alloca(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256);
 
	memset(bi, 0, sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256);
 
	bi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
 

	
 
	if (_wnd.double_size) {
src/viewport.cpp
Show inline comments
 
@@ -2050,7 +2050,7 @@ static bool SwapDirection(HighLightStyle
 
* To correctly get the height difference we need the direction we are dragging
 
* in, as well as with what kind of tool we are dragging. For example a horizontal
 
* autorail tool that starts in bottom and ends at the top of a tile will need the
 
* maximum of SW,S and SE,N corners respectively. This is handled by the lookup table below
 
* maximum of SW, S and SE, N corners respectively. This is handled by the lookup table below
 
* See _tileoffs_by_dir in map.c for the direction enums if you can't figure out
 
* the values yourself.
 
* @param style HightlightStyle of drag. This includes direction and style (autorail, rect, etc.)
 
@@ -2395,7 +2395,7 @@ bool VpHandlePlaceSizingDrag()
 
	e.we.place.userdata = _thd.userdata;
 

	
 
	/* stop drag mode if the window has been closed */
 
	w = FindWindowById(_thd.window_class,_thd.window_number);
 
	w = FindWindowById(_thd.window_class, _thd.window_number);
 
	if (w == NULL) {
 
		ResetObjectToPlace();
 
		return false;
src/water_cmd.cpp
Show inline comments
 
@@ -651,7 +651,7 @@ static void FloodVehicle(Vehicle *v)
 

	
 
		SetDParam(0, pass);
 
		AddNewsItem(STR_B006_FLOOD_VEHICLE_DESTROYED,
 
			NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
 
			NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, 0),
 
			v->index,
 
			0);
 
		CreateEffectVehicleRel(v, 4, 4, 8, EV_EXPLOSION_LARGE);
src/win32.cpp
Show inline comments
 
@@ -335,7 +335,7 @@ static const TCHAR * const _expand_texts
 

	
 
static void SetWndSize(HWND wnd, int mode)
 
{
 
	RECT r,r2;
 
	RECT r, r2;
 
	int offs;
 

	
 
	GetWindowRect(wnd, &r);
 
@@ -368,7 +368,7 @@ static bool DoEmergencySave(HWND wnd)
 
	return b;
 
}
 

	
 
static INT_PTR CALLBACK CrashDialogFunc(HWND wnd,UINT msg,WPARAM wParam,LPARAM lParam)
 
static INT_PTR CALLBACK CrashDialogFunc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
{
 
	switch (msg) {
 
		case WM_INITDIALOG: {
 
@@ -549,7 +549,7 @@ static LONG WINAPI ExceptionHandler(EXCE
 
	}
 

	
 
	{
 
		int i,j;
 
		int i, j;
 
#ifdef _M_AMD64
 
		uint32 *b = (uint32*)ep->ContextRecord->Rsp;
 
#else
 
@@ -557,7 +557,7 @@ static LONG WINAPI ExceptionHandler(EXCE
 
#endif
 
		for (j = 0; j != 24; j++) {
 
			for (i = 0; i != 8; i++) {
 
				if (IsBadReadPtr(b,sizeof(uint32))) {
 
				if (IsBadReadPtr(b, sizeof(uint32))) {
 
					output += sprintf(output, " ????????"); //OCR: WAS - , 0);
 
				} else {
 
					output += sprintf(output, " %.8X", *b);
src/window.cpp
Show inline comments
 
@@ -235,25 +235,25 @@ static void DrawOverlappedWindow(Window*
 
				bottom > v->top &&
 
				left < v->left + v->width &&
 
				top < v->top + v->height) {
 
			if (left < (x=v->left)) {
 
			if (left < (x = v->left)) {
 
				DrawOverlappedWindow(wz, left, top, x, bottom);
 
				DrawOverlappedWindow(wz, x, top, right, bottom);
 
				return;
 
			}
 

	
 
			if (right > (x=v->left + v->width)) {
 
			if (right > (x = v->left + v->width)) {
 
				DrawOverlappedWindow(wz, left, top, x, bottom);
 
				DrawOverlappedWindow(wz, x, top, right, bottom);
 
				return;
 
			}
 

	
 
			if (top < (x=v->top)) {
 
			if (top < (x = v->top)) {
 
				DrawOverlappedWindow(wz, left, top, right, x);
 
				DrawOverlappedWindow(wz, left, x, right, bottom);
 
				return;
 
			}
 

	
 
			if (bottom > (x=v->top + v->height)) {
 
			if (bottom > (x = v->top + v->height)) {
 
				DrawOverlappedWindow(wz, left, top, right, x);
 
				DrawOverlappedWindow(wz, left, x, right, bottom);
 
				return;
0 comments (0 inline, 0 general)