Codechange: Define INVALID_TOWN as a TownID (#7044)

This commit is contained in:
Joan Josep
2019-01-13 00:20:10 +01:00
committed by Charles Pigott
parent 96854b2b8b
commit 9aecbac2b4
3 changed files with 5 additions and 5 deletions

View File

@@ -333,7 +333,7 @@ static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits piec
if (rt == ROADTYPE_ROAD && IsRoadOwner(tile, ROADTYPE_ROAD, OWNER_TOWN)) {
/* Update nearest-town index */
const Town *town = CalcClosestTownFromTile(tile);
SetTownIndex(tile, town == NULL ? (TownID)INVALID_TOWN : town->index);
SetTownIndex(tile, town == NULL ? INVALID_TOWN : town->index);
}
SetRoadBits(tile, ROAD_NONE, rt);
SetRoadTypes(tile, rts);
@@ -494,7 +494,7 @@ CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
if ((Company::IsValidID(company) && p2 != 0) || (company == OWNER_TOWN && !Town::IsValidID(p2)) || (company == OWNER_DEITY && p2 != 0)) return CMD_ERROR;
if (company != OWNER_TOWN) {
const Town *town = CalcClosestTownFromTile(tile);
p2 = (town != NULL) ? town->index : (TownID)INVALID_TOWN;
p2 = (town != NULL) ? town->index : INVALID_TOWN;
if (company == OWNER_DEITY) {
company = OWNER_TOWN;
@@ -1444,7 +1444,7 @@ void UpdateNearestTownForRoadTiles(bool invalidate)
for (TileIndex t = 0; t < MapSize(); t++) {
if (IsTileType(t, MP_ROAD) && !IsRoadDepot(t) && !HasTownOwnedRoad(t)) {
TownID tid = (TownID)INVALID_TOWN;
TownID tid = INVALID_TOWN;
if (!invalidate) {
const Town *town = CalcClosestTownFromTile(t);
if (town != NULL) tid = town->index;