Fixes incorrect link graph edge travel times with non-unity day length

Change vehicle last_loading_tick to be relative to _scaled_tick_counter
This commit is contained in:
Jonathan G Rennison
2022-12-11 00:06:09 +00:00
parent f4d775cad3
commit 5c2d5782a4
7 changed files with 27 additions and 8 deletions

View File

@@ -3817,7 +3817,11 @@ bool AfterLoadGame()
/* Use current order time to approximate last loading time */
if (IsSavegameVersionBefore(SLV_LAST_LOADING_TICK) && SlXvIsFeatureMissing(XSLFI_LAST_LOADING_TICK)) {
for (Vehicle *v : Vehicle::Iterate()) {
v->last_loading_tick = std::max(_tick_counter, static_cast<uint64>(v->current_order_time)) - v->current_order_time;
v->last_loading_tick = std::max(_scaled_tick_counter, static_cast<uint64>(v->current_order_time)) - v->current_order_time;
}
} else if (SlXvIsFeaturePresent(XSLFI_LAST_LOADING_TICK, 1, 1)) {
for (Vehicle *v : Vehicle::Iterate()) {
v->last_loading_tick *= _settings_game.economy.day_length_factor;
}
}