summaryrefslogtreecommitdiff
path: root/src/script/api/script_order.cpp
diff options
context:
space:
mode:
authorglx22 <glx@openttd.org>2021-05-12 16:45:28 +0200
committerLoïc Guilloux <glx22@users.noreply.github.com>2021-05-13 00:13:54 +0200
commit38c97e14926f4bc538c20b24f8a3decdef1668f9 (patch)
tree2138fa9979f463c5b946653c23313fbb977be652 /src/script/api/script_order.cpp
parent5bd81448539b63519d70ba85d4833e446f0597fe (diff)
downloadopenttd-38c97e14926f4bc538c20b24f8a3decdef1668f9.tar.xz
Codechange: Replace TILE_AREA_LOOP with range-based for loops
Diffstat (limited to 'src/script/api/script_order.cpp')
-rw-r--r--src/script/api/script_order.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/script/api/script_order.cpp b/src/script/api/script_order.cpp
index 5166c0614..b7bcde730 100644
--- a/src/script/api/script_order.cpp
+++ b/src/script/api/script_order.cpp
@@ -256,11 +256,11 @@ static int ScriptOrderPositionToRealOrderPosition(VehicleID vehicle_id, ScriptOr
case OT_GOTO_STATION: {
const Station *st = ::Station::Get(order->GetDestination());
if (st->train_station.tile != INVALID_TILE) {
- TILE_AREA_LOOP(t, st->train_station) {
+ for (TileIndex t : st->train_station) {
if (st->TileBelongsToRailStation(t)) return t;
}
} else if (st->ship_station.tile != INVALID_TILE) {
- TILE_AREA_LOOP(t, st->ship_station) {
+ for (TileIndex t : st->ship_station) {
if (IsTileType(t, MP_STATION) && (IsDock(t) || IsOilRig(t)) && GetStationIndex(t) == st->index) return t;
}
} else if (st->bus_stops != nullptr) {
@@ -268,7 +268,7 @@ static int ScriptOrderPositionToRealOrderPosition(VehicleID vehicle_id, ScriptOr
} else if (st->truck_stops != nullptr) {
return st->truck_stops->xy;
} else if (st->airport.tile != INVALID_TILE) {
- TILE_AREA_LOOP(tile, st->airport) {
+ for (TileIndex tile : st->airport) {
if (st->TileBelongsToAirport(tile) && !::IsHangar(tile)) return tile;
}
}
@@ -278,7 +278,7 @@ static int ScriptOrderPositionToRealOrderPosition(VehicleID vehicle_id, ScriptOr
case OT_GOTO_WAYPOINT: {
const Waypoint *wp = ::Waypoint::Get(order->GetDestination());
if (wp->train_station.tile != INVALID_TILE) {
- TILE_AREA_LOOP(t, wp->train_station) {
+ for (TileIndex t : wp->train_station) {
if (wp->TileBelongsToRailStation(t)) return t;
}
}