summaryrefslogtreecommitdiff
path: root/src/station_cmd.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/station_cmd.cpp
parent57e5a95b6fc9cc0882c08dea75d4d5d35c96d45a (diff)
downloadopenttd-3dd811e1794bc9247d5ace0bad7ade5998a7b54f.tar.xz
(svn r25434) -Fix: reroute cargo staged for unloading if a link breaks
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp10
1 files changed, 10 insertions, 0 deletions
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<Vehicle *>::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());