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
 
@@ -74,14 +74,14 @@ static inline bool AI_AllowNewAI()
 
			return false;
 
	}
 

	
 
	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.
 
 */
 
static inline uint AI_RandomRange(uint max)
 
{
src/ai/default/default.cpp
Show inline comments
 
@@ -513,13 +513,13 @@ static void AiFindSubsidyIndustryRoute(F
 
}
 

	
 
static void AiFindSubsidyPassengerRoute(FoundRoute *fr)
 
{
 
	uint i;
 
	const Subsidy* s;
 
	Town *from,*to;
 
	Town *from, *to;
 

	
 
	// initially error
 
	fr->distance = -1;
 

	
 
	// Randomize subsidy index..
 
	i = RandomRange(lengthof(_subsidies) * 3);
 
@@ -1558,26 +1558,26 @@ static bool AiCheckTrackResources(TileIn
 
		} else {
 
			GetAcceptanceAroundTiles(values, tile2, w, h, rad);
 
			if (!(values[cargo] & ~7))
 
				return false;
 
			if (cargo != CT_MAIL)
 
				return true;
 
			return !!((values[cargo]>>1) & ~7);
 
			return !!((values[cargo] >> 1) & ~7);
 
		}
 
	}
 

	
 
	return true;
 
}
 

	
 
static int32 AiDoBuildDefaultRailTrack(TileIndex tile, const AiDefaultBlockData* p, RailType railtype, byte flag)
 
{
 
	int32 ret;
 
	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.
 
		uint c = TILE_MASK(tile + ToTileIndexDiff(p->tileoffs));
 

	
 
		_cleared_town = NULL;
 
@@ -1585,13 +1585,13 @@ static int32 AiDoBuildDefaultRailTrack(T
 
		if (p->mode < 2) {
 
			if (p->mode == 0) {
 
				// Depot
 
				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;
 
			total_cost += ret;
 

	
 
clear_town_stuff:;
 
@@ -1607,13 +1607,13 @@ clear_town_stuff:;
 

	
 
			j = p->attr;
 
			k = 0;
 

	
 
			// 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;
 
					total_cost += ret;
 
				}
 
			}
 
@@ -1639,13 +1639,13 @@ clear_town_stuff:;
 
			if (GetTileSlope(c, NULL) != SLOPE_FLAT) return CMD_ERROR;
 
			ret = DoCommand(c, 0, 0, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_LANDSCAPE_CLEAR);
 
			if (CmdFailed(ret)) return CMD_ERROR;
 
			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;
 
		} else {
 
			// Unk
 
			break;
 
@@ -1781,13 +1781,13 @@ static void AiStateBuildDefaultRailBlock
 
				&cost
 
			);
 

	
 
			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;
 
				}
 
@@ -1801,21 +1801,21 @@ static void AiStateBuildDefaultRailBlock
 
					_default_rail_track_data[rule]->data,
 
					p->ai.railtype_to_use,
 
					DC_EXEC | DC_NO_TOWN_RATING
 
				);
 
				assert(!CmdFailed(r));
 
			}
 
		} while (++aib,--j);
 
		} while (++aib, --j);
 
	}
 

	
 
	// check if we're done with all of them
 
	aib = &p->ai.src;
 
	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;
 
	p->ai.state_mode = 255;
 
}
 

	
 
@@ -1854,13 +1854,13 @@ static bool AiDoFollowTrack(const Player
 
	AiRailPathFindData arpfd;
 

	
 
	arpfd.tile = p->ai.start_tile_a;
 
	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;
 
}
 

	
 
struct AiRailFinder {
 
	TileIndex final_tile;
 
@@ -1998,14 +1998,14 @@ static inline void AiCheckBuildRailTunne
 
{
 
	uint z;
 

	
 
	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);
 
		}
 
	}
 
}
 

	
 

	
 
@@ -2014,13 +2014,13 @@ static void AiBuildRailRecursive(AiRailF
 
	const byte *p;
 

	
 
	tile = TILE_MASK(tile + TileOffsByDiagDir(dir));
 

	
 
	// 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;
 
			arf->cur_best_depth = arf->depth;
 
		} else {
 
			if (arf->depth < arf->cur_best_depth) arf->cur_best_depth = arf->depth;
 
@@ -2060,23 +2060,23 @@ static void AiBuildRailRecursive(AiRailF
 
			}
 

	
 
			// At the bottom depth?
 
			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)
 
{
 
	AiRailFinder arf;
 
	int i;
 

	
 
@@ -2321,29 +2321,29 @@ static void AiStateBuildRail(Player *p)
 
			p->ai.state_counter = 0; // timeout
 
			return;
 
		}
 
	}
 

	
 
	// 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);
 

	
 
	// And setup state.
 
	p->ai.state_mode = 2;
 
	p->ai.state_counter = 0;
 
@@ -2500,13 +2500,13 @@ static void AiStateDeleteRailBlocks(Play
 
		const AiDefaultBlockData* b;
 

	
 
		if (aib->cur_building_rule == 255) continue;
 
		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;
 
}
 

	
 
static bool AiCheckRoadResources(TileIndex tile, const AiDefaultBlockData *p, byte cargo)
 
{
 
@@ -2679,41 +2679,41 @@ static void AiStateBuildDefaultRoadBlock
 
				aib->use_tile, aib->direction, aib->cargo, &cost
 
			);
 

	
 
			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.
 
				aib->cur_building_rule = rule;
 

	
 
				r = AiDoBuildDefaultRoadBlock(
 
					aib->use_tile,
 
					_road_default_block_data[rule]->data,
 
					DC_EXEC | DC_NO_TOWN_RATING
 
				);
 
				assert(!CmdFailed(r));
 
			}
 
		} while (++aib,--j);
 
		} while (++aib, --j);
 
	}
 

	
 
	// check if we're done with all of them
 
	aib = &p->ai.src;
 
	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;
 
	p->ai.state_mode = 255;
 
}
 

	
 
@@ -2898,14 +2898,14 @@ static inline void AiCheckBuildRoadTunne
 
{
 
	uint z;
 

	
 
	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);
 
		}
 
	}
 
}
 

	
 

	
 
@@ -2915,13 +2915,13 @@ static void AiBuildRoadRecursive(AiRoadF
 
	const byte *p;
 

	
 
	tile = TILE_MASK(tile + TileOffsByDiagDir(dir));
 

	
 
	// 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;
 
		}
 
		return;
 
	}
 

	
 
@@ -2959,13 +2959,13 @@ static void AiBuildRoadRecursive(AiRoadF
 

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

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

	
 
	arf->depth--;
 
}
 

	
 

	
 
static void AiBuildRoadConstruct(Player *p)
 
