Codechange: Replace FOR_VEHICLE_ORDERS with range-based for loops

This commit is contained in:
glx22
2020-12-27 00:13:56 +01:00
committed by Charles Pigott
parent 1478fa93b3
commit d8605ad18d
11 changed files with 69 additions and 48 deletions

View File

@@ -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;