From e00cf92f47837d26d5b0fffb0668c5c717b3bacc Mon Sep 17 00:00:00 2001 From: smatz Date: Tue, 13 Jan 2009 22:58:03 +0000 Subject: (svn r15077) -Codechange: enumify DAYS_IN_YEAR and DAYS_IN_LEAP_YEAR -Change: when computing daily running cost, divide by 365 (instead of 364). Since r12134, the rounding errors don't need this correction anymore --- src/date_type.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/date_type.h') diff --git a/src/date_type.h b/src/date_type.h index 67122b0b1..53e181239 100644 --- a/src/date_type.h +++ b/src/date_type.h @@ -11,7 +11,11 @@ * 1 tick is approximately 30 ms. * 1 day is thus about 2 seconds (74 * 30 = 2220) on a machine that can run OpenTTD normally */ -#define DAY_TICKS 74 +enum { + DAY_TICKS = 74, ///< ticks per day + DAYS_IN_YEAR = 365, ///< days per year + DAYS_IN_LEAP_YEAR = 366, ///< sometimes, you need one day more... +}; /* * ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR and DAYS_TILL_ORIGINAL_BASE_YEAR are @@ -31,7 +35,7 @@ * The offset in days from the '_date == 0' till * 'ConvertYMDToDate(ORIGINAL_BASE_YEAR, 0, 1)' */ -#define DAYS_TILL_ORIGINAL_BASE_YEAR (365 * ORIGINAL_BASE_YEAR + ORIGINAL_BASE_YEAR / 4 - ORIGINAL_BASE_YEAR / 100 + ORIGINAL_BASE_YEAR / 400) +#define DAYS_TILL_ORIGINAL_BASE_YEAR (DAYS_IN_YEAR * ORIGINAL_BASE_YEAR + ORIGINAL_BASE_YEAR / 4 - ORIGINAL_BASE_YEAR / 100 + ORIGINAL_BASE_YEAR / 400) /* The absolute minimum & maximum years in OTTD */ #define MIN_YEAR 0 -- cgit v1.2.3-54-g00ecf