summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/date.cpp2
-rw-r--r--src/saveload/afterload.cpp3
2 files changed, 5 insertions, 0 deletions
diff --git a/src/date.cpp b/src/date.cpp
index bc3c1d106..4b8111b6a 100644
--- a/src/date.cpp
+++ b/src/date.cpp
@@ -34,6 +34,8 @@ uint16 _tick_counter; ///< Ever incrementing (and sometimes wrapping) tick coun
*/
void SetDate(Date date, DateFract fract)
{
+ assert(fract < DAY_TICKS);
+
YearMonthDay ymd;
_date = date;
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index bce5e0451..17b356aae 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -569,6 +569,9 @@ bool AfterLoadGame()
default: break;
}
+ /* The value of _date_fract got divided, so make sure that old games are converted correctly. */
+ if (CheckSavegameVersionOldStyle(11, 1)) _date_fract /= 885;
+
/* Update current year
* must be done before loading sprites as some newgrfs check it */
SetDate(_date, _date_fract);