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

Function GetAvailableVehicleCargoTypes

src/articulated_vehicles.cpp:117–129  ·  view source on GitHub ↗

* Returns all cargoes a vehicle can carry. * @param engine the EngineID of interest * @param include_initial_cargo_type if true the default cargo type of the vehicle is included; if false only the refit_mask * @return bit set of CargoTypes */

Source from the content-addressed store, hash-verified

115 * @return bit set of CargoTypes
116 */
117static inline CargoTypes GetAvailableVehicleCargoTypes(EngineID engine, bool include_initial_cargo_type)
118{
119 const Engine *e = Engine::Get(engine);
120 if (!e->CanCarryCargo()) return 0;
121
122 CargoTypes cargoes = e->info.refit_mask;
123
124 if (include_initial_cargo_type) {
125 SetBit(cargoes, e->GetDefaultCargoType());
126 }
127
128 return cargoes;
129}
130
131/**
132 * Get the capacity of the parts of a given engine.

Callers 2

GetArticulatedRefitMasksFunction · 0.85

Calls 3

SetBitFunction · 0.85
CanCarryCargoMethod · 0.80
GetDefaultCargoTypeMethod · 0.80

Tested by

no test coverage detected