1
0
Fork 0

Codechange: Iterate group vehicle lists for SettingsDisableElrail

pull/10548/head
SamuXarick 2024-01-01 18:10:22 +00:00
parent 71e96fd8a6
commit f786477c6d
1 changed files with 7 additions and 4 deletions

View File

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