summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authorNicolas Chappe <74881848+nchappe@users.noreply.github.com>2021-07-24 11:07:10 +0200
committerMichael Lutz <michi@icosahedron.de>2021-08-17 14:57:59 +0200
commit977604ef08212cc93653eaa8187ab64ebe72e7d2 (patch)
tree5aa86c084ebee29497147fa8008855acf572977b /src/station_cmd.cpp
parent6acf204d14343e67fdc01ae8c52044d0de20bbd2 (diff)
downloadopenttd-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/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 6a5cabc8d..05e837287 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -3737,7 +3737,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);
@@ -3779,7 +3779,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);
}
}
@@ -3789,7 +3789,7 @@ void IncreaseStats(Station *st, CargoID cargo, StationID next_station_id, uint c
* @param front First vehicle in the consist.
* @param next_station_id Station the consist will be travelling to next.
*/
-void IncreaseStats(Station *st, const Vehicle *front, StationID next_station_id)
+void IncreaseStats(Station *st, const Vehicle *front, StationID next_station_id, uint32 time)
{
for (const Vehicle *v = front; v != nullptr; v = v->Next()) {
if (v->refit_cap > 0) {
@@ -3800,7 +3800,7 @@ void IncreaseStats(Station *st, const Vehicle *front, StationID next_station_id)
* As usage is not such an important figure anyway we just
* ignore the additional cargo then.*/
IncreaseStats(st, v->cargo_type, next_station_id, v->refit_cap,
- std::min<uint>(v->refit_cap, v->cargo.StoredCount()), EUM_INCREASE);
+ std::min<uint>(v->refit_cap, v->cargo.StoredCount()), time, EUM_INCREASE);
}
}
}