MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / TrainAccelerationModelChanged

Function TrainAccelerationModelChanged

src/settings_table.cpp:312–325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

310}
311
312static void TrainAccelerationModelChanged(int32_t)
313{
314 for (Train *t : Train::Iterate()) {
315 if (t->IsFrontEngine()) {
316 t->tcache.cached_max_curve_speed = t->GetCurveSpeedLimit();
317 t->UpdateAcceleration();
318 }
319 }
320
321 /* These windows show acceleration values only when realistic acceleration is on. They must be redrawn after a setting change. */
322 SetWindowClassesDirty(WC_ENGINE_PREVIEW);
323 InvalidateWindowClassesData(WC_BUILD_VEHICLE, 0);
324 SetWindowClassesDirty(WC_VEHICLE_DETAILS);
325}
326
327/**
328 * This function updates the train acceleration cache after a steepness change.

Callers

nothing calls this directly

Calls 5

SetWindowClassesDirtyFunction · 0.85
IsFrontEngineMethod · 0.80
GetCurveSpeedLimitMethod · 0.80
UpdateAccelerationMethod · 0.80

Tested by

no test coverage detected