Scale link graph timeout and compression intervals by day length.
This commit is contained in:
@@ -3570,7 +3570,7 @@ void DeleteStaleLinks(Station *from)
|
|||||||
assert(to->goods[c].node == it->first);
|
assert(to->goods[c].node == it->first);
|
||||||
++it; // Do that before removing the edge. Anything else may crash.
|
++it; // Do that before removing the edge. Anything else may crash.
|
||||||
assert(_date >= edge.LastUpdate());
|
assert(_date >= edge.LastUpdate());
|
||||||
uint timeout = LinkGraph::MIN_TIMEOUT_DISTANCE + (DistanceManhattan(from->xy, to->xy) >> 3);
|
uint timeout = max<uint>((LinkGraph::MIN_TIMEOUT_DISTANCE + (DistanceManhattan(from->xy, to->xy) >> 3)) / _settings_game.economy.day_length_factor, 1);
|
||||||
if ((uint)(_date - edge.LastUpdate()) > timeout) {
|
if ((uint)(_date - edge.LastUpdate()) > timeout) {
|
||||||
/* Have all vehicles refresh their next hops before deciding to
|
/* Have all vehicles refresh their next hops before deciding to
|
||||||
* remove the node. */
|
* remove the node. */
|
||||||
@@ -3617,7 +3617,7 @@ void DeleteStaleLinks(Station *from)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(_date >= lg->LastCompression());
|
assert(_date >= lg->LastCompression());
|
||||||
if ((uint)(_date - lg->LastCompression()) > LinkGraph::COMPRESSION_INTERVAL) {
|
if ((uint)(_date - lg->LastCompression()) > max<uint>(LinkGraph::COMPRESSION_INTERVAL / _settings_game.economy.day_length_factor, 1)) {
|
||||||
lg->Compress();
|
lg->Compress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user