summaryrefslogtreecommitdiff
path: root/src/cargopacket.cpp
diff options
context:
space:
mode:
authorfonsinchen <fonsinchen@openttd.org>2013-06-23 08:28:53 +0000
committerfonsinchen <fonsinchen@openttd.org>2013-06-23 08:28:53 +0000
commit3dd811e1794bc9247d5ace0bad7ade5998a7b54f (patch)
tree61c77b60ec755ead4784c34bc8dcc0310e9b786e /src/cargopacket.cpp
parent57e5a95b6fc9cc0882c08dea75d4d5d35c96d45a (diff)
downloadopenttd-3dd811e1794bc9247d5ace0bad7ade5998a7b54f.tar.xz
(svn r25434) -Fix: reroute cargo staged for unloading if a link breaks
Diffstat (limited to 'src/cargopacket.cpp')
-rw-r--r--src/cargopacket.cpp17
1 files changed, 16 insertions, 1 deletions
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);
}
/*