mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Iterate group vehicle lists for SettingsDisableElrail
parent
71e96fd8a6
commit
f786477c6d
|
@ -625,10 +625,13 @@ void SettingsDisableElrail(int32_t new_value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fix the total power and acceleration for trains */
|
for (const Company *c : Company::Iterate()) {
|
||||||
for (Train *t : Train::Iterate()) {
|
/* Fix the total power and acceleration for trains.
|
||||||
/* power and acceleration is cached only for front engines */
|
* These values are only cached for front engines which
|
||||||
if (t->IsFrontEngine()) {
|
* is what the collection enumerates. */
|
||||||
|
const VehicleList &vehicle_list = c->group_all[VEH_TRAIN].vehicle_list;
|
||||||
|
for (const Vehicle *v : vehicle_list) {
|
||||||
|
Train *t = Train::From(Vehicle::Get(v->index));
|
||||||
t->ConsistChanged(CCF_TRACK);
|
t->ConsistChanged(CCF_TRACK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue