(svn r25361) -Feature: distribute cargo according to plan given by linkgraph

This commit is contained in:
fonsinchen
2013-06-09 13:03:48 +00:00
parent a2ff96d682
commit 04e3eb6fab
16 changed files with 586 additions and 206 deletions

View File

@@ -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()) {