Codechange: Replace FOR_ALL_ROADTRAMTYPES with range-based for loops

This commit is contained in:
glx22
2021-04-30 17:01:26 +02:00
committed by Loïc Guilloux
parent 983c7ade60
commit 2feb801e56
6 changed files with 12 additions and 12 deletions

View File

@@ -1238,7 +1238,7 @@ static CommandCost ClearTile_Road(TileIndex tile, DoCommandFlag flags)
/* Clear the road if only one piece is on the tile OR we are not using the DC_AUTO flag */
if ((HasExactlyOneBit(b) && GetRoadBits(tile, RTT_TRAM) == ROAD_NONE) || !(flags & DC_AUTO)) {
CommandCost ret(EXPENSES_CONSTRUCTION);
FOR_ALL_ROADTRAMTYPES(rtt) {
for (RoadTramType rtt : _roadtramtypes) {
if (!MayHaveRoad(tile) || GetRoadType(tile, rtt) == INVALID_ROADTYPE) continue;
CommandCost tmp_ret = RemoveRoad(tile, flags, GetRoadBits(tile, rtt), rtt, true);
@@ -2203,7 +2203,7 @@ static void ChangeTileOwner_Road(TileIndex tile, Owner old_owner, Owner new_owne
Company::Get(new_owner)->infrastructure.road[rt] += 2;
SetTileOwner(tile, new_owner);
FOR_ALL_ROADTRAMTYPES(rtt) {
for (RoadTramType rtt : _roadtramtypes) {
if (GetRoadOwner(tile, rtt) == old_owner) {
SetRoadOwner(tile, rtt, new_owner);
}
@@ -2213,7 +2213,7 @@ static void ChangeTileOwner_Road(TileIndex tile, Owner old_owner, Owner new_owne
return;
}
FOR_ALL_ROADTRAMTYPES(rtt) {
for (RoadTramType rtt : _roadtramtypes) {
/* Update all roadtypes, no matter if they are present */
if (GetRoadOwner(tile, rtt) == old_owner) {
RoadType rt = GetRoadType(tile, rtt);