From 24cd52616c4b0c4c062be3f0e503f90b9069fee3 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Tue, 20 Feb 2024 18:18:54 +0000 Subject: [PATCH] Add getter for calendar sub date fract --- src/crashlog.cpp | 4 ++-- src/date_type.h | 1 + src/vehicle.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/crashlog.cpp b/src/crashlog.cpp index be56ef6e9d..d3dd93734e 100644 --- a/src/crashlog.cpp +++ b/src/crashlog.cpp @@ -575,7 +575,7 @@ char *CrashLog::FillCrashLog(char *buffer, const char *last) buffer += UTCTime::Format(buffer, last, "Crash at: %Y-%m-%d %H:%M:%S (UTC)\n"); buffer += seprintf(buffer, last, "In game date: %i-%02i-%02i (%i, %i) (DL: %u)\n", EconTime::CurYear().base(), EconTime::CurMonth() + 1, EconTime::CurDay(), EconTime::CurDateFract(), TickSkipCounter(), DayLengthFactor()); - buffer += seprintf(buffer, last, "Calendar date: %i-%02i-%02i (%i, %i)\n", CalTime::CurYear().base(), CalTime::CurMonth() + 1, CalTime::CurDay(), CalTime::CurDateFract(), CalTime::Detail::now.sub_date_fract); + buffer += seprintf(buffer, last, "Calendar date: %i-%02i-%02i (%i, %i)\n", CalTime::CurYear().base(), CalTime::CurMonth() + 1, CalTime::CurDay(), CalTime::CurDateFract(), CalTime::CurSubDateFract()); LogGameLoadDateTimes(buffer, last); return buffer; }); @@ -675,7 +675,7 @@ static char *LogDesyncDateHeader(char *buffer, const char *last) buffer += seprintf(buffer, last, "In game date: %i-%02i-%02i (%i, %i) (DL: %u), %08X\n", EconTime::CurYear().base(), EconTime::CurMonth() + 1, EconTime::CurDay(), EconTime::CurDateFract(), TickSkipCounter(), DayLengthFactor(), _frame_counter); - buffer += seprintf(buffer, last, "Calendar date: %i-%02i-%02i (%i, %i)\n", CalTime::CurYear().base(), CalTime::CurMonth() + 1, CalTime::CurDay(), CalTime::CurDateFract(), CalTime::Detail::now.sub_date_fract); + buffer += seprintf(buffer, last, "Calendar date: %i-%02i-%02i (%i, %i)\n", CalTime::CurYear().base(), CalTime::CurMonth() + 1, CalTime::CurDay(), CalTime::CurDateFract(), CalTime::CurSubDateFract()); LogGameLoadDateTimes(buffer, last); if (_networking && !_network_server) { extern EconTime::Date _last_sync_date; diff --git a/src/date_type.h b/src/date_type.h index 5b06864a26..8b4fd55f4c 100644 --- a/src/date_type.h +++ b/src/date_type.h @@ -186,6 +186,7 @@ struct CalTime : public DateDetail::BaseTime { static inline Day CurDay() { return Detail::now.cal_ymd.day; } static inline Date CurDate() { return Detail::now.cal_date; } static inline DateFract CurDateFract() { return Detail::now.cal_date_fract; } + static inline uint16_t CurSubDateFract() { return Detail::now.sub_date_fract; } static YearMonthDay ConvertDateToYMD(Date date); static Date ConvertYMDToDate(Year year, Month month, Day day); diff --git a/src/vehicle.cpp b/src/vehicle.cpp index cc99996d0d..9c7e88ba2b 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -1568,7 +1568,7 @@ void CallVehicleTicks() if (TickSkipCounter() == 0) RunVehicleDayProc(); - if (EconTime::UsingWallclockUnits() && !CalTime::IsCalendarFrozen() && CalTime::Detail::now.sub_date_fract == 0) { + if (EconTime::UsingWallclockUnits() && !CalTime::IsCalendarFrozen() && CalTime::CurSubDateFract() == 0) { RunVehicleCalendarDayProc(); }