* Returns the power of the engine for display * and sorting purposes. * Only trains and road vehicles have power * @return power in display units hp */
| 387 | * @return power in display units hp |
| 388 | */ |
| 389 | uint 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. |
no test coverage detected