From 3dd811e1794bc9247d5ace0bad7ade5998a7b54f Mon Sep 17 00:00:00 2001 From: fonsinchen Date: Sun, 23 Jun 2013 08:28:53 +0000 Subject: (svn r25434) -Fix: reroute cargo staged for unloading if a link breaks --- src/cargopacket.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/cargopacket.cpp') diff --git a/src/cargopacket.cpp b/src/cargopacket.cpp index e2e7e4e4d..22be361e3 100644 --- a/src/cargopacket.cpp +++ b/src/cargopacket.cpp @@ -580,6 +580,21 @@ uint VehicleCargoList::Truncate(uint max_move) return max_move; } +/** + * Routes packets with station "avoid" as next hop to a different place. + * @param max_move Maximum amount of cargo to move. + * @param dest List to prepend the cargo to. + * @param avoid Station to exclude from routing and current next hop of packets to reroute. + * @param avoid2 Additional station to exclude from routing. + * @oaram ge GoodsEntry to get the routing info from. + */ +uint VehicleCargoList::Reroute(uint max_move, VehicleCargoList *dest, StationID avoid, StationID avoid2, const GoodsEntry *ge) +{ + max_move = min(this->action_counts[MTA_TRANSFER], max_move); + this->ShiftCargo(VehicleCargoReroute(this, dest, max_move, avoid, avoid2, ge)); + return max_move; +} + /* * * Station cargo list implementation. @@ -759,7 +774,7 @@ uint StationCargoList::Load(uint max_move, VehicleCargoList *dest, TileIndex loa */ uint StationCargoList::Reroute(uint max_move, StationCargoList *dest, StationID avoid, StationID avoid2, const GoodsEntry *ge) { - return this->ShiftCargo(CargoReroute(this, dest, max_move, avoid, avoid2, ge), avoid, false); + return this->ShiftCargo(StationCargoReroute(this, dest, max_move, avoid, avoid2, ge), avoid, false); } /* -- cgit v1.2.3-70-g09d2