@@ -3017,13 +3017,13 @@ do_some_terraform:
 
		}
 
		return;
 
	}
 

	
 
	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;
 
		bridge_len = GetBridgeLength(tile, p->ai.cur_tile_a); // tile
 

	
 
		/* Figure out what (road)bridge type to build
 
@@ -3039,13 +3039,13 @@ do_some_terraform:
 
		}
 

	
 
		// Build it
 
		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;
 
		p->ai.state_counter = 0;
 
	} else {
 
		// road
 
@@ -3145,13 +3145,13 @@ static void AiStateBuildRoad(Player *p)
 
	p->ai.start_tile_a = tile;
 
	p->ai.cur_tile_a = tile;
 
	p->ai.start_dir_a = dir;
 
	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;
 
	p->ai.start_dir_b = dir;
 
	p->ai.cur_dir_b = dir;
 

	
 
@@ -3236,13 +3236,13 @@ static void AiStateDeleteRoadBlocks(Play
 

	
 
		if (aib->cur_building_rule == 255) continue;
 
		for (b = _road_default_block_data[aib->cur_building_rule]->data; b->mode != 4; b++) {
 
			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;
 
}
 

	
 

	
 
static void AiStateAirportStuff(Player *p)
 
@@ -3323,13 +3323,13 @@ static int32 AiDoBuildDefaultAirportBloc
 
{
 
	uint32 avail_airports = GetValidAirports();
 
	int32 total_cost = 0, ret;
 

	
 
	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;
 
	}
 

	
 
	return total_cost;
 
}
 
@@ -3405,41 +3405,41 @@ static void AiStateBuildDefaultAirportBl
 

	
 
//			SetRedErrorSquare(aib->use_tile);
 

	
 
			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;
 

	
 
				aib->cur_building_rule = rule;
 

	
 
				r = AiDoBuildDefaultAirportBlock(
 
					aib->use_tile,
 
					_airport_default_block_data[rule],
 
					DC_EXEC | DC_NO_TOWN_RATING
 
				);
 
				assert(!CmdFailed(r));
 
			}
 
		} while (++aib,--j);
 
		} while (++aib, --j);
 
	} while (--i);
 

	
 
	// check if we're done with all of them
 
	aib = &p->ai.src;
 
	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;
 
}
 

	
 
static StationID AiGetStationIdFromAircraftBlock(TileIndex tile, int id)
 
@@ -3647,13 +3647,13 @@ pos_3:
 
					p->ai.cur_tile_a = tile;
 
					p->ai.state = AIS_REMOVE_SINGLE_RAIL_TILE;
 
					return;
 
				}
 
			}
 
		} else {
 
			static const byte _depot_bits[] = {0x19,0x16,0x25,0x2A};
 
			static const byte _depot_bits[] = {0x19, 0x16, 0x25, 0x2A};
 

	
 
			DiagDirection dir = GetRailDepotDirection(tile);
 

	
 
			if (GetRailTrackStatus(tile + TileOffsByDiagDir(dir)) & _depot_bits[dir])
 
				return;
 

	
 
@@ -3792,19 +3792,19 @@ static void AiHandleTakeover(Player *p)
 
		Player *pp, *best_pl = NULL;
 
		int32 best_val = -1;
 

	
 
		// 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?
 
		if (best_val == -1) {
 
			p->bankrupt_asked = 255;
 
			return;
 
@@ -3840,13 +3840,13 @@ static void AiAdjustLoan(const Player* p
 
			DoCommand(0, 0, 0, DC_EXEC, CMD_DECREASE_LOAN);
 
		}
 
	} else if (p->player_money < base * 500) {
 
		// 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);
 
		}
 
	}
 
}
 

	
 
static void AiBuildCompanyHQ(Player *p)
 
@@ -3869,24 +3869,24 @@ void AiDoGameLoop(Player *p)
 
	}
 

	
 
	// Ugly hack to make sure the service interval of the AI is good, not looking
 
	//  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;
 

	
 
	AiAdjustLoan(p);
 
	AiBuildCompanyHQ(p);
 

	
 
#if 0
 
	{
 
		static byte old_state = 99;
 
		static bool hasdots = false;
 
		char *_ai_state_names[]={
 
		char *_ai_state_names[] = {
 
			"AiCase0",
 
			"AiCase1",
 
			"AiStateVehLoop",
 
			"AiStateCheckReplaceVehicle",
 
			"AiStateDoReplaceVehicle",
 
			"AiStateWantNewRoute",
src/ai/trolly/build.cpp
Show inline comments
 
@@ -120,13 +120,13 @@ int AiNew_Build_RoutePart(Player *p, Ai_
 
				return 0;
 
			}
 
			return cost;
 
		}
 
		// 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)) {
 
				DEBUG(ai, 0, "[BuildPath] bridge could not be built (0x%X, 0x%X)", route[part], route[part - 1]);
 
				return 0;
 
			}
 
@@ -170,13 +170,13 @@ int AiNew_Build_RoutePart(Player *p, Ai_
 
				return 0;
 
			}
 
			return cost;
 
		}
 
		// 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)) {
 
				DEBUG(ai, 0, "[BuildPath] bridge could not be built (0x%X, 0x%X)", route[part], route[part + 1]);
 
				return 0;
 
			}
src/ai/trolly/trolly.cpp
Show inline comments
 
@@ -217,15 +217,15 @@ static bool AiNew_Check_City_or_Industry
 

	
 
		// We don't like roadconstructions, don't even true such a city
 
		if (t->road_build_months != 0) return false;
 

	
 
		// 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
 
		//  and sometimes it takes up to 4 months before the stats are corectly.
 
		//  This way we don't get 12 busstations in one city of 100 population ;)
 
		FOR_ALL_STATIONS(st) {
 
@@ -272,13 +272,13 @@ static bool AiNew_Check_City_or_Industry
 
	if (type == AI_INDUSTRY) {
 
		const Industry* i = GetIndustry(ic);
 
		const Station* st;
 
		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
 
		if (i->produced_cargo[0] == CT_INVALID || i->total_production[0] == 0) return true;
 

	
 
		if (i->total_production[0] - i->total_transported[0] < AI_CHECKCITY_NEEDED_CARGO) return false;
 
@@ -639,14 +639,14 @@ static void AiNew_State_FindStation(Play
 

	
 
	if (new_tile == 0 && p->ainew.tbt == AI_BUS) {
 
		uint x, y, i = 0;
 
		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
 
		//   taking eachothers passangers away (bad result when it does not)
 
		for (x = TileX(tile) - AI_FINDSTATION_TILE_RANGE; x <= TileX(tile) + AI_FINDSTATION_TILE_RANGE; x++) {
 
			for (y = TileY(tile) - AI_FINDSTATION_TILE_RANGE; y <= TileY(tile) + AI_FINDSTATION_TILE_RANGE; y++) {
 
@@ -958,19 +958,19 @@ static void AiNew_State_VerifyRoute(Play
 
		p->ainew.state = AI_STATE_NOTHING;
 
		return;
 
	}
 

	
 
	// 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];
 

	
 
	p->ainew.state = AI_STATE_BUILD_STATION;
 
	p->ainew.temp = 0;
 

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

	
 
	case WE_ABORT_PLACE_OBJ:
 
		RaiseWindowButtons(w);
 

	
 
		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:
 
		if (_patches.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
 
		break;
 
	}
 
@@ -152,13 +152,13 @@ static void BuildAirportPickerWndProc(Wi
 

	
 
	case WE_PAINT: {
 
		int i; // airport enabling loop
 
		uint32 avail_airports;
 
		const AirportFTAClass *airport;
 

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

	
 
		avail_airports = GetValidAirports();
 

	
 
		RaiseWindowWidget(w, _selected_airport_type + 7);
 
		if (!HASBIT(avail_airports, 0) && _selected_airport_type == AT_SMALL) _selected_airport_type = AT_LARGE;
 
		if (!HASBIT(avail_airports, 1) && _selected_airport_type == AT_LARGE) _selected_airport_type = AT_SMALL;
 
@@ -204,22 +204,22 @@ static void BuildAirportPickerWndProc(Wi
 
			SetWindowDirty(w);
 
			break;
 
		}
 
	} break;
 

	
 
	case WE_MOUSELOOP: {
 
		if (WP(w,def_d).close) {
 
		if (WP(w, def_d).close) {
 
			DeleteWindow(w);
 
			return;
 
		}
 

	
 
		CheckRedrawStationCoverage(w);
 
	} break;
 

	
 
	case WE_DESTROY:
 
		if (!WP(w,def_d).close) ResetObjectToPlace();
 
		if (!WP(w, def_d).close) ResetObjectToPlace();
 
		break;
 
	}
 
}
 

	
 
static const Widget _build_airport_picker_widgets[] = {
 
{   WWT_CLOSEBOX,   RESIZE_NONE,     7,     0,    10,     0,    13, STR_00C5,                         STR_018B_CLOSE_WINDOW},
src/autoreplace_cmd.cpp
Show inline comments
 
@@ -134,13 +134,13 @@ static CargoID GetNewCargoTypeForReplace
 
	v = GetFirstVehicleInChain(v);
 
	do {
 
		if (v->cargo_cap == 0) continue;
 
		/* 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
 
}
 

	
 
/* Replaces a vehicle (used to be called autorenew)
 
 * This function is only called from MaybeReplaceVehicle()
 
 * Must be called with _current_player set to the owner of the vehicle
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -309,25 +309,25 @@ static EngList_SortTypeFunction * const 
 
	&TrainEnginePowerSorter,
 
	&EngineIntroDateSorter,
 
	&EngineNameSorter,
 
	&TrainEngineRunningCostSorter,
 
	&TrainEnginePowerVsRunningCostSorter,
 
	&EngineReliabilitySorter,
 
},{
 
}, {
 
	/* Road vehicles */
 
	&EngineNumberSorter,
 
	&EngineIntroDateSorter,
 
	&EngineNameSorter,
 
	&EngineReliabilitySorter,
 
},{
 
}, {
 
	/* Ships */
 
	&EngineNumberSorter,
 
	&EngineIntroDateSorter,
 
	&EngineNameSorter,
 
	&EngineReliabilitySorter,
 
},{
 
}, {
 
	/* Aircraft */
 
	&EngineNumberSorter,
 
	&AircraftEngineCostSorter,
 
	&AircraftEngineSpeedSorter,
 
	&EngineIntroDateSorter,
 
	&EngineNameSorter,
 
@@ -345,27 +345,27 @@ static const StringID _sort_listing[][10
 
	STR_ENGINE_SORT_INTRO_DATE,
 
	STR_SORT_BY_DROPDOWN_NAME,
 
	STR_ENGINE_SORT_RUNNING_COST,
 
	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,
 
	STR_SORT_BY_MAX_SPEED,
 
	STR_ENGINE_SORT_INTRO_DATE,
 
	STR_SORT_BY_DROPDOWN_NAME,
 
@@ -389,13 +389,13 @@ static int DrawRailWagonPurchaseInfo(int
 
	DrawString(x, y, STR_PURCHASE_INFO_WEIGHT_CWEIGHT, 0);
 
	y += 10;
 

	
 
	/* 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;
 
}
 

	
 
/* Draw locomotive specific details */
 
@@ -403,51 +403,51 @@ static int DrawRailEnginePurchaseInfo(in
 
{
 
	int multihead = (rvi->railveh_type == RAILVEH_MULTIHEAD ? 1 : 0);
 

	
 
	/* 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 */
 
	if (_patches.realistic_acceleration && rvi->railtype != RAILTYPE_MAGLEV) {
 
		SetDParam(0, ((rvi->weight << multihead) * 10 * rvi->tractive_effort) / 256);
 
		DrawString(x, y, STR_PURCHASE_INFO_MAX_TE, 0);
 
		y += 10;
 
	}
 

	
 
	/* 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;
 
	};
 

	
 
	return y;
 
}
 

	
 
/* Draw road vehicle specific details */
 
static int DrawRoadVehPurchaseInfo(int x, int y, EngineID engine_number, const RoadVehicleInfo *rvi)
 
{
 
	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;
 

	
 
	/* Running cost */
 
	SetDParam(0, rvi->running_cost * _price.roadveh_running >> 8);
 
@@ -465,39 +465,39 @@ static int DrawRoadVehPurchaseInfo(int x
 
}
 

	
 
/* Draw ship specific details */
 
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;
 
}
 

	
 
/* Draw aircraft specific details */
 
static int DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number, const AircraftVehicleInfo *avi)
 
{
 
	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;
 

	
 
	/* Cargo capacity */
 
	cargo = FindFirstRefittableCargo(engine_number);
 
@@ -557,13 +557,13 @@ int DrawVehiclePurchaseInfo(int x, int y
 
				int multihead = (rvi->railveh_type == RAILVEH_MULTIHEAD ? 1 : 0);
 

	
 
				SetDParam(0, rvi->cargo_type);
 
				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;
 
		case VEH_ROAD:
 
			y = DrawRoadVehPurchaseInfo(x, y, engine_number, RoadVehInfo(engine_number));
 
			refitable = true;
 
@@ -998,13 +998,13 @@ void ShowBuildVehicleWindow(TileIndex ti
 

	
 
	bv->sort_criteria         = _last_sort_criteria[type];
 
	bv->descending_sort_order = _last_sort_order[type];
 

	
 
	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:
 
			ResizeWindow(w, 0, 16);
 
		case VEH_SHIP:
 
			break;
src/clear_cmd.cpp
Show inline comments
 
@@ -76,13 +76,13 @@ static void TerraformAddDirtyTile(Terraf
 
	TileIndex *t;
 

	
 
	count = ts->tile_table_count;
 

	
 
	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;
 
	}
 

	
 
	ts->tile_table[ts->tile_table_count++] = tile;
 
}
 

	
 
@@ -138,13 +138,13 @@ static int TerraformProc(TerraformerStat
 
				return -1;
 
			}
 
			return 0;
 
		}
 
	}
 

	
 
	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;
 
		return -1;
 
	}
 

	
 
@@ -212,14 +212,14 @@ static bool TerraformTileHeight(Terrafor
 
		};
 

	
 
		for (ttm = _terraform_tilepos; ttm != endof(_terraform_tilepos); ttm++) {
 
			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;
 
			}
 
		}
 
	}
 

	
 
	return true;
 
@@ -379,14 +379,14 @@ int32 CmdLevelLand(TileIndex tile, uint3
 
	sx = TileX(p1);
 
	sy = TileY(p1);
 
	if (ex < sx) Swap(ex, sx);
 
	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;
 

	
 
	BEGIN_TILE_LOOP(tile2, size_x, size_y, tile) {
 
		curh = TileHeight(tile2);
src/command.cpp
Show inline comments
 
@@ -404,13 +404,13 @@ int32 GetAvailableMoneyForCommand()
 
}
 

	
 
/* toplevel network safe docommand function for the current player. must not be called recursively.
 
 * 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;
 
	StringID error_part1;
 

	
 
	int x = TileX(tile) * TILE_SIZE;
 
@@ -541,13 +541,13 @@ bool DoCommandP(TileIndex tile, uint32 p
 
	SubtractMoneyFromPlayer(res2);
 

	
 
	if (IsLocalPlayer() && _game_mode != GM_EDITOR) {
 
		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;
 
		}
 
	}
 

	
 
	_docommand_recursive = 0;
 

	
 
@@ -555,13 +555,13 @@ bool DoCommandP(TileIndex tile, uint32 p
 
	_cmd_text = NULL;
 
	return true;
 

	
 
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:
 
	_docommand_recursive = 0;
 

	
 
	if (callback) callback(false, tile, p1, p2);
src/command.h
Show inline comments
 
@@ -155,13 +155,13 @@ enum {
 
	DC_NO_TOWN_RATING  = 0x40, ///< town rating does not disallow you from building
 
	DC_FORCETEST       = 0x80, ///< force test too.
 

	
 
	CMD_ERROR = ((int32)0x80000000),
 
};
 

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

	
 
enum {
 
	CMD_AUTO                  = 0x0200,
 
	CMD_NO_WATER              = 0x0400,
 
	CMD_NETWORK_COMMAND       = 0x0800, ///< execute the command without sending it on the network
 
	CMD_NO_TEST_IF_IN_NETWORK = 0x1000, ///< When enabled, the command will bypass the no-DC_EXEC round if in network
src/disaster_cmd.cpp
Show inline comments
 
@@ -230,13 +230,13 @@ static void DisasterTick_Zeppeliner(Vehi
 
					IsHumanPlayer(GetTileOwner(tile))) {
 
				v->current_order.dest = 1;
 
				v->age = 0;
 

	
 
				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);
 
			}
 
		}
 

	
 
		if (v->y_pos >= ((int)MapSizeY() + 9) * TILE_SIZE - 1) DeleteDisasterVeh(v);
 
@@ -260,13 +260,13 @@ static void DisasterTick_Zeppeliner(Vehi
 
		DeleteDisasterVeh(v);
 
		return;
 
	}
 

	
 
	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);
 

	
 
	if (++v->age == 1) {
 
		CreateEffectVehicleRel(v, 0, 7, 8, EV_EXPLOSION_LARGE);
 
		SndPlayVehicleFx(SND_12_EXPLOSION, v);
 
@@ -356,20 +356,20 @@ static void DisasterTick_Ufo(Vehicle *v)
 
		GetNewVehiclePosResult gp = GetNewVehiclePos(v);
 

	
 
		z = v->z_pos;
 
		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);
 
			}
 
		}
 

	
 
		/* Destroy? */
 
@@ -438,13 +438,13 @@ static void DisasterTick_Airplane(Vehicl
 
			v->age = 0;
 

	
 
			i = GetIndustry(v->dest_tile);
 
			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) {
 
		int x, y;
 
		TileIndex tile;
 
		uint ind;
 
@@ -511,13 +511,13 @@ static void DisasterTick_Helicopter(Vehi
 
			v->age = 0;
 

	
 
			i = GetIndustry(v->dest_tile);
 
			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) {
 
		int x, y;
 
		TileIndex tile;
 
		uint ind;
 
@@ -597,13 +597,13 @@ 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);
 

	
 
		u = ForceAllocateSpecialVehicle();
 
		if (u == NULL) {
 
			DeleteDisasterVeh(v);
 
@@ -948,13 +948,13 @@ static void Disaster_Small_Submarine_Ini
 

	
 

	
 
/* Curious submarine #2, just floats around */
 
static void Disaster_Big_Submarine_Init()
 
{
 
	Vehicle *v = ForceAllocateSpecialVehicle();
 
	int x,y;
 
	int x, y;
 
	Direction dir;
 
	uint32 r;
 

	
 
	if (v == NULL) return;
 

	
 
	r = Random();
 
@@ -983,13 +983,13 @@ static void Disaster_CoalMine_Init()
 
		const Industry *i;
 

	
 
		FOR_ALL_INDUSTRIES(i) {
 
			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;
 
					TileIndexDiff step = TileOffsByDiagDir(GB(Random(), 0, 2));
 
					uint n;
 

	
src/dock_gui.cpp
Show inline comments
 
@@ -162,16 +162,16 @@ static void BuildDocksToolbWndProc(Windo
 
		break;
 

	
 
	case WE_ABORT_PLACE_OBJ:
 
		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: {
 
		TileIndex tile_from;
 
		TileIndex tile_to;
 

	
 
@@ -230,13 +230,13 @@ static void BuildDockStationWndProc(Wind
 
	switch (e->event) {
 
	case WE_CREATE: LowerWindowWidget(w, _station_show_coverage + 3); break;
 

	
 
	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;
 

	
 
		if (_station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
 

	
 
@@ -255,22 +255,22 @@ static void BuildDockStationWndProc(Wind
 
				SetWindowDirty(w);
 
				break;
 
		}
 
		break;
 

	
 
	case WE_MOUSELOOP:
 
		if (WP(w,def_d).close) {
 
		if (WP(w, def_d).close) {
 
			DeleteWindow(w);
 
			return;
 
		}
 

	
 
		CheckRedrawStationCoverage(w);
 
		break;
 

	
 
	case WE_DESTROY:
 
		if (!WP(w,def_d).close) ResetObjectToPlace();
 
		if (!WP(w, def_d).close) ResetObjectToPlace();
 
		break;
 
	}
 
}
 

	
 
static const Widget _build_dock_station_widgets[] = {
 
{   WWT_CLOSEBOX,   RESIZE_NONE,     7,     0,    10,     0,    13, STR_00C5,                         STR_018B_CLOSE_WINDOW},
 
@@ -330,17 +330,17 @@ static void BuildDocksDepotWndProc(Windo
 
			SetWindowDirty(w);
 
			break;
 
		}
 
	} 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;
 
	}
 
}
 

	
 
static const Widget _build_docks_depot_widgets[] = {
 
{   WWT_CLOSEBOX,   RESIZE_NONE,     7,     0,    10,     0,    13, STR_00C5,                        STR_018B_CLOSE_WINDOW},
src/gfx.cpp
Show inline comments
 
@@ -198,13 +198,13 @@ 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;
 
}
 

	
 
void GfxDrawLine(int x, int y, int x2, int y2, int color)
 
{
 
@@ -458,13 +458,13 @@ uint32 FormatStringLinebreaks(char *str,
 
					break;
 
				}
 
			} else {
 
				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;
 
				}
 
			}
 
		}
 
@@ -506,13 +506,13 @@ void DrawStringMultiCenter(int x, int y,
 
	y -= (mt >> 1) * num;
 

	
 
	src = buffer;
 

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

	
 
		for (;;) {
 
			c = Utf8Consume(&src);
 
			if (c == 0) {
 
				y += mt;
 
@@ -521,13 +521,13 @@ void DrawStringMultiCenter(int x, int y,
 
					return;
 
				}
 
				break;
 
			} else if (c == SCC_SETX) {
 
				src++;
 
			} else if (c == SCC_SETXY) {
 
				src+=2;
 
				src += 2;
 
			}
 
		}
 
	}
 
}
 

	
 

	
 
@@ -571,13 +571,13 @@ uint DrawStringMultiLine(int x, int y, S
 
					return total_height;
 
				}
 
				break;
 
			} else if (c == SCC_SETX) {
 
				src++;
 
			} else if (c == SCC_SETXY) {
 
				src+=2;
 
				src += 2;
 
			}
 
		}
 
	}
 
}
 

	
 
/** Return the string dimension in pixels. The height and width are returned
 
@@ -640,13 +640,13 @@ int DoDrawString(const char *string, int
 
	int xo = x, yo = y;
 

	
 
	color = real_color & 0xFF;
 

	
 
	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;
 

	
 
		if (color != 0xFF) {
 
switch_color:;
src/graph_gui.cpp
Show inline comments
 
@@ -219,13 +219,13 @@ static void DrawGraph(const GraphDrawer 
 
				if (datapoint != INVALID_DATAPOINT) {
 
					/* XXX: This can overflow if x_axis_offset * datapoint is
 
					 * too big to fit in an int64. */
 
					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);
 

	
 
					prev_x = x;
 
					prev_y = y;
 
