1
0
Fork 0

Codefix: use actual type instead of int for TileIndexDiff

pull/13015/head
Rubidium 2024-10-18 16:10:05 +02:00 committed by rubidium42
parent 3105f6391c
commit 3b0fcf442f
2 changed files with 4 additions and 4 deletions

View File

@ -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)
{
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
RoadBits rcmd = DiagDirToRoadBits(ReverseDiagDir(road_dir));
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
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
* 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 */
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;
/* There are two conditions for building tunnels: Under a mountain and under an obstruction. */

View File

@ -302,7 +302,7 @@ static CommandCost DoBuildLock(TileIndex tile, DiagDirection dir, DoCommandFlag
{
CommandCost cost(EXPENSES_CONSTRUCTION);
int delta = TileOffsByDiagDir(dir);
TileIndexDiff delta = TileOffsByDiagDir(dir);
CommandCost ret = EnsureNoVehicleOnGround(tile);
if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile + delta);
if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile - delta);