Saveload: Don't apply state ticks offset on load if not stored in save

This commit is contained in:
Jonathan G Rennison 2024-02-22 00:02:50 +00:00
parent 58f2e0cdf0
commit 5605650e26

View File

@ -872,7 +872,8 @@ bool AfterLoadGame()
if (SlXvIsFeaturePresent(XSLFI_VARIABLE_DAY_LENGTH, 1, 3)) {
/* CalTime is used here because EconTime hasn't been set yet, but this needs to be done before setting EconTime::Detail::SetDate,
* because that calls RecalculateStateTicksOffset which overwrites DateDetail::_state_ticks_offset which is an input here */
_state_ticks = GetStateTicksFromDateWithoutOffset(CalTime::CurDate().base(), CalTime::CurDateFract()) + DateDetail::_state_ticks_offset;
_state_ticks = GetStateTicksFromDateWithoutOffset(CalTime::CurDate().base(), CalTime::CurDateFract());
if (SlXvIsFeaturePresent(XSLFI_VARIABLE_DAY_LENGTH, 3, 3)) _state_ticks += DateDetail::_state_ticks_offset;
}
/* Update current year