From 8e04cba0c357143f278a517fd5bdedc8249f6b2c Mon Sep 17 00:00:00 2001 From: Tyler Trahan Date: Fri, 14 Apr 2023 09:50:19 -0400 Subject: [PATCH] Change: Make tick length 27 milliseconds (#10607) This makes a month last about 60 seconds, allowing the use of real-time units in game. Co-authored-by: Niels Martin Hansen --- src/date_type.h | 4 ++-- src/gfx_type.h | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/date_type.h b/src/date_type.h index c0f005734e..818a124265 100644 --- a/src/date_type.h +++ b/src/date_type.h @@ -22,8 +22,8 @@ typedef uint8 Day; ///< Type for the day of the month, note: 1 based, first d /** * 1 day is 74 ticks; _date_fract used to be uint16 and incremented by 885. On * an overflow the new day begun and 65535 / 885 = 74. - * 1 tick is approximately 30 ms. - * 1 day is thus about 2 seconds (74 * 30 = 2220) on a machine that can run OpenTTD normally + * 1 tick is approximately 27 ms. + * 1 day is thus about 2 seconds (74 * 27 = 1998) on a machine that can run OpenTTD normally */ static const int DAY_TICKS = 74; ///< ticks per day static const int DAYS_IN_YEAR = 365; ///< days per year diff --git a/src/gfx_type.h b/src/gfx_type.h index 8a3fc64dfd..869b86ee80 100644 --- a/src/gfx_type.h +++ b/src/gfx_type.h @@ -313,8 +313,12 @@ enum SpriteType : byte { ST_INVALID = 4, ///< Pseudosprite or other unusable sprite, used only internally }; -/** The number of milliseconds per game tick. */ -static const uint MILLISECONDS_PER_TICK = 30; +/** + * The number of milliseconds per game tick. + * The value 27 together with a day length of 74 ticks makes one day 1998 milliseconds, almost exactly 2 seconds. + * With a 2 second day, one standard month is 1 minute, and one standard year is slightly over 12 minutes. + */ +static const uint MILLISECONDS_PER_TICK = 27; /** Information about the currently used palette. */ struct Palette {