mirror of https://github.com/OpenTTD/OpenTTD
Codefix: use actual type instead of int for TileIndexDiff
parent
3105f6391c
commit
3b0fcf442f
|
@ -1236,7 +1236,7 @@ static bool GrowTownWithRoad(const Town *t, TileIndex tile, RoadBits rcmd)
|
||||||
*/
|
*/
|
||||||
static bool CanRoadContinueIntoNextTile(const Town *t, const TileIndex tile, const DiagDirection road_dir)
|
static bool CanRoadContinueIntoNextTile(const Town *t, const TileIndex tile, const DiagDirection road_dir)
|
||||||
{
|
{
|
||||||
const int delta = TileOffsByDiagDir(road_dir); // +1 tile in the direction of the road
|
const TileIndexDiff delta = TileOffsByDiagDir(road_dir); // +1 tile in the direction of the road
|
||||||
TileIndex next_tile = tile + delta; // The tile beyond which must be connectable to the target tile
|
TileIndex next_tile = tile + delta; // The tile beyond which must be connectable to the target tile
|
||||||
RoadBits rcmd = DiagDirToRoadBits(ReverseDiagDir(road_dir));
|
RoadBits rcmd = DiagDirToRoadBits(ReverseDiagDir(road_dir));
|
||||||
RoadType rt = GetTownRoadType();
|
RoadType rt = GetTownRoadType();
|
||||||
|
@ -1317,7 +1317,7 @@ static bool GrowTownWithBridge(const Town *t, const TileIndex tile, const DiagDi
|
||||||
uint bridge_length = 0; // This value stores the length of the possible bridge
|
uint bridge_length = 0; // This value stores the length of the possible bridge
|
||||||
TileIndex bridge_tile = tile; // Used to store the other waterside
|
TileIndex bridge_tile = tile; // Used to store the other waterside
|
||||||
|
|
||||||
const int delta = TileOffsByDiagDir(bridge_dir);
|
const TileIndexDiff delta = TileOffsByDiagDir(bridge_dir);
|
||||||
|
|
||||||
/* To prevent really small towns from building disproportionately
|
/* To prevent really small towns from building disproportionately
|
||||||
* long bridges, make the max a function of its population. */
|
* long bridges, make the max a function of its population. */
|
||||||
|
@ -1392,7 +1392,7 @@ static bool GrowTownWithTunnel(const Town *t, const TileIndex tile, const DiagDi
|
||||||
/* Assure that the tunnel is connectable to the start side */
|
/* Assure that the tunnel is connectable to the start side */
|
||||||
if (!(GetTownRoadBits(TileAddByDiagDir(tile, ReverseDiagDir(tunnel_dir))) & DiagDirToRoadBits(tunnel_dir))) return false;
|
if (!(GetTownRoadBits(TileAddByDiagDir(tile, ReverseDiagDir(tunnel_dir))) & DiagDirToRoadBits(tunnel_dir))) return false;
|
||||||
|
|
||||||
const int delta = TileOffsByDiagDir(tunnel_dir);
|
const TileIndexDiff delta = TileOffsByDiagDir(tunnel_dir);
|
||||||
int max_tunnel_length = 0;
|
int max_tunnel_length = 0;
|
||||||
|
|
||||||
/* There are two conditions for building tunnels: Under a mountain and under an obstruction. */
|
/* There are two conditions for building tunnels: Under a mountain and under an obstruction. */
|
||||||
|
|
|
@ -302,7 +302,7 @@ static CommandCost DoBuildLock(TileIndex tile, DiagDirection dir, DoCommandFlag
|
||||||
{
|
{
|
||||||
CommandCost cost(EXPENSES_CONSTRUCTION);
|
CommandCost cost(EXPENSES_CONSTRUCTION);
|
||||||
|
|
||||||
int delta = TileOffsByDiagDir(dir);
|
TileIndexDiff delta = TileOffsByDiagDir(dir);
|
||||||
CommandCost ret = EnsureNoVehicleOnGround(tile);
|
CommandCost ret = EnsureNoVehicleOnGround(tile);
|
||||||
if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile + delta);
|
if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile + delta);
|
||||||
if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile - delta);
|
if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile - delta);
|
||||||
|
|
Loading…
Reference in New Issue