summaryrefslogtreecommitdiff
path: root/src/script/api
diff options
context:
space:
mode:
authorglx22 <glx@openttd.org>2020-12-27 00:13:56 +0100
committerCharles Pigott <charlespigott@googlemail.com>2020-12-27 10:28:46 +0000
commitd8605ad18da2a00fceb72b38325374b341ac6f16 (patch)
tree8a6d33a6e57c2bc6a51cfe18443510c3b6a7bdbe /src/script/api
parent1478fa93b344fc25000725dd143109e4def24f0b (diff)
downloadopenttd-d8605ad18da2a00fceb72b38325374b341ac6f16.tar.xz
Codechange: Replace FOR_VEHICLE_ORDERS with range-based for loops
Diffstat (limited to 'src/script/api')
-rw-r--r--src/script/api/script_vehiclelist.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/script/api/script_vehiclelist.cpp b/src/script/api/script_vehiclelist.cpp
index 58c03ff9a..3a4d2d135 100644
--- a/src/script/api/script_vehiclelist.cpp
+++ b/src/script/api/script_vehiclelist.cpp
@@ -31,9 +31,7 @@ ScriptVehicleList_Station::ScriptVehicleList_Station(StationID station_id)
for (const Vehicle *v : Vehicle::Iterate()) {
if ((v->owner == ScriptObject::GetCompany() || ScriptObject::GetCompany() == OWNER_DEITY) && v->IsPrimaryVehicle()) {
- const Order *order;
-
- FOR_VEHICLE_ORDERS(v, order) {
+ for (const Order *order : v->Orders()) {
if ((order->IsType(OT_GOTO_STATION) || order->IsType(OT_GOTO_WAYPOINT)) && order->GetDestination() == station_id) {
this->AddItem(v->index);
break;
@@ -81,9 +79,7 @@ ScriptVehicleList_Depot::ScriptVehicleList_Depot(TileIndex tile)
for (const Vehicle *v : Vehicle::Iterate()) {
if ((v->owner == ScriptObject::GetCompany() || ScriptObject::GetCompany() == OWNER_DEITY) && v->IsPrimaryVehicle() && v->type == type) {
- const Order *order;
-
- FOR_VEHICLE_ORDERS(v, order) {
+ for (const Order *order : v->Orders()) {
if (order->IsType(OT_GOTO_DEPOT) && order->GetDestination() == dest) {
this->AddItem(v->index);
break;