summaryrefslogtreecommitdiff
path: root/src/linkgraph
diff options
context:
space:
mode:
authorfonsinchen <fonsinchen@openttd.org>2013-11-10 15:18:49 +0000
committerfonsinchen <fonsinchen@openttd.org>2013-11-10 15:18:49 +0000
commit962d6d7e4877b5d1fd8717bb08d79f1d6689a934 (patch)
tree37721d24de5707fdf51ab41017ba94bab6dd30a8 /src/linkgraph
parent9b68e4f8644a2750d537a7cbc474914aea4944ef (diff)
downloadopenttd-962d6d7e4877b5d1fd8717bb08d79f1d6689a934.tar.xz
(svn r25963) -Fix [FS#5758]: Mixtures of old and new flows could create cycles.
Diffstat (limited to 'src/linkgraph')
-rw-r--r--src/linkgraph/linkgraphjob.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/linkgraph/linkgraphjob.cpp b/src/linkgraph/linkgraphjob.cpp
index b6c1747a2..717a7305d 100644
--- a/src/linkgraph/linkgraphjob.cpp
+++ b/src/linkgraph/linkgraphjob.cpp
@@ -72,7 +72,11 @@ LinkGraphJob::~LinkGraphJob()
st2->goods[this->Cargo()].node != it->first ||
(*lg)[node_id][it->first].LastUpdate() == INVALID_DATE) {
/* Edge has been removed. Delete flows. */
- flows.DeleteFlows(to);
+ StationIDStack erased = flows.DeleteFlows(to);
+ /* Delete old flows for source stations which have been deleted
+ * from the new flows. This avoids flow cycles between old and
+ * new flows. */
+ while (!erased.IsEmpty()) ge.flows.erase(erased.Pop());
} else if ((*lg)[node_id][it->first].LastUnrestrictedUpdate() == INVALID_DATE) {
/* Edge is fully restricted. */
flows.RestrictFlows(to);