* Returns the weight of the engine for display purposes. * For dual-headed train-engines this is the weight of both heads * @return weight in display units metric tons */
| 405 | * @return weight in display units metric tons |
| 406 | */ |
| 407 | uint Engine::GetDisplayWeight() const |
| 408 | { |
| 409 | /* Only trains and road vehicles have 'weight'. */ |
| 410 | switch (this->type) { |
| 411 | case VEH_TRAIN: |
| 412 | return GetEngineProperty(this->index, PROP_TRAIN_WEIGHT, this->VehInfo<RailVehicleInfo>().weight) << (this->VehInfo<RailVehicleInfo>().railveh_type == RAILVEH_MULTIHEAD ? 1 : 0); |
| 413 | case VEH_ROAD: |
| 414 | return GetEngineProperty(this->index, PROP_ROADVEH_WEIGHT, this->VehInfo<RoadVehicleInfo>().weight) / 4; |
| 415 | |
| 416 | default: NOT_REACHED(); |
| 417 | } |
| 418 | } |
| 419 | |
| 420 | /** |
| 421 | * Returns the tractive effort of the engine for display purposes. |
no test coverage detected