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/station_cmd.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/station_cmd.cpp') diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 0ac50d2eb..2335d8151 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -3402,7 +3402,17 @@ void DeleteStaleLinks(Station *from) (DistanceManhattan(from->xy, to->xy) >> 2)) { node.RemoveEdge(to->goods[c].node); ge.flows.DeleteFlows(to->index); + + /* Reroute cargo in station. */ ge.cargo.Reroute(UINT_MAX, &ge.cargo, to->index, from->index, &ge); + + /* Reroute cargo staged to be transfered. */ + for (std::list::iterator it(from->loading_vehicles.begin()); it != from->loading_vehicles.end(); ++it) { + for (Vehicle *v = *it; v != NULL; v = v->Next()) { + if (v->cargo_type != c) continue; + v->cargo.Reroute(UINT_MAX, &v->cargo, to->index, from->index, &ge); + } + } } } assert(_date >= lg->LastCompression()); -- cgit v1.2.3-54-g00ecf