summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authorfonsinchen <fonsinchen@openttd.org>2013-06-09 13:03:48 +0000
committerfonsinchen <fonsinchen@openttd.org>2013-06-09 13:03:48 +0000
commit04e3eb6fabc0e4aff04c189368356b8af15e9655 (patch)
treeaa9d6a025fb3e343fc8cdc9358a913182445210b /src/station_cmd.cpp
parenta2ff96d6828bd32f7beb461bfb902880bf46ef75 (diff)
downloadopenttd-04e3eb6fabc0e4aff04c189368356b8af15e9655.tar.xz
(svn r25361) -Feature: distribute cargo according to plan given by linkgraph
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 6ef992caa..d74c20668 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -3370,6 +3370,8 @@ void DeleteStaleLinks(Station *from)
if ((uint)(_date - edge.LastUpdate()) > LinkGraph::MIN_TIMEOUT_DISTANCE +
(DistanceManhattan(from->xy, to->xy) >> 2)) {
node.RemoveEdge(to->goods[c].node);
+ ge.flows.DeleteFlows(to->index);
+ ge.cargo.Reroute(UINT_MAX, &ge.cargo, to->index, from->index, &ge);
}
}
assert(_date >= lg->LastCompression());
@@ -3539,7 +3541,8 @@ static uint UpdateStationWaiting(Station *st, CargoID type, uint amount, SourceT
/* No new "real" cargo item yet. */
if (amount == 0) return 0;
- ge.cargo.Append(new CargoPacket(st->index, st->xy, amount, source_type, source_id));
+ StationID next = ge.GetVia(st->index);
+ ge.cargo.Append(new CargoPacket(st->index, st->xy, amount, source_type, source_id), next);
LinkGraph *lg = NULL;
if (ge.link_graph == INVALID_LINK_GRAPH) {
if (LinkGraph::CanAllocateItem()) {