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.
This commit is contained in:
Nicolas Chappe
2021-07-24 11:07:10 +02:00
committed by Michael Lutz
parent 6acf204d14
commit 977604ef08
9 changed files with 71 additions and 24 deletions

View File

@@ -2100,6 +2100,7 @@ void Vehicle::BeginLoading()
{
assert(IsTileType(this->tile, MP_STATION) || this->type == VEH_SHIP);
uint32 travel_time = this->current_order_time;
if (this->current_order.IsType(OT_GOTO_STATION) &&
this->current_order.GetDestination() == this->last_station_visited) {
this->DeleteUnreachedImplicitOrders();
@@ -2206,7 +2207,7 @@ void Vehicle::BeginLoading()
this->last_loading_station != this->last_station_visited &&
((this->current_order.GetLoadType() & OLFB_NO_LOAD) == 0 ||
(this->current_order.GetUnloadType() & OUFB_NO_UNLOAD) == 0)) {
IncreaseStats(Station::Get(this->last_loading_station), this, this->last_station_visited);
IncreaseStats(Station::Get(this->last_loading_station), this, this->last_station_visited, travel_time);
}
PrepareUnload(this);