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

Method GetDisplayMaxTractiveEffort

src/engine.cpp:425–436  ·  view source on GitHub ↗

* Returns the tractive effort of the engine for display purposes. * For dual-headed train-engines this is the tractive effort of both heads * @return tractive effort in display units kN */

Source from the content-addressed store, hash-verified

423 * @return tractive effort in display units kN
424 */
425uint Engine::GetDisplayMaxTractiveEffort() const
426{
427 /* Only trains and road vehicles have 'tractive effort'. */
428 switch (this->type) {
429 case VEH_TRAIN:
430 return (GROUND_ACCELERATION * this->GetDisplayWeight() * GetEngineProperty(this->index, PROP_TRAIN_TRACTIVE_EFFORT, this->VehInfo<RailVehicleInfo>().tractive_effort)) / 256;
431 case VEH_ROAD:
432 return (GROUND_ACCELERATION * this->GetDisplayWeight() * GetEngineProperty(this->index, PROP_ROADVEH_TRACTIVE_EFFORT, this->VehInfo<RoadVehicleInfo>().tractive_effort)) / 256;
433
434 default: NOT_REACHED();
435 }
436}
437
438/**
439 * Returns the vehicle's (not model's!) life length in days.

Callers 6

GetTrainEngineInfoStringFunction · 0.80
DrawRoadVehPurchaseInfoFunction · 0.80
GetMaxTractiveEffortMethod · 0.80

Calls 3

GetDisplayWeightMethod · 0.95
GetEnginePropertyFunction · 0.85
NOT_REACHEDFunction · 0.85

Tested by

no test coverage detected