Reduce duplication when iterating shared orders for departure board
This commit is contained in:
@@ -164,11 +164,12 @@ protected:
|
|||||||
CompanyMask companies = 0;
|
CompanyMask companies = 0;
|
||||||
int unitnumber_max[4] = { -1, -1, -1, -1 };
|
int unitnumber_max[4] = { -1, -1, -1, -1 };
|
||||||
|
|
||||||
for (const Vehicle *v : Vehicle::IterateFrontOnly()) {
|
for (const Vehicle *veh : Vehicle::IterateFrontOnly()) {
|
||||||
if (v->type < 4 && this->show_types[v->type] && v->IsPrimaryVehicle()) {
|
if (veh->type < 4 && this->show_types[veh->type] && veh->IsPrimaryVehicle() && veh == veh->FirstShared()) {
|
||||||
for(const Order *order : v->Orders()) {
|
for (const Order *order : veh->Orders()) {
|
||||||
if ((order->IsType(OT_GOTO_STATION) || order->IsType(OT_GOTO_WAYPOINT) || order->IsType(OT_IMPLICIT))
|
if ((order->IsType(OT_GOTO_STATION) || order->IsType(OT_GOTO_WAYPOINT) || order->IsType(OT_IMPLICIT))
|
||||||
&& order->GetDestination() == this->station) {
|
&& order->GetDestination() == this->station) {
|
||||||
|
for (const Vehicle *v = veh; v != nullptr; v = v->NextShared()) {
|
||||||
this->vehicles.push_back(v);
|
this->vehicles.push_back(v);
|
||||||
|
|
||||||
if (_settings_client.gui.departure_show_vehicle) {
|
if (_settings_client.gui.departure_show_vehicle) {
|
||||||
@@ -188,6 +189,7 @@ protected:
|
|||||||
if (_settings_client.gui.departure_show_company) {
|
if (_settings_client.gui.departure_show_company) {
|
||||||
SetBit(companies, v->owner);
|
SetBit(companies, v->owner);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user