summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authorfonsinchen <fonsinchen@openttd.org>2013-06-09 13:02:40 +0000
committerfonsinchen <fonsinchen@openttd.org>2013-06-09 13:02:40 +0000
commit5c8ff0a251342f7c7dd87a2d37ebe587ea54aba1 (patch)
treefeeb2f9b938fceae8a1fbb75e5e42e0f3c4d362b /src/station_cmd.cpp
parent3d0a0e8e48f1de9106628a11ed08fa0b71b961b4 (diff)
downloadopenttd-5c8ff0a251342f7c7dd87a2d37ebe587ea54aba1.tar.xz
(svn r25359) -Codechange: schedule jobs when tracking capacities of links
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 7fdef90de..6ef992caa 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -3397,6 +3397,7 @@ void IncreaseStats(Station *st, CargoID cargo, StationID next_station_id, uint c
if (ge2.link_graph == INVALID_LINK_GRAPH) {
if (LinkGraph::CanAllocateItem()) {
lg = new LinkGraph(cargo);
+ LinkGraphSchedule::Instance()->Queue(lg);
ge2.link_graph = lg->index;
ge2.node = lg->AddNode(st2);
} else {
@@ -3418,9 +3419,11 @@ void IncreaseStats(Station *st, CargoID cargo, StationID next_station_id, uint c
if (ge1.link_graph != ge2.link_graph) {
LinkGraph *lg2 = LinkGraph::Get(ge2.link_graph);
if (lg->Size() < lg2->Size()) {
+ LinkGraphSchedule::Instance()->Unqueue(lg);
lg2->Merge(lg); // Updates GoodsEntries of lg
lg = lg2;
} else {
+ LinkGraphSchedule::Instance()->Unqueue(lg2);
lg->Merge(lg2); // Updates GoodsEntries of lg2
}
}
@@ -3541,6 +3544,7 @@ static uint UpdateStationWaiting(Station *st, CargoID type, uint amount, SourceT
if (ge.link_graph == INVALID_LINK_GRAPH) {
if (LinkGraph::CanAllocateItem()) {
lg = new LinkGraph(type);
+ LinkGraphSchedule::Instance()->Queue(lg);
ge.link_graph = lg->index;
ge.node = lg->AddNode(st);
} else {