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

Function GetVehicleDefaultCapacity

src/articulated_vehicles.cpp:104–109  ·  view source on GitHub ↗

* Returns the default (non-refitted) cargo and capacity of a specific EngineID. * @param engine the EngineID of interest * @return cargo and capacity */

Source from the content-addressed store, hash-verified

102 * @return cargo and capacity
103 */
104static inline std::pair<CargoType, uint16_t> GetVehicleDefaultCapacity(EngineID engine)
105{
106 const Engine *e = Engine::Get(engine);
107 CargoType cargo = e->CanCarryCargo() ? e->GetDefaultCargoType() : INVALID_CARGO;
108 return {cargo, IsValidCargoType(cargo) ? e->GetDisplayDefaultCapacity() : 0};
109}
110
111/**
112 * Returns all cargoes a vehicle can carry.

Callers 2

Calls 4

IsValidCargoTypeFunction · 0.85
CanCarryCargoMethod · 0.80
GetDefaultCargoTypeMethod · 0.80

Tested by

no test coverage detected