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

Method GetCapacity

src/script/api/script_vehicle.cpp:415–426  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

413}
414
415/* static */ SQInteger ScriptVehicle::GetCapacity(VehicleID vehicle_id, CargoType cargo)
416{
417 if (!IsValidVehicle(vehicle_id)) return -1;
418 if (!ScriptCargo::IsValidCargo(cargo)) return -1;
419
420 uint32_t amount = 0;
421 for (const Vehicle *v = ::Vehicle::Get(vehicle_id); v != nullptr; v = v->Next()) {
422 if (v->cargo_type == cargo) amount += v->cargo_cap;
423 }
424
425 return amount;
426}
427
428/* static */ SQInteger ScriptVehicle::GetCargoLoad(VehicleID vehicle_id, CargoType cargo)
429{

Callers

nothing calls this directly

Calls 1

NextMethod · 0.45

Tested by

no test coverage detected