* Returns max speed of the engine for display purposes * @return max speed in km-ish/h */
| 355 | * @return max speed in km-ish/h |
| 356 | */ |
| 357 | uint Engine::GetDisplayMaxSpeed() const |
| 358 | { |
| 359 | switch (this->type) { |
| 360 | case VEH_TRAIN: |
| 361 | return GetEngineProperty(this->index, PROP_TRAIN_SPEED, this->VehInfo<RailVehicleInfo>().max_speed); |
| 362 | |
| 363 | case VEH_ROAD: { |
| 364 | uint max_speed = GetEngineProperty(this->index, PROP_ROADVEH_SPEED, 0); |
| 365 | return (max_speed != 0) ? max_speed * 2 : this->VehInfo<RoadVehicleInfo>().max_speed / 2; |
| 366 | } |
| 367 | |
| 368 | case VEH_SHIP: |
| 369 | return GetEngineProperty(this->index, PROP_SHIP_SPEED, this->VehInfo<ShipVehicleInfo>().max_speed) / 2; |
| 370 | |
| 371 | case VEH_AIRCRAFT: { |
| 372 | uint max_speed = GetEngineProperty(this->index, PROP_AIRCRAFT_SPEED, 0); |
| 373 | if (max_speed != 0) { |
| 374 | return (max_speed * 128) / 10; |
| 375 | } |
| 376 | return this->VehInfo<AircraftVehicleInfo>().max_speed; |
| 377 | } |
| 378 | |
| 379 | default: NOT_REACHED(); |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | /** |
| 384 | * Returns the power of the engine for display |
no test coverage detected