diff options
author | smatz <smatz@openttd.org> | 2009-01-13 22:58:03 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-01-13 22:58:03 +0000 |
commit | e00cf92f47837d26d5b0fffb0668c5c717b3bacc (patch) | |
tree | 30732aa7126b9196722d14cee835443a82b9688b /src/date_type.h | |
parent | cb221d99969240913f61d3bd64e20425568044d2 (diff) | |
download | openttd-e00cf92f47837d26d5b0fffb0668c5c717b3bacc.tar.xz |
(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
Diffstat (limited to 'src/date_type.h')
-rw-r--r-- | src/date_type.h | 8 |
1 files changed, 6 insertions, 2 deletions
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 |