summaryrefslogtreecommitdiff
path: root/src/linkgraph/mcf.cpp
diff options
context:
space:
mode:
authorfonsinchen <fonsinchen@openttd.org>2014-06-14 13:35:39 +0000
committerfonsinchen <fonsinchen@openttd.org>2014-06-14 13:35:39 +0000
commit957f5ca11758d556763881d04ced39cd34c470c1 (patch)
tree03a1c5061a2d4466526f39b637a0967333a5591f /src/linkgraph/mcf.cpp
parente8e5cdde034dcf5c3874790b5a9cd67ad300ee9d (diff)
downloadopenttd-957f5ca11758d556763881d04ced39cd34c470c1.tar.xz
(svn r26646) -Fix [FS#6041]: Save locations instead of distances in link graphs to reduce size.
Diffstat (limited to 'src/linkgraph/mcf.cpp')
-rw-r--r--src/linkgraph/mcf.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/linkgraph/mcf.cpp b/src/linkgraph/mcf.cpp
index 3163ec9e3..81d4d6d38 100644
--- a/src/linkgraph/mcf.cpp
+++ b/src/linkgraph/mcf.cpp
@@ -259,7 +259,6 @@ void MultiCommodityFlow::Dijkstra(NodeID source_node, PathVector &paths)
for (NodeID to = iter.Next(); to != INVALID_NODE; to = iter.Next()) {
if (to == from) continue; // Not a real edge but a consumption sign.
Edge edge = this->job[from][to];
- assert(edge.Distance() < UINT_MAX);
uint capacity = edge.Capacity();
if (this->max_saturation != UINT_MAX) {
capacity *= this->max_saturation;
@@ -267,7 +266,7 @@ void MultiCommodityFlow::Dijkstra(NodeID source_node, PathVector &paths)
if (capacity == 0) capacity = 1;
}
/* punish in-between stops a little */
- uint distance = edge.Distance() + 1;
+ uint distance = DistanceMaxPlusManhattan(this->job[from].XY(), this->job[to].XY()) + 1;
Tannotation *dest = static_cast<Tannotation *>(paths[to]);
if (dest->IsBetter(source, capacity, capacity - edge.Flow(), distance)) {
annos.erase(dest);