diff options
author | Nicolas Chappe <74881848+nchappe@users.noreply.github.com> | 2021-07-24 11:07:10 +0200 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2021-08-17 14:57:59 +0200 |
commit | 977604ef08212cc93653eaa8187ab64ebe72e7d2 (patch) | |
tree | 5aa86c084ebee29497147fa8008855acf572977b /src/vehicle.cpp | |
parent | 6acf204d14343e67fdc01ae8c52044d0de20bbd2 (diff) | |
download | openttd-977604ef08212cc93653eaa8187ab64ebe72e7d2.tar.xz |
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.
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r-- | src/vehicle.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 955f9bde0..6df16caf6 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -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); |