@@ -265,13 +265,13 @@ static void GraphLegendWndProc(Window *w
 

	
 
			DrawWindowWidgets(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);
 
				SetDParam(2, GetPlayerNameString(p->index, 3));
 
				DrawString(21, 17 + p->index * 12, STR_7021, HASBIT(_legend_excluded_players, p->index) ? 0x10 : 0xC);
 
			}
 
@@ -327,13 +327,13 @@ static void ShowGraphLegend()
 

	
 
static void SetupGraphDrawerForPlayers(GraphDrawer *gd)
 
{
 
	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) {
 
		if (!p->is_active) SETBIT(excluded_players, p->index);
 
	}
 
	gd->excluded_data = excluded_players;
 
@@ -905,13 +905,13 @@ static const WindowDesc _company_league_
 
	_company_league_widgets,
 
	CompanyLeagueWndProc
 
};
 

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

	
 
/*****************************/
 
/* PERFORMANCE RATING DETAIL */
 
/*****************************/
 

	
src/industry_cmd.cpp
Show inline comments
 
@@ -66,13 +66,13 @@ IndustryType GetIndustryType(TileIndex t
 
	IndustryType iloop;
 

	
 
	assert(IsTileType(tile, MP_INDUSTRY));
 

	
 
	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;
 
		}
 
	}
 

	
 
	return IT_INVALID;  //we have not found equivalent, whatever the reason
 
}
 
@@ -493,13 +493,13 @@ static void AnimateTile_Industry(TileInd
 
		break;
 

	
 
	case GFX_OILWELL_ANIMATED_1:
 
	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;
 
			if (m == 4 && (m = 0, ++gfx) == GFX_OILWELL_ANIMATED_3 + 1 && (gfx = GFX_OILWELL_ANIMATED_1, b)) {
 
				SetIndustryGfx(tile, GFX_OILWELL_NOT_ANIMATED);
 
				SetIndustryConstructionStage(tile, 3);
 
@@ -702,13 +702,13 @@ static void TileLoop_Industry(TileIndex 
 
			SetIndustryConstructionStage(tile, 3);
 
			DeleteAnimatedTile(tile);
 
		}
 
		break;
 

	
 
	case GFX_POWERPLANT_SPARKS:
 
		if (CHANCE16(1,3)) {
 
		if (CHANCE16(1, 3)) {
 
			SndPlayTileFx(SND_0C_ELECTRIC_SPARK, tile);
 
			AddAnimatedTile(tile);
 
		}
 
		break;
 

	
 
	case GFX_COPPER_MINE_CHIMNEY:
 
@@ -961,13 +961,13 @@ static void ProduceIndustryGoods(Industr
 
{
 
	uint32 r;
 
	uint num;
 

	
 
	/* 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);
 
		}
 
	}
 

	
 
@@ -1665,13 +1665,13 @@ static void ExtChangeIndustryProduction(
 
				if (mag >= 10) {
 
					SetDParam(2, mag);
 
					SetDParam(0, GetCargo(i->produced_cargo[j])->name);
 
					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
 
					);
 
				}
 
			}
 
			break;
 
	}
 
@@ -1679,13 +1679,13 @@ static void ExtChangeIndustryProduction(
 
	/* If industry will be closed down, show this */
 
	if (closeit) {
 
		i->prod_level = 0;
 
		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
 
		);
 
	}
 
}
 

	
 

	
 
@@ -1695,13 +1695,13 @@ static void UpdateIndustryStatistics(Ind
 
	bool refresh = false;
 

	
 
	if (i->produced_cargo[0] != CT_INVALID) {
 
		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;
 

	
 
		i->total_production[0] = i->last_mo_production[0];
 
		i->last_mo_production[0] = 0;
 

	
 
@@ -1711,13 +1711,13 @@ static void UpdateIndustryStatistics(Ind
 
	}
 

	
 
	if (i->produced_cargo[1] != CT_INVALID) {
 
		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;
 

	
 
		i->total_production[1] = i->last_mo_production[1];
 
		i->last_mo_production[1] = 0;
 

	
 
@@ -1788,13 +1788,13 @@ static void MaybeNewIndustry(void)
 
		if (--num == 0) return;
 
	}
 

	
 
	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)
 
{
 
	bool only_decrease = false;
 
	StringID str = STR_NULL;
 
@@ -1807,15 +1807,15 @@ static void ChangeIndustryProduction(Ind
 

	
 
		case INDUSTRYLIFE_PRODUCTION:
 
			/* decrease or increase */
 
			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;
 

	
 
						i->prod_level <<= 1;
 

	
 
@@ -1846,22 +1846,22 @@ static void ChangeIndustryProduction(Ind
 
				}
 
			}
 
			break;
 

	
 
		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;
 
			}
 
			break;
 
	}
 

	
 
	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);
 
	}
 
}
 

	
 
void IndustryMonthlyLoop()
 
{
 
	Industry *i;
src/industry_gui.cpp
Show inline comments
 
@@ -34,29 +34,29 @@ static void UpdateIndustryProduction(Ind
 
static void BuildIndustryWndProc(Window *w, WindowEvent *e)
 
{
 
	switch (e->event) {
 
	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);
 
		}
 
		break;
 

	
 
	case WE_CLICK: {
 
		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;
 

	
 
	case WE_ABORT_PLACE_OBJ:
 
		RaiseWindowButtons(w);
 
		break;
 
@@ -271,13 +271,13 @@ 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) {
 
	return i->production_rate[pt] == 1;
 
}
 

	
 
@@ -327,24 +327,24 @@ static void IndustryViewWndProc(Window *
 
			SetDParam(1, i->total_production[0]);
 

	
 
			SetDParam(2, i->pct_transported[0] * 100 >> 8);
 
			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));
 
			}
 

	
 
			if (i->produced_cargo[1] != CT_INVALID) {
 
				SetDParam(0, i->produced_cargo[1]);
 
				SetDParam(1, i->total_production[1]);
 
				SetDParam(2, i->pct_transported[1] * 100 >> 8);
 
				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));
 
				}
 
			}
 
		}
 

	
 
		DrawWindowViewport(w);
 
@@ -376,17 +376,17 @@ static void IndustryViewWndProc(Window *
 
						i->production_rate[line] = minu(i->production_rate[line] * 2, 255);
 
					}
 

	
 
					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);
 
				}
 
			}
 
		} break;
 
		case 6:
 
@@ -394,21 +394,21 @@ static void IndustryViewWndProc(Window *
 
			ScrollMainWindowToTile(i->xy + TileDiffXY(1, 1));
 
		}	break;
 

	
 
		}
 
		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);
 
			SetWindowDirty(w);
 
		}
 
	}
 
@@ -446,15 +446,15 @@ static const WindowDesc _industry_view_d
 
void ShowIndustryViewWindow(int industry)
 
{
 
	Window *w = AllocateWindowDescFront(&_industry_view_desc, 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);
 
	}
 
}
 

	
 
static const Widget _industry_directory_widgets[] = {
 
{   WWT_CLOSEBOX,   RESIZE_NONE,    13,     0,    10,     0,    13, STR_00C5,                STR_018B_CLOSE_WINDOW},
 
@@ -596,13 +596,13 @@ static void IndustryDirectoryWndProc(Win
 
			MakeSortedIndustryList();
 
		}
 

	
 
		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;
 

	
 
		while (p < _num_industry_sort) {
 
			const Industry* i = _industry_sort[p];
 
@@ -614,47 +614,47 @@ static void IndustryDirectoryWndProc(Win
 

	
 
				if (i->produced_cargo[1] != CT_INVALID) {
 
					SetDParam(3, i->produced_cargo[1]);
 
					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;
 
		}
 
	} break;
 

	
 
	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;
 

	
 
		case 8: {
 
			int y = (e->we.click.pt.y - 28) / 10;
src/landscape.cpp
Show inline comments
 
@@ -73,19 +73,19 @@ uint GetPartialZ(int x, int y, Slope cor
 
	case SLOPE_W:
 
		if (x - y >= 0)
 
			z = (x - y) >> 1;
 
		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:
 
		if (y - x >= 0)
 
			z = (y - x) >> 1;
 
		break;
 
@@ -94,40 +94,40 @@ uint GetPartialZ(int x, int y, Slope cor
 
	case SLOPE_NS:
 
	case SLOPE_ELEVATED:
 
		z = 4;
 
		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;
 

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

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

	
 
	case SLOPE_NWS:
 
		z = 8;
 
		if (x - y < 0)
 
			z += (x - y) >> 1;
 
		break;
 

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

	
 
	case SLOPE_ENW:
 
		z = 8;
 
		y ^= 0xF;
 
		if (y - x < 0)
 
@@ -138,25 +138,25 @@ uint GetPartialZ(int x, int y, Slope cor
 
		z = 8;
 
		if (y - x < 0)
 
			z += (y - x) >> 1;
 
		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;
 
	}
 

	
 
	return z;
 
@@ -382,14 +382,14 @@ int32 CmdLandscapeClear(TileIndex tile, 
 
 */
 
int32 CmdClearArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 
{
 
	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;
 

	
 
	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
 

	
 
@@ -432,13 +432,13 @@ int32 CmdClearArea(TileIndex tile, uint3
 
	return (success) ? cost : CMD_ERROR;
 
}
 

	
 

	
 
#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()
 
{
 
	TileIndex tile;
 
	uint count;
src/macros.h
Show inline comments
 
@@ -79,15 +79,15 @@ template<typename T> static inline T TOG
 
{
 
	return x ^= (T)1 << y;
 
}
 

	
 

	
 
/* 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]))
 

	
 
extern const byte _ffb_64[128];
 
/* Returns the position of the first bit that is not zero, counted from the
 
@@ -95,13 +95,13 @@ extern const byte _ffb_64[128];
 
 * 0.
 
 */
 
#define FIND_FIRST_BIT(x) _ffb_64[(x)]
 
/* 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)
 
{
 
/*
 
	int i = 0;
 
	if ( (byte) value == 0) {
 
@@ -130,19 +130,19 @@ static inline int KillFirstBit2x64(int v
 
}
 

	
 
/** returns true if value a has only one bit set to 1 */
 
#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)            \
 
	for (_i = 0; _b != 0; _i++, _b >>= 1) \
 
		if (_b & 1)
 

	
src/map.cpp
Show inline comments
 
@@ -83,36 +83,36 @@ TileIndex TileAdd(TileIndex tile, TileIn
 
		fprintf(stderr, "%s:%d %s\n", file, line, buf);
 
#else
 
		_assert(buf, (char*)file, line);
 
#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
 

	
 

	
 
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;
 
}
 

	
 

	
 
/* Scale relative to the circumference of the map */
 
uint ScaleByMapSize1D(uint n)
 
{
 
	/* Normal circumference for the X+Y is 256+256 = 1<<9
 
	 * 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;
 
}
 

	
 

	
 
/* This function checks if we add addx/addy to tile, if we
 
 *  do wrap around the edges. For example, tile = (10,2) and
 
 *  addx = +3 and addy = -4. This function will now return
src/map.h
Show inline comments
 
@@ -144,21 +144,21 @@ uint DistanceManhattan(TileIndex, TileIn
 
uint DistanceSquare(TileIndex, TileIndex); ///< euclidian- or L2-Norm squared
 
uint DistanceMax(TileIndex, TileIndex); ///< also known as L-Infinity-Norm
 
uint DistanceMaxPlusManhattan(TileIndex, TileIndex); ///< Max + Manhattan
 
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;                                       \
 
		do {                                                   \
 
			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); \
 
	}
 

	
 
static inline TileIndexDiff TileOffsByDiagDir(uint dir)
 
{
src/misc.cpp
Show inline comments
 
@@ -283,13 +283,13 @@ static void Save_NAME()
 

	
 
static void Load_NAME()
 
{
 
	int index;
 

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

	
 
static const SaveLoadGlobVarList _date_desc[] = {
 
	SLEG_CONDVAR(_date,                   SLE_FILE_U16 | SLE_VAR_I32,  0,  30),
 
	SLEG_CONDVAR(_date,                   SLE_INT32,                  31, SL_MAX_VERSION),
src/misc_gui.cpp
Show inline comments
 
@@ -1454,13 +1454,13 @@ static void SaveLoadDlgWndProc(Window *w
 
			DoDrawStringTruncated(item->title, 4, y, _fios_colors[item->type], w->width - 18);
 
			y += 10;
 
			if (y >= w->vscroll.cap * 10 + w->widget[7].top + 1) break;
 
		}
 

	
 
		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;
 
	}
 

	
 
	case WE_CLICK:
 
		switch (e->we.click.widget) {
 
@@ -1547,25 +1547,25 @@ static void SaveLoadDlgWndProc(Window *w
 
	case WE_TIMEOUT:
 
		/* This test protects against using widgets 11 and 12 which are only available
 
		 * in those two saveload mode  */
 
		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();
 
				/* Reset file name to current date on successfull delete */
 
				if (_saveload_mode == SLD_SAVE_GAME) GenerateFileName();
 
			}
 

	
 
			UpdateTextBufferSize(&WP(w, querystr_d).text);
 
			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();
 
		}
 
		break;
 
	case WE_DESTROY:
src/music_gui.cpp
Show inline comments
 
@@ -204,32 +204,32 @@ static void MusicTrackSelectionWndProc(W
 

	
 
		SetWindowWidgetDisabledState(w, 11, msf.playlist <= 3);
 
		LowerWindowWidget(w, 3);
 
		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);
 

	
 
		SetDParam(0, STR_01D5_ALL + msf.playlist);
 
		DrawStringCentered(340, 15, STR_01EF_PROGRAM, 0);
 

	
 
		for (i = 1; i <= NUM_SONGS_AVAILABLE; i++) {
 
			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
 

	
 
		y = 23;
 
		for (p = _playlists[msf.playlist], i = 0; (i = *p) != 0; p++) {
src/namegen.cpp
Show inline comments
 
@@ -87,13 +87,13 @@ static byte MakeEnglishAdditionalTownNam
 
	/* null terminates the string for strcat */
 
	strecpy(buf, "", last);
 

	
 
	/* 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);
 
	} else {
 
		strecat(buf, name_additional_english_1b1[SeedChance(6, lengthof(name_additional_english_1b1), seed)], last);
 
		strecat(buf, name_additional_english_1b2[SeedChance(9, lengthof(name_additional_english_1b2), seed)], last);
 
@@ -173,19 +173,19 @@ static byte MakeGermanTownName(char *buf
 

	
 
	seed_derivative = SeedChance(7, 28, seed);
 

	
 
	/* 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);
 

	
 
		i = SeedChance(5, lengthof(name_german_2), seed);
 
		strecat(buf, name_german_2[i], last);
 
	}
 
@@ -676,13 +676,13 @@ static byte MakeItalianTownName(char *bu
 
		} else { // feminine form
 
			strecat(buf, name_italian_1f[SeedModChance(4, lengthof(name_italian_1f), seed)], last);
 
		}
 

	
 
		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);
 
		}
 

	
 
		if (SeedModChance(15, 4, seed) == 0) {
 
			if (SeedModChance(5, 2, seed) == 0) { // generic suffix
src/network/core/os_abstraction.h
Show inline comments
 
@@ -158,13 +158,13 @@ typedef unsigned long in_addr_t;
 
#		include	<proto/socket.h>
 
#	endif
 

	
 
/* 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;
 
	typedef long         socklen_t;
 
	extern struct Library *SocketBase;
 

	
src/network/network_gui.cpp
Show inline comments
 
@@ -786,13 +786,13 @@ static void ShowNetworkStartServerWindow
 
	w = AllocateWindowDesc(&_network_start_server_window_desc);
 
	ttd_strlcpy(_edit_str_buf, _network_server_name, lengthof(_edit_str_buf));
 

	
 
	_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);
 
}
 

	
 
static PlayerID NetworkLobbyFindCompanyIndex(byte pos)
src/newgrf.cpp
Show inline comments
 
@@ -1520,13 +1520,13 @@ static bool GlobalVarChangeInfo(uint gvi
 
		case 0x0E: // Currency suffix symbol
 
			FOR_EACH_OBJECT {
 
				uint curidx = GetNewgrfCurrencyIdConverted(gvid + i);
 
				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);
 
				}
 
			}
 
			break;
 
@@ -2793,13 +2793,13 @@ static void FeatureNewName(byte *buf, in
 
					break;
 

	
 
#if 0
 
				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);
 
					}
 
					break;
 

	
src/news.h
Show inline comments
 
@@ -21,13 +21,13 @@ struct NewsItem {
 
};
 

	
 
typedef bool ValidationProc ( uint data_a, uint data_b );
 
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);
 
void InitNewsItemStructs();
 

	
 
VARDEF NewsItem _statusbar_news_item;
src/oldloader.cpp
Show inline comments
 
@@ -146,13 +146,13 @@ static byte ReadByteFromFile(LoadgameSta
 
 */
 
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) {
 
		/* Read new chunk */
 
		int8 new_byte = ReadByteFromFile(ls);
 

	
 
@@ -430,13 +430,13 @@ static const OldChunks town_chunk[] = {
 
	OCL_SVAR( OC_UINT16, Town, ratings[4] ),
 
	OCL_SVAR( OC_UINT16, Town, ratings[5] ),
 
	OCL_SVAR( OC_UINT16, Town, ratings[6] ),
 
	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 ),
 
	OCL_SVAR(  OC_UINT8, Town, time_until_rebuild ),
 
	OCL_SVAR(  OC_UINT8, Town, growth_rate ),
 

	
 
@@ -1216,14 +1216,14 @@ static bool LoadOldVehicle(LoadgameState
 

	
 
	return true;
 
}
 

	
 
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
 

	
 
	OCL_END()
 
};
src/openttd.cpp
Show inline comments
 
@@ -345,13 +345,13 @@ extern void DedicatedFork();
 

	
 
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;
 
#if defined(ENABLE_NETWORK)
 
	bool dedicated = false;
 
	bool network   = false;
 
@@ -376,13 +376,13 @@ int ttd_main(int argc, char *argv[])
 
	optformat = "m:s:v:hD::n::eit:d::r:g::G:c:xl:"
 
#if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(WIN32)
 
		"f"
 
#endif
 
	;
 

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

	
 
	while ((i = MyGetOpt(&mgo)) != -1) {
 
		switch (i) {
 
		case 'm': ttd_strlcpy(musicdriver, mgo.opt, sizeof(musicdriver)); break;
 
		case 's': ttd_strlcpy(sounddriver, mgo.opt, sizeof(sounddriver)); break;
 
		case 'v': ttd_strlcpy(videodriver, mgo.opt, sizeof(videodriver)); break;
src/pathfind.cpp
Show inline comments
 
@@ -818,13 +818,13 @@ start_at:
 
			if (!HASBIT(tpf->railtypes, GetRailType(tile))) {
 
				bits = TRACK_BIT_NONE;
 
				break;
 
			}
 

	
 
			/* 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);
 

	
 
			si.cur_length += _length_of_track[track];
 

	
src/player_gui.cpp
Show inline comments
 
@@ -26,23 +26,23 @@
 
#include "player_face.h"
 

	
 
static void DoShowPlayerFinances(PlayerID player, bool show_small, bool show_stickied);
 

	
 
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;
 

	
 
	if (!(mode & 1)) { // normal sized economics window (mode&1) is minimized status
 
		/* 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;
 
		j = 3;
 
		x = 215;
 
		tbl = p->yearly_expenses + 2;
 
@@ -57,33 +57,33 @@ static void DrawPlayerEconomyStats(const
 
					if (cost != 0) {
 
						sum += cost;
 

	
 
						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++;
 
			tbl--;
 
		} while (--j != 0);
 

	
 
		y = 171;
 

	
 
		/* 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;
 
	}
 

	
 
	DrawString(2, y, STR_7026_BANK_BALANCE, 0);
 
	SetDParam64(0, p->money64);
 
@@ -94,13 +94,13 @@ static void DrawPlayerEconomyStats(const
 
	DrawString(2, y, STR_7027_LOAN, 0);
 
	SetDParam64(0, p->current_loan);
 
	DrawStringRightAligned(182, y, STR_7028, 0);
 

	
 
	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);
 
}
 

	
 
static const Widget _player_finances_widgets[] = {
 
@@ -163,19 +163,19 @@ static void PlayerFinancesWndProc(Window
 
		SetDParam(0, p->name_1);
 
		SetDParam(1, p->name_2);
 
		SetDParam(2, GetPlayerNameString(player, 3));
 
		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);
 
			DoShowPlayerFinances(player, !HASBIT(mode, 0), stickied);
 
		} break;
 

	
 
@@ -236,13 +236,13 @@ static void DoShowPlayerFinances(PlayerI
 
	if (!IsValidPlayer(player)) return;
 

	
 
	mode = (player != _local_player) * 2 + show_small;
 
	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;
 
	}
 
}
 

	
 
void ShowPlayerFinances(PlayerID player)
 
{
 
@@ -551,31 +551,31 @@ static void SelectPlayerFaceWndProc(Wind
 
	switch (e->event) {
 
	case WE_PAINT: {
 
		Player *p;
 
		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 */
 
		case 6: /* female click */
 
			RaiseWindowWidget(w, WP(w, facesel_d).gender + 5);
 
			WP(w, facesel_d).gender = e->we.click.widget - 5;
 
			LowerWindowWidget(w, WP(w, facesel_d).gender + 5);
 
			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;
 
		}
 
		break;
 
	}
 
}
 
@@ -653,14 +653,14 @@ static void DrawPlayerVehiclesAmount(Pla
 
				case VEH_SHIP:     ship++; break;
 
				default: break;
 
			}
 
		}
 
	}
 

	
 
	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);
 
			DrawString(x + 70, y, STR_TRAINS, 0);
 
			y += 10;
 
		}
 
@@ -759,13 +759,13 @@ static void PlayerCompanyWndProc(Window 
 

	
 
			SetDParam(0, p->inaugurated_year);
 
			DrawString(110, 25, STR_7038_INAUGURATED, 0);
 

	
 
			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);
 

	
 
			DrawPlayerFace(p->face, p->player_color, 2, 16);
 

	
 
			SetDParam(0, p->president_name_1);
 
@@ -783,24 +783,24 @@ static void PlayerCompanyWndProc(Window 
 
		case WE_CLICK:
 
			switch (e->we.click.widget) {
 
				case PCW_WIDGET_NEW_FACE: {
 
					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;
 
				}
 

	
 
				case PCW_WIDGET_COLOR_SCHEME: {
 
					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;
 
				}
 

	
 
				case PCW_WIDGET_PRESIDENT_NAME: {
 
@@ -810,13 +810,13 @@ static void PlayerCompanyWndProc(Window 
 
					ShowQueryString(p->president_name_1, STR_700B_PRESIDENT_S_NAME, 31, 94, w, CS_ALPHANUMERAL);
 
					break;
 
				}
 

	
 
				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;
 
				}
 

	
 
				case PCW_WIDGET_BUILD_VIEW_HQ: {
 
@@ -849,13 +849,13 @@ static void PlayerCompanyWndProc(Window 
 
					DoCommandP(0, w->window_number, 0, NULL, CMD_SELL_SHARE_IN_COMPANY | CMD_MSG(STR_707C_CAN_T_SELL_25_SHARE_IN));
 
					break;
 

	
 
				#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);
 
					}
 
					break;
 
				#endif /* ENABLE_NETWORK */
 
			}
 
@@ -882,16 +882,16 @@ static void PlayerCompanyWndProc(Window 
 
			break;
 

	
 
		case WE_ON_EDIT_TEXT: {
 
			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;
 
				case 1: /* Change company name */
 
					DoCommandP(0, 0, 0, NULL, CMD_CHANGE_COMPANY_NAME | CMD_MSG(STR_700C_CAN_T_CHANGE_COMPANY_NAME));
 
					break;
src/rail.cpp
Show inline comments
 
@@ -65,14 +65,14 @@ extern const TrackBits _track_crosses_tr
 
	TRACK_BIT_HORZ  /* TRACK_RIGHT */
 
};
 

	
 
/* 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] = {
 
	{TRACKDIR_X_NE,     INVALID_TRACKDIR,  TRACKDIR_X_SW,     INVALID_TRACKDIR},
 
	{INVALID_TRACKDIR,  TRACKDIR_Y_SE,     INVALID_TRACKDIR,  TRACKDIR_Y_NW},
 
	{TRACKDIR_UPPER_E,  INVALID_TRACKDIR,  INVALID_TRACKDIR,  TRACKDIR_UPPER_W},
src/road_cmd.cpp
Show inline comments
 
@@ -57,16 +57,16 @@ bool CheckAllowRemoveRoad(TileIndex tile
 

	
 
	if (_cheats.magic_bulldozer.value) return true;
 

	
 
	/* 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 */
 
	if ((n & (n - 1)) != 0 && (n & remove) != 0) {
 
		Town *t;
 
		*edge_road = false;
 
@@ -428,13 +428,13 @@ int32 CmdBuildLongRoad(TileIndex end_til
 

	
 
	/* Swap start and ending tile, also the half-tile drag var (bit 0 and 1) */
 
	if (start_tile > end_tile || (start_tile == end_tile && HASBIT(p2, 0))) {
 
		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;
 
	tile = start_tile;
 
	/* Start tile is the small number. */
 
	for (;;) {
src/road_gui.cpp
Show inline comments
 
@@ -254,17 +254,17 @@ static void BuildRoadToolbWndProc(Window
 
	case WE_ABORT_PLACE_OBJ:
 
		RaiseWindowButtons(w);
 
		DisableWindowWidget(w, RTW_REMOVE);
 
		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: {
 
		int sel_method;
 
		switch (e->we.place.userdata) {
 
			case 1:
 
@@ -411,17 +411,17 @@ static void BuildRoadDepotWndProc(Window
 
			SetWindowDirty(w);
 
			break;
 
		}
 
	}	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;
 
	}
 
}
 

	
 
static const Widget _build_road_depot_widgets[] = {
 
{   WWT_CLOSEBOX,   RESIZE_NONE,     7,     0,    10,     0,    13, STR_00C5,                        STR_018B_CLOSE_WINDOW},
 
@@ -455,13 +455,13 @@ static void RoadStationPickerWndProc(Win
 
		LowerWindowWidget(w, _station_show_coverage + 9);
 
		break;
 

	
 
	case WE_PAINT: {
 
		int image;
 

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

	
 
		DrawWindowWidgets(w);
 

	
 
		if (_station_show_coverage) {
 
			int rad = _patches.modified_catchment ? CA_TRUCK /* = CA_BUS */ : 4;
 
			SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
 
@@ -469,23 +469,23 @@ static void RoadStationPickerWndProc(Win
 
			SetTileSelectSize(1, 1);
 
		}
 

	
 
		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;
 

	
 
		StationPickerDrawSprite(171, 35, RAILTYPE_BEGIN, image);
 
		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;
 

	
 
	case WE_CLICK: {
 
		switch (e->we.click.widget) {
 
@@ -504,22 +504,22 @@ static void RoadStationPickerWndProc(Win
 
			SetWindowDirty(w);
 
			break;
 
		}
 
	} break;
 

	
 
	case WE_MOUSELOOP: {
 
		if (WP(w,def_d).close) {
 
		if (WP(w, def_d).close) {
 
			DeleteWindow(w);
 
			return;
 
		}
 

	
 
		CheckRedrawStationCoverage(w);
 
	} break;
 

	
 
	case WE_DESTROY:
 
		if (!WP(w,def_d).close) ResetObjectToPlace();
 
		if (!WP(w, def_d).close) ResetObjectToPlace();
 
		break;
 
	}
 
}
 

	
 
static const Widget _bus_station_picker_widgets[] = {
 
{   WWT_CLOSEBOX,   RESIZE_NONE,     7,     0,    10,     0,    13, STR_00C5,                         STR_018B_CLOSE_WINDOW},
src/roadveh_cmd.cpp
Show inline comments
 
@@ -165,17 +165,17 @@ int32 CmdBuildRoadVeh(TileIndex tile, ui
 

	
 
		v->tile = tile;
 
		x = TileX(tile) * TILE_SIZE + TILE_SIZE / 2;
 
		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;
 
		v->cargo_subtype = 0;
 
		v->cargo_cap = rvi->capacity;
 
//		v->cargo_count = 0;
src/saveload.cpp
Show inline comments
 
@@ -248,20 +248,20 @@ static uint SlReadSimpleGamma()
 
static void SlWriteSimpleGamma(uint i)
 
{
 
	if (i >= (1 << 7)) {
 
		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);
 
}
 

	
 
/** Return how many bytes used to encode a gamma value */
 
@@ -922,13 +922,13 @@ static void SlSaveChunks()
 
 * @return returns the appropiate chunkhandler
 
 */
 
static const ChunkHandler *SlFindChunkHandler(uint32 id)
 
{
 
	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;
 
			ch++;
 
		}
 
	}
 
@@ -1027,13 +1027,13 @@ static void WriteNoComp(uint size)
 
	fwrite(_sl.buf, 1, size, _sl.fh);
 
}
 

	
 
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;
 
}
 

	
 
static void UninitNoComp()
 
{
 
	free(_sl.buf_ori);
src/screenshot.cpp
Show inline comments
 
@@ -265,13 +265,13 @@ struct PcxHeader {
 
	byte version;
 
	byte rle;
 
	byte bpp;
 
	uint32 unused;
 
	uint16 xmax, ymax;
 
	uint16 hdpi, vdpi;
 
	byte pal_small[16*3];
 
	byte pal_small[16 * 3];
 
	byte reserved;
 
	byte planes;
 
	uint16 pitch;
 
	uint16 cpal;
 
	uint16 width;
 
	uint16 height;
src/settings.cpp
Show inline comments
 
@@ -1137,21 +1137,21 @@ static int32 InvalidateStationBuildWindo
 
static int32 CheckInterval(int32 p1)
 
{
 
	bool warning;
 
	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)
 
		ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_SERVICE_INTERVAL_INCOMPATIBLE, 0, 0);
 

	
 
	return InValidateDetailsWindow(0);
 
@@ -1277,13 +1277,13 @@ static const SettingDesc _gameopt_settin
 
	 * same-sized members
 
	 * XXX - To save file-space and since values are never bigger than about 10? only
 
	 * save the first 16 bits in the savegame. Question is why the values are still int32
 
	 * 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),
 
	  SDT_OMANY(GameOptions, landscape, SLE_UINT8, 0, 0, 0,     3, "temperate|arctic|tropic|toyland", STR_NULL, NULL, ConvertLandscape),
 
	    SDT_VAR(GameOptions, snow_line, SLE_UINT8, 0, 0, 7 * TILE_HEIGHT, 2 * TILE_HEIGHT, 13 * TILE_HEIGHT, 0, STR_NULL, NULL),
 
	SDT_CONDOMANY(GameOptions,autosave, SLE_UINT8, 0, 22,             N, 0, 0, 0, "", STR_NULL, NULL, NULL),
 
@@ -1524,13 +1524,13 @@ const SettingDesc _patch_settings[] = {
 
	SDT_END()
 
};
 

	
 
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()
 
};
 

	
 
/* Undefine for the shortcut macros above */
src/ship_cmd.cpp
Show inline comments
 
@@ -548,13 +548,13 @@ static inline NPFFoundTargetData PerfNPF
 

	
 
/** returns the track to choose on the next tile, or -1 when it's better to
 
 * reverse. The tile given is the tile we are about to enter, enterdir is the
 
 * 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);
 
		return (trackdir != INVALID_TRACKDIR) ? TrackdirToTrack(trackdir) : INVALID_TRACK;
 
	} else if (_patches.new_pathfinding_all) {
 
		NPFFindStationOrTileData fstd;
 
@@ -651,17 +651,17 @@ static const byte _ship_subcoord[4][6][3
 
		{ 0, 0, 0},
 
		{ 0, 0, 0},
 
		{ 0, 8, 4},
 
	},
 
	{
 
		{ 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},
 
	}
 
};
 

	
 
static void ShipController(Vehicle *v)
 
{
 
	uint32 r;
 
@@ -877,13 +877,13 @@ int32 CmdBuildShip(TileIndex tile, uint3
 
		v->owner = _current_player;
 
		v->tile = tile;
 
		x = TileX(tile) * TILE_SIZE + TILE_SIZE / 2;
 
		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;
 
		v->sprite_height = 6;
 
		v->x_offs = -3;
 
		v->y_offs = -3;
src/ship_gui.cpp
Show inline comments
 
@@ -75,13 +75,13 @@ static void ShipDetailsWndProc(Window *w
 
		}
 

	
 
		/* Draw service interval text */
 
		{
 
			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);
 

	
 
		SetDParam(1, v->build_year);
 
		SetDParam(0, GetCustomEngineName(v->engine_type));
 
@@ -117,13 +117,13 @@ static void ShipDetailsWndProc(Window *w
 
			ShowQueryString(v->string_id, STR_9831_NAME_SHIP, 31, 150, w, CS_ALPHANUMERAL);
 
			break;
 
		case 5: /* increase int */
 
			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);
 

	
 
			mod = GetServiceIntervalClamped(mod + v->service_interval);
 
			if (mod == v->service_interval) return;
 

	
 
@@ -154,13 +154,13 @@ static const Widget _ship_details_widget
 
{      WWT_PANEL,   RESIZE_NONE,    14,    11,   404,   101,   112, 0x0,              STR_NULL},
 
{   WIDGETS_END},
 
};
 

	
 
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
 
};
 

	
 
static void ShowShipDetailsWindow(const Vehicle *v)
 
@@ -323,13 +323,13 @@ static const Widget _ship_view_widgets[]
 
{      WWT_INSET, RESIZE_RB,    14,   2, 229,  16, 101, 0x0,                     STR_NULL},
 
{    WWT_PUSHBTN, RESIZE_RTB,   14,   0, 237, 104, 115, 0x0,                     STR_9827_CURRENT_SHIP_ACTION_CLICK},
 
{ WWT_PUSHIMGBTN, RESIZE_LR,    14, 232, 249,  14,  31, SPR_CENTRE_VIEW_VEHICLE, STR_9829_CENTER_MAIN_VIEW_ON_SHIP},
 
{ 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 },
 
{ WIDGETS_END }
 
};
 

	
src/signs.cpp
Show inline comments
 
@@ -133,13 +133,13 @@ int32 CmdPlaceSign(TileIndex tile, uint3
 
		int y = TileY(tile) * TILE_SIZE;
 

	
 
		si->str = STR_280A_SIGN;
 
		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);
 
		_sign_sort_dirty = true;
 
		_new_sign = si;
 
	}
src/station_cmd.cpp
Show inline comments
 
@@ -196,13 +196,13 @@ static bool GenerateStationName(Station 
 
	unsigned long tmp;
 

	
 
	{
 
		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))
 
						str = M(STR_SV_STNAME_WOODS);
 
					CLRBIT(free_names, str);
 
				}
 
@@ -227,13 +227,13 @@ static bool GenerateStationName(Station 
 
			found = M(STR_SV_STNAME_MINES);
 
			goto done;
 
		}
 
	}
 

	
 
	/* 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;
 

	
 
		found = M(STR_SV_STNAME_CENTRAL);
 
		if (HASBIT(free_names, M(STR_SV_STNAME_CENTRAL))) goto done;
 
	}
 
@@ -269,24 +269,24 @@ 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[
 
			(TileX(tile) < TileX(t->xy)) +
 
			(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;
 
	}
 
	found = FindFirstBit(tmp);
 

	
 
@@ -365,13 +365,13 @@ static void ShowRejectOrAcceptNews(const
 
{
 
	for (uint i = 0; i < num_items; i++) {
 
		SetDParam(i + 1, GetCargo(cargo[i])->name);
 
	}
 

	
 
	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.
 
void GetProductionAroundTiles(AcceptedCargo produced, TileIndex tile,
 
	int w, int h, int rad)
 
{
 
@@ -643,16 +643,16 @@ int32 CheckFlatLandBelow(TileIndex tile,
 
			return_cmd_error(STR_0007_FLAT_LAND_REQUIRED);
 
		}
 

	
 
		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;
 
			flat_z += TILE_HEIGHT;
 
		}
 

	
 
@@ -745,23 +745,23 @@ static bool CanExpandRailroadStation(con
 
}
 

	
 
static inline byte *CreateSingle(byte *layout, int n)
 
{
 
	int i = n;
 
	do *layout++ = 0; while (--i);
 
	layout[((n-1) >> 1)-n] = 2;
 
	layout[((n - 1) >> 1) - n] = 2;
 
	return layout;
 
}
 

	
 
static inline byte *CreateMulti(byte *layout, int n, byte b)
 
{
 
	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;
 
}
 

	
 
static void GetStationLayout(byte *layout, int numtracks, int plat_len, const StationSpec *statspec)
 
{
 
@@ -1620,13 +1620,13 @@ static int32 RemoveAirport(Station *st, 
 
		if (!EnsureNoVehicle(tile_cur)) return CMD_ERROR;
 

	
 
		if (flags & DC_EXEC) {
 
			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) {
 
			DeleteWindowById(
 
				WC_VEHICLE_DEPOT, tile + ToTileIndexDiff(afc->airport_depots[i])
 
			);
src/strgen/strgen.cpp
Show inline comments
 
@@ -727,13 +727,13 @@ static const CmdStruct *TranslateCmdForC
 

	
 

	
 
static bool CheckCommandsMatch(char *a, char *b, const char *name)
 
{
 
	ParsedCommandStruct templ;
 
	ParsedCommandStruct lang;
 
	int i,j;
 
	int i, j;
 
	bool result = true;
 

	
 
	ExtractCommandString(&templ, b, true);
 
	ExtractCommandString(&lang, a, true);
 

	
 
	// For each string in templ, see if we find it in lang
 
@@ -911,13 +911,13 @@ static void ParseFile(const char *file, 
 
	// TODO:!! We can't reset the cases. In case the translated strings
 
	// derive some strings from english....
 

	
 
	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++;
 
	}
 
	fclose(in);
 

	
src/strings.cpp
Show inline comments
 
@@ -60,13 +60,13 @@ static uint _langtab_start[32]; // Offse
 
static inline int64 GetInt64(const int32 **argv)
 
{
 
	int64 result;
 

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

	
 
/** Read an int32 from the argv array. */
 
static inline int32 GetInt32(const int32 **argv)
 
{
 
@@ -418,51 +418,51 @@ static int DeterminePluralForm(int32 n)
 
		return n > 1;
 

	
 
	/* Three forms, special case for zero
 
	 * 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;
 
	}
 
}
 

	
 
static const char *ParseStringChoice(const char *b, uint form, char *dst, int *dstlen)
 
{
 
	//<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++;
 
		if (i == form) {
 
			mypos = pos;
 
			mylen = len;
src/table/ai_rail.h
Show inline comments
 
@@ -18,13 +18,13 @@ struct AiDefaultRailBlock {
 
struct AiDefaultRoadBlock {
 
	byte dir;
 
	const AiDefaultBlockData *data;
 
};
 

	
 

	
 
#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}}
 
#define MKCLRRAIL(a, b, c) {3, a, {b, c}}
 
#define MKEND              {4, 0, {0, 0}}
 

	
 
@@ -421,123 +421,123 @@ static const AiDefaultRailBlock * const 
 
	&_raildata_ai_23,
 
	NULL
 
};
 

	
 
#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
 
};
 

	
 
static const AiDefaultRoadBlock _roaddata_ai_0 = {
 
	0, _roaddata_ai_0_data
 
};
 

	
 
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
 
};
 

	
 
static const AiDefaultRoadBlock _roaddata_ai_1 = {
 
	0, _roaddata_ai_1_data
 
};
 

	
 
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
 
};
 

	
 
static const AiDefaultRoadBlock _roaddata_ai_2 = {
 
	0, _roaddata_ai_2_data
 
};
 

	
 
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
 
};
 

	
 
static const AiDefaultRoadBlock _roaddata_ai_3 = {
 
	0, _roaddata_ai_3_data
 
};
 

	
 
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
 
};
 

	
 
static const AiDefaultRoadBlock _roaddata_ai_4 = {
 
	1, _roaddata_ai_4_data
 
};
 

	
 
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
 
};
 

	
 
static const AiDefaultRoadBlock _roaddata_ai_5 = {
 
	1, _roaddata_ai_5_data
 
};
 

	
 
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
 
};
 

	
 
static const AiDefaultRoadBlock _roaddata_ai_6 = {
 
	1, _roaddata_ai_6_data
 
};
 

	
 
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
 
};
 

	
 
static const AiDefaultRoadBlock _roaddata_ai_7 = {
 
	1, _roaddata_ai_7_data
 
};
src/table/build_industry.h
Show inline comments
 
@@ -2,1065 +2,1065 @@
 

	
 
/** @file build_industry.h */
 

	
 
#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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_coal_mine[] = {
 
	_tile_table_coal_mine_0,
 
	_tile_table_coal_mine_1,
 
	_tile_table_coal_mine_2,
 
	_tile_table_coal_mine_3,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_power_station[] = {
 
	_tile_table_power_station_0,
 
	_tile_table_power_station_1,
 
	_tile_table_power_station_2,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_sawmill[] = {
 
	_tile_table_sawmill_0,
 
	_tile_table_sawmill_1,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_forest[] = {
 
	_tile_table_forest_0,
 
	_tile_table_forest_1,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_oil_refinery[] = {
 
	_tile_table_oil_refinery_0,
 
	_tile_table_oil_refinery_1,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_oil_rig[] = {
 
	_tile_table_oil_rig_0,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_factory[] = {
 
	_tile_table_factory_0,
 
	_tile_table_factory_1,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_printing_works[] = {
 
	_tile_table_printing_works_0,
 
	_tile_table_printing_works_1,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_steel_mill[] = {
 
	_tile_table_steel_mill_0,
 
	_tile_table_steel_mill_1,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_farm[] = {
 
	_tile_table_farm_0,
 
	_tile_table_farm_1,
 
	_tile_table_farm_2,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_copper_mine[] = {
 
	_tile_table_copper_mine_0,
 
	_tile_table_copper_mine_1,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_oil_well[] = {
 
	_tile_table_oil_well_0,
 
	_tile_table_oil_well_1,
 
};
 

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

	
 
static const IndustryTileTable * const _tile_table_bank[] = {
 
	_tile_table_bank_0,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_food_process[] = {
 
	_tile_table_food_process_0,
 
	_tile_table_food_process_1,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_paper_mill[] = {
 
	_tile_table_paper_mill_0,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_gold_mine[] = {
 
	_tile_table_gold_mine_0,
 
};
 

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

	
 
static const IndustryTileTable * const _tile_table_bank2[] = {
 
	_tile_table_bank2_0,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_diamond_mine[] = {
 
	_tile_table_diamond_mine_0,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_iron_mine[] = {
 
	_tile_table_iron_mine_0,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_fruit_plantation[] = {
 
	_tile_table_fruit_plantation_0,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_rubber_plantation[] = {
 
	_tile_table_rubber_plantation_0,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_water_supply[] = {
 
	_tile_table_water_supply_0,
 
};
 

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

	
 
static const IndustryTileTable * const _tile_table_water_tower[] = {
 
	_tile_table_water_tower_0,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_factory2[] = {
 
	_tile_table_factory2_0,
 
	_tile_table_factory2_1,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_farm2[] = {
 
	_tile_table_farm2_0,
 
	_tile_table_farm2_1,
 
	_tile_table_farm2_2,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_lumber_mill[] = {
 
	_tile_table_lumber_mill_0,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_cotton_candy[] = {
 
	_tile_table_cotton_candy_0,
 
	_tile_table_cotton_candy_1,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_candy_factory[] = {
 
	_tile_table_candy_factory_0,
 
	_tile_table_candy_factory_1,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_battery_farm[] = {
 
	_tile_table_battery_farm_0,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_cola_wells[] = {
 
	_tile_table_cola_wells_0,
 
	_tile_table_cola_wells_1,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_toy_shop[] = {
 
	_tile_table_toy_shop_0,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_toy_factory[] = {
 
	_tile_table_toy_factory_0,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_plastic_fountain[] = {
 
	_tile_table_plastic_fountain_0,
 
	_tile_table_plastic_fountain_1,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_fizzy_drink[] = {
 
	_tile_table_fizzy_drink_0,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_bubble_generator[] = {
 
	_tile_table_bubble_generator_0,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_toffee_quarry[] = {
 
	_tile_table_toffee_quarry_0,
 
};
 

	
 
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
 
};
 

	
 
static const IndustryTileTable * const _tile_table_sugar_mine[] = {
 
	_tile_table_sugar_mine_0,
 
};
 
@@ -1100,13 +1100,13 @@ static const IndustryTileTable * const _
 
 * @param intx text while building
 
 * @param s1   text for closure
 
 * @param s2   text for production up
 
 * @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}
 

	
 
static const IndustrySpec _industry_specs[] = {
 
	/* Format:
src/table/namegen.h
Show inline comments
 
@@ -1928,13 +1928,13 @@ static const char *name_czech_suffix[] =
 
	"v Čechách",
 
	"na MoravÄ›",
 
};
 

	
 

	
 

	
 
static const char *name_romanian_real[]= {
 
static const char *name_romanian_real[] = {
 
	"Adjud",
 
	"Alba Iulia",
 
	"Alexandria",
 
	"Babadag",
 
	"Bacãu",
 
	"Baia Mare",
src/table/station_land.h
Show inline comments
 
@@ -31,37 +31,37 @@ static const DrawTileSeqStruct _station_
 
};
 

	
 
static const DrawTileSeqStruct _station_display_datas_4[] = {
 
	{  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()
 
};
 

	
 
static const DrawTileSeqStruct _station_display_datas_5[] = {
 
	{  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()
 
};
 

	
 
static const DrawTileSeqStruct _station_display_datas_6[] = {
 
	{  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()
 
};
 

	
 
static const DrawTileSeqStruct _station_display_datas_7[] = {
 
	{  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()
 
};
 

	
 
static const DrawTileSeqStruct _station_display_datas_9[] = {
 
	{  0,  0,  0, 16,  1,  6, SPR_AIRPORT_FENCE_X | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE }, // fences north
 
	TILE_SEQ_END()
src/table/tree_land.h
Show inline comments
 
@@ -22,13 +22,13 @@ static const TreePos _tree_layout_xy[][4
 
	{ { 9, 3 }, { 1, 8 }, { 0, 0 }, { 8, 9 } },
 
	{ { 4, 4 }, { 9, 1 }, { 6, 9 }, { 0, 9 } },
 
	{ { 9, 1 }, { 0, 9 }, { 6, 6 }, { 3, 0 } },
 
	{ { 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 */
 
	{ { 0x652, PAL_NONE }, { 0x652, PAL_NONE }, { 0x660, PAL_NONE }, { 0x66e, PAL_NONE } }, /* 3 */
 
	{ { 0x660, PAL_NONE }, { 0x667, PAL_NONE }, { 0x659, PAL_NONE }, { 0x652, PAL_NONE } }, /* 4 */
 
	{ { 0x660, PAL_NONE }, { 0x675, PAL_NONE }, { 0x660, PAL_NONE }, { 0x660, PAL_NONE } }, /* 5 */
src/terraform_gui.cpp
Show inline comments
 
@@ -270,13 +270,13 @@ static const Widget _terraform_widgets[]
 
{   WWT_IMGBTN,   RESIZE_NONE,     7, 136, 157,  14,  35, SPR_IMG_PLACE_SIGN,      STR_0289_PLACE_SIGN},
 

	
 
{   WIDGETS_END},
 
};
 

	
 
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,
 
	TerraformToolbWndProc
 
};
 

	
src/town_cmd.cpp
Show inline comments
 
@@ -243,15 +243,15 @@ static bool IsCloseToTown(TileIndex tile
 
	return false;
 
}
 

	
 
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
 
	);
 
}
 

	
 
void UpdateTownVirtCoord(Town *t)
 
{
 
@@ -527,16 +527,16 @@ static bool IsRoadAllowedHere(TileIndex 
 

	
 
		slope = GetTileSlope(tile, NULL);
 
		if (slope == SLOPE_FLAT) {
 
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 */
 
			return true;
 
		}
 

	
 
@@ -641,13 +641,13 @@ static void GrowTownInTile(TileIndex* ti
 

	
 
			/* That means that the road is only allowed if there is a house
 
			 *  at any side of the new road. */
 
		}
 
		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;
 
		rcmd = (RoadBits)(1 << (block ^ 2));
 
	} else {
 
		int i;
 
@@ -768,13 +768,13 @@ static int GrowTownAtRoad(Town *t, TileI
 
		ClrBitT(mask, (block ^ 2));
 
		if (mask == 0)
 
			return _grow_town_result;
 

	
 
		/* 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)) {
 
			/* Don't allow building over roads of other cities */
 
			if (IsTileOwner(tile, OWNER_TOWN) && GetTownByTile(tile) != t) {
 
				_grow_town_result = -1;
src/train_cmd.cpp
Show inline comments
 
@@ -2985,13 +2985,13 @@ static void TrainController(Vehicle *v, 
 
							v->subspeed = 0;
 
							v->progress = 255 - 100;
 
							if (++v->load_unload_time_rem < _patches.wait_oneway_signal * 20) return;
 
						} 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;
 
								vasd.tile = o_tile;
 
								vasd.direction = ReverseDir(dir);
 

	
src/tree_cmd.cpp
Show inline comments
 
@@ -314,13 +314,13 @@ int32 CmdPlantTree(TileIndex tile, uint3
 
	}
 
}
 

	
 
struct TreeListEnt {
 
	SpriteID image;
 
	SpriteID pal;
 
	byte x,y;
 
	byte x, y;
 
};
 

	
 
static void DrawTile_Trees(TileInfo *ti)
 
{
 
	const PalSpriteID *s;
 
	const TreePos* d;
src/variables.h
Show inline comments
 
@@ -387,14 +387,14 @@ void SetDParamStr(uint n, const char *st
 
/** This function takes a C-string and allocates a temporary string ID.
 
 * The duration of the bound string is valid only until the next acll to GetString,
 
 * so be careful. */
 
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;
 

	
 
/* landscape.cpp */
 
extern const byte _tileh_to_sprite[32];
src/vehicle.cpp
Show inline comments
 
@@ -185,15 +185,15 @@ Vehicle *FindVehicleBetween(TileIndex fr
 
	if (x1 > x2 || y1 > y2) {
 
		Swap(x1, x2);
 
		Swap(y1, y2);
 
	}
 
	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;
 
			}
 
		}
 
	}
 
	return NULL;
 
}
 
@@ -418,13 +418,13 @@ void *VehicleFromPos(TileIndex tile, voi
 
static void UpdateVehiclePosHash(Vehicle* v, int x, int y)
 
{
 
	Vehicle **old_hash, **new_hash;
 
	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;
 

	
 
	/* remove from hash table? */
 
	if (old_hash != NULL) {
src/vehicle_gui.cpp
Show inline comments
 
@@ -340,54 +340,54 @@ static void VehicleRefitWndProc(Window *
 
			SetVScrollCount(w, WP(w, refit_d).list->num_lines);
 

	
 
			SetDParam(0, v->string_id);
 
			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);
 
				}
 
			}
 
		}	break;
 

	
 
		case WE_CLICK:
 
			switch (e->we.click.widget) {
 
				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) {
 
							int command = 0;
 

	
 
							switch (v->type) {
 
								case VEH_TRAIN:    command = CMD_REFIT_RAIL_VEHICLE | CMD_MSG(STR_RAIL_CAN_T_REFIT_VEHICLE);  break;
 
								case VEH_ROAD:     command = CMD_REFIT_ROAD_VEH     | CMD_MSG(STR_REFIT_ROAD_VEHICLE_CAN_T);  break;
 
								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;
 
			}
 
			break;
 

	
 
@@ -415,21 +415,21 @@ static const Widget _vehicle_refit_widge
 
	{  WWT_RESIZEBOX,     RESIZE_TB,    14,   228,   239,   162,   173, 0x0,                                 STR_RESIZE_BUTTON},
 
	{   WIDGETS_END},
 
};
 

	
 
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,
 
};
 

	
 
/** 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)
 
{
 
	Window *w;
 

	
 
	DeleteWindowById(WC_VEHICLE_REFIT, v->index);
src/video/win32_v.cpp
Show inline comments
 
@@ -42,13 +42,13 @@ uint _codepage;
 

	
 
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;
 

	
 
	for (i = 0; i != 256; i++) {
 
		pal->palPalEntry[i].peRed   = _cur_palette[i].r;
 
@@ -650,14 +650,14 @@ static bool AllocateDibSection(int w, in
 

	
 
	if (_wnd.alloced_bits) {
 
		free(_wnd.alloced_bits);
 
		_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) {
 
		w = ALIGN(w, 4);
 
		_wnd.alloced_bits = _wnd.buffer_bits = (Pixel*)malloc(w * h);
 
		w *= 2;
src/viewport.cpp
Show inline comments
 
@@ -2047,13 +2047,13 @@ static bool SwapDirection(HighLightStyle
 

	
 
/** Calculates height difference between one tile and another
 
* Multiplies the result to suit the standard given by minimap - 50 meters high
 
* 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.)
 
* @param distance amount of tiles dragged, important for horizontal/vertical drags
 
*        ignored for others
 
* @param start_tile, end_tile start and end tile of drag operation
 
@@ -2392,13 +2392,13 @@ bool VpHandlePlaceSizingDrag()
 

	
 
	if (_special_mouse_mode != WSM_SIZING) return true;
 

	
 
	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;
 
	}
 

	
 
	/* while dragging execute the drag procedure of the corresponding window (mostly VpSelectTilesWithMethod() ) */
src/water_cmd.cpp
Show inline comments
 
@@ -648,13 +648,13 @@ static void FloodVehicle(Vehicle *v)
 

	
 
		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
 
		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
 

	
 
		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);
 
		SndPlayVehicleFx(SND_12_EXPLOSION, v);
 
	}
 
}
src/win32.cpp
Show inline comments
 
@@ -332,13 +332,13 @@ error1:
 
#endif /* Disabled crash-submit procedures */
 

	
 
static const TCHAR * const _expand_texts[] = {_T("S&how report >>"), _T("&Hide report <<") };
 

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

	
 
	GetWindowRect(wnd, &r);
 

	
 
	SetDlgItemText(wnd, 15, _expand_texts[mode == 1]);
 

	
 
@@ -365,13 +365,13 @@ static bool DoEmergencySave(HWND wnd)
 
	__try {
 
		b = EmergencySave();
 
	} __except (1) {}
 
	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: {
 
#if defined(UNICODE)
 
			/* We need to put the crash-log in a seperate buffer because the default
 
			 * buffer in MB_TO_WIDE is not large enough (512 chars) */
 
@@ -546,21 +546,21 @@ static LONG WINAPI ExceptionHandler(EXCE
 
			"\r\n"
 
			"\r\nStack trace: \r\n"
 
		);
 
	}
 

	
 
	{
 
		int i,j;
 
		int i, j;
 
#ifdef _M_AMD64
 
		uint32 *b = (uint32*)ep->ContextRecord->Rsp;
 
#else
 
		uint32 *b = (uint32*)ep->ContextRecord->Esp;
 
#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);
 
				}
 
				b++;
 
			}
src/window.cpp
Show inline comments
 
@@ -232,31 +232,31 @@ static void DrawOverlappedWindow(Window*
 
		const Window *v = *vz;
 

	
 
		if (right > v->left &&
 
				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;
 
			}
 

	
 
			return;
0 comments (0 inline, 0 general)