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

Method GetMaxWeight

src/roadveh_cmd.cpp:1775–1786  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1773}
1774
1775uint16_t RoadVehicle::GetMaxWeight() const
1776{
1777 uint16_t weight = CargoSpec::Get(this->cargo_type)->WeightOfNUnits(this->GetEngine()->DetermineCapacity(this));
1778
1779 /* Vehicle weight is not added for articulated parts. */
1780 if (!this->IsArticulatedPart()) {
1781 /* Road vehicle weight is in units of 1/4 t. */
1782 weight += GetVehicleProperty(this, PROP_ROADVEH_WEIGHT, RoadVehInfo(this->engine_type)->weight) / 4;
1783 }
1784
1785 return weight;
1786}

Callers

nothing calls this directly

Calls 6

GetVehiclePropertyFunction · 0.85
RoadVehInfoFunction · 0.85
WeightOfNUnitsMethod · 0.80
DetermineCapacityMethod · 0.80
IsArticulatedPartMethod · 0.80
GetEngineMethod · 0.45

Tested by

no test coverage detected