static */
| 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 | { |