* Loads cargo onto a vehicle. If the vehicle has reserved cargo load that. * Otherwise load cargo from the station. * @param max_move Amount of cargo to load. * @param dest Vehicle cargo list where the cargo resides. * @param next_station Next station(s) the loading vehicle will visit. * @param current_tile Current tile the cargo handling is happening on. * @return Amount of cargo actually l
| 832 | * need to load unreserved cargo. |
| 833 | */ |
| 834 | uint StationCargoList::Load(uint max_move, VehicleCargoList *dest, std::span<const StationID> next_station, TileIndex current_tile) |
| 835 | { |
| 836 | uint move = std::min(dest->ActionCount(VehicleCargoList::MTA_LOAD), max_move); |
| 837 | if (move > 0) { |
| 838 | this->reserved_count -= move; |
| 839 | dest->Reassign<VehicleCargoList::MTA_LOAD, VehicleCargoList::MTA_KEEP>(move); |
| 840 | return move; |
| 841 | } else { |
| 842 | return this->ShiftCargo(CargoLoad{this, dest, max_move, current_tile}, next_station, true); |
| 843 | } |
| 844 | } |
| 845 | |
| 846 | /** |
| 847 | * Routes packets with station "avoid" as next hop to a different place. |
nothing calls this directly
no test coverage detected