diff options
author | Nicolas Chappe <74881848+nchappe@users.noreply.github.com> | 2021-08-18 17:06:22 +0200 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2021-08-20 22:37:03 +0200 |
commit | b83820e7238a15b385b5aac51d7f29aef8f30bef (patch) | |
tree | e978f0e9a5c4e6c957273e404072dfd41adcc9fe /src/station_cmd.cpp | |
parent | dd3acccb1b1cea232a6ea37180a8665b4f1016ac (diff) | |
download | openttd-b83820e7238a15b385b5aac51d7f29aef8f30bef.tar.xz |
Change: [Linkgraph] Delete links only served by vehicles stopped in depot
A stale link is not deleted if the link refresher finds a vehicle that still serves it.
This commit excludes vehicles stopped in depot for a very long time from the link refresher,
so that their stale links can be deleted.
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r-- | src/station_cmd.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index e2c232ac7..fa11c05d5 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -3688,8 +3688,11 @@ void DeleteStaleLinks(Station *from) auto iter = vehicles.begin(); while (iter != vehicles.end()) { Vehicle *v = *iter; - - LinkRefresher::Run(v, false); // Don't allow merging. Otherwise lg might get deleted. + /* Do not refresh links of vehicles that have been stopped in depot for a long time. */ + if (!v->IsStoppedInDepot() || static_cast<uint>(_date - v->date_of_last_service) <= + LinkGraph::STALE_LINK_DEPOT_TIMEOUT) { + LinkRefresher::Run(v, false); // Don't allow merging. Otherwise lg might get deleted. + } if (edge.LastUpdate() == _date) { updated = true; break; |