Scale link graph timeout and compression intervals by day length.

This commit is contained in:
Jonathan G Rennison
2015-09-12 18:51:15 +01:00
parent 361b8b4540
commit 58dbc8fbd6

View File

@@ -3570,7 +3570,7 @@ void DeleteStaleLinks(Station *from)
assert(to->goods[c].node == it->first);
++it; // Do that before removing the edge. Anything else may crash.
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) {
/* Have all vehicles refresh their next hops before deciding to
* remove the node. */
@@ -3617,7 +3617,7 @@ void DeleteStaleLinks(Station *from)
}
}
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();
}
}