summaryrefslogtreecommitdiff
path: root/src/linkgraph
diff options
context:
space:
mode:
authorfonsinchen <fonsinchen@openttd.org>2013-07-30 19:03:56 +0000
committerfonsinchen <fonsinchen@openttd.org>2013-07-30 19:03:56 +0000
commitca1c79214475c5d3acc0f69fb70b44347dc29b57 (patch)
treedfb014867c9858b67c645f64b48f8de26e06b447 /src/linkgraph
parent456627e01c4c4ba13aaecc6e194a8628bbd26a85 (diff)
downloadopenttd-ca1c79214475c5d3acc0f69fb70b44347dc29b57.tar.xz
(svn r25637) -Fix: don't keep minimal routing information if automatic distribution has been disabled
Diffstat (limited to 'src/linkgraph')
-rw-r--r--src/linkgraph/linkgraphjob.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/linkgraph/linkgraphjob.cpp b/src/linkgraph/linkgraphjob.cpp
index 4f583e04a..dcdc7ba36 100644
--- a/src/linkgraph/linkgraphjob.cpp
+++ b/src/linkgraph/linkgraphjob.cpp
@@ -74,14 +74,21 @@ LinkGraphJob::~LinkGraphJob()
/* Swap shares and invalidate ones that are completely deleted. Don't
* really delete them as we could then end up with unroutable cargo
- * somewhere. */
- for (FlowStatMap::iterator it(ge.flows.begin()); it != ge.flows.end(); ++it) {
+ * somewhere. Do delete them if automatic distribution has been turned
+ * off for that cargo, though. */
+ for (FlowStatMap::iterator it(ge.flows.begin()); it != ge.flows.end();) {
FlowStatMap::iterator new_it = flows.find(it->first);
if (new_it == flows.end()) {
- it->second.Invalidate();
+ if (_settings_game.linkgraph.GetDistributionType(this->Cargo()) != DT_MANUAL) {
+ it->second.Invalidate();
+ ++it;
+ } else {
+ ge.flows.erase(it++);
+ }
} else {
it->second.SwapShares(new_it->second);
flows.erase(new_it);
+ ++it;
}
}
ge.flows.insert(flows.begin(), flows.end());