Feature: [Linkgraph] Prioritize faster routes for passengers, mail and express cargo

Passengers usually prefer fast paths to short paths.
Average travel times of links are updated in real-time for use in Dijkstra's algorithm,
and newer travel times weigh more, just like capacities.

(cherry picked from commit 977604ef08)
This commit is contained in:
Nicolas Chappe
2021-07-24 10:07:10 +01:00
committed by Jonathan G Rennison
parent 1518c2fa1e
commit a43a1902bb
11 changed files with 82 additions and 26 deletions

View File

@@ -4499,7 +4499,7 @@ void DeleteStaleLinks(Station *from)
* @param usage Usage to add to link stat.
* @param mode Update mode to be applied.
*/
void IncreaseStats(Station *st, CargoID cargo, StationID next_station_id, uint capacity, uint usage, EdgeUpdateMode mode)
void IncreaseStats(Station *st, CargoID cargo, StationID next_station_id, uint capacity, uint usage, uint32 time, EdgeUpdateMode mode)
{
GoodsEntry &ge1 = st->goods[cargo];
Station *st2 = Station::Get(next_station_id);
@@ -4541,7 +4541,7 @@ void IncreaseStats(Station *st, CargoID cargo, StationID next_station_id, uint c
}
}
if (lg != nullptr) {
(*lg)[ge1.node].UpdateEdge(ge2.node, capacity, usage, mode);
(*lg)[ge1.node].UpdateEdge(ge2.node, capacity, usage, time, mode);
}
}