summaryrefslogtreecommitdiff
path: root/src/saveload
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/saveload
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/saveload')
-rw-r--r--src/saveload/linkgraph_sl.cpp1
-rw-r--r--src/saveload/saveload.h1
2 files changed, 2 insertions, 0 deletions
diff --git a/src/saveload/linkgraph_sl.cpp b/src/saveload/linkgraph_sl.cpp
index ae21de4c7..9ff7e130a 100644
--- a/src/saveload/linkgraph_sl.cpp
+++ b/src/saveload/linkgraph_sl.cpp
@@ -33,6 +33,7 @@ public:
inline static const SaveLoad description[] = {
SLE_VAR(Edge, capacity, SLE_UINT32),
SLE_VAR(Edge, usage, SLE_UINT32),
+ SLE_CONDVAR(Edge, travel_time_sum, SLE_UINT64, SLV_LINKGRAPH_TRAVEL_TIME, SL_MAX_VERSION),
SLE_VAR(Edge, last_unrestricted_update, SLE_INT32),
SLE_CONDVAR(Edge, last_restricted_update, SLE_INT32, SLV_187, SL_MAX_VERSION),
SLE_VAR(Edge, next_edge, SLE_UINT16),
diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h
index 3047cbfd8..ad8b368c8 100644
--- a/src/saveload/saveload.h
+++ b/src/saveload/saveload.h
@@ -337,6 +337,7 @@ enum SaveLoadVersion : uint16 {
SLV_TABLE_CHUNKS, ///< 295 PR#9322 Introduction of CH_TABLE and CH_SPARSE_TABLE.
SLV_SCRIPT_INT64, ///< 296 PR#9415 SQInteger is 64bit but was saved as 32bit.
+ SLV_LINKGRAPH_TRAVEL_TIME, ///< 297 PR#9457 Store travel time in the linkgraph.
SL_MAX_VERSION, ///< Highest possible saveload version
};