Feature: Display power-to-weight ratio in ground vehicle details GUI
This commit is contained in:
committed by
Michael Lutz
parent
b304c06a4a
commit
59dbcdb5ba
@@ -4119,3 +4119,20 @@ Trackdir Train::GetVehicleTrackdir() const
|
||||
|
||||
return TrackDirectionToTrackdir(FindFirstTrack(this->track), this->direction);
|
||||
}
|
||||
|
||||
uint16 Train::GetMaxWeight() const
|
||||
{
|
||||
uint16 weight = CargoSpec::Get(this->cargo_type)->WeightOfNUnitsInTrain(this->GetEngine()->DetermineCapacity(this));
|
||||
|
||||
/* Vehicle weight is not added for articulated parts. */
|
||||
if (!this->IsArticulatedPart()) {
|
||||
weight += GetVehicleProperty(this, PROP_TRAIN_WEIGHT, RailVehInfo(this->engine_type)->weight);
|
||||
}
|
||||
|
||||
/* Powered wagons have extra weight added. */
|
||||
if (HasBit(this->flags, VRF_POWEREDWAGON)) {
|
||||
weight += RailVehInfo(this->gcache.first_engine)->pow_wag_weight;
|
||||
}
|
||||
|
||||
return weight;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user