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

Method GetPower

src/engine.cpp:389–400  ·  view source on GitHub ↗

* Returns the power of the engine for display * and sorting purposes. * Only trains and road vehicles have power * @return power in display units hp */

Source from the content-addressed store, hash-verified

387 * @return power in display units hp
388 */
389uint Engine::GetPower() const
390{
391 /* Only trains and road vehicles have 'power'. */
392 switch (this->type) {
393 case VEH_TRAIN:
394 return GetEngineProperty(this->index, PROP_TRAIN_POWER, this->VehInfo<RailVehicleInfo>().power);
395 case VEH_ROAD:
396 return GetEngineProperty(this->index, PROP_ROADVEH_POWER, this->VehInfo<RoadVehicleInfo>().power) * 10;
397
398 default: NOT_REACHED();
399 }
400}
401
402/**
403 * Returns the weight of the engine for display purposes.

Callers 8

PowerChangedMethod · 0.45
GetTrainEngineInfoStringFunction · 0.45
EnginePowerSorterFunction · 0.45
CargoAndEngineFilterFunction · 0.45
DrawRoadVehPurchaseInfoFunction · 0.45

Calls 2

GetEnginePropertyFunction · 0.85
NOT_REACHEDFunction · 0.85

Tested by

no test coverage detected