date_type.h

Go to the documentation of this file.
00001 /* $Id: date_type.h 11702 2007-12-26 13:50:40Z rubidium $ */
00002 
00005 #ifndef DATE_TYPE_H
00006 #define DATE_TYPE_H
00007 
00014 #define DAY_TICKS 74
00015 
00016 /*
00017  * ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR and DAYS_TILL_ORIGINAL_BASE_YEAR are
00018  * primarily used for loading newgrf and savegame data and returning some
00019  * newgrf (callback) functions that were in the original (TTD) inherited
00020  * format, where '_date == 0' meant that it was 1920-01-01.
00021  */
00022 
00024 #define ORIGINAL_BASE_YEAR 1920
00025 
00026 #define ORIGINAL_MAX_YEAR 2090
00027 
00032 #define DAYS_TILL_ORIGINAL_BASE_YEAR (365 * ORIGINAL_BASE_YEAR + ORIGINAL_BASE_YEAR / 4 - ORIGINAL_BASE_YEAR / 100 + ORIGINAL_BASE_YEAR / 400)
00033 
00034 /* The absolute minimum & maximum years in OTTD */
00035 #define MIN_YEAR 0
00036 /* MAX_YEAR, nicely rounded value of the number of years that can
00037  * be encoded in a single 32 bits date, about 2^31 / 366 years. */
00038 #define MAX_YEAR 5000000
00039 
00040 typedef int32  Date;
00041 typedef uint16 DateFract;
00042 
00043 typedef int32  Year;
00044 typedef uint8  Month;
00045 typedef uint8  Day;
00046 
00047 struct YearMonthDay {
00048   Year  year;
00049   Month month;
00050   Day   day;
00051 };
00052 
00053 static const Year INVALID_YEAR = -1;
00054 static const Date INVALID_DATE = -1;
00055 
00056 #endif /* DATE_TYPE_H */

Generated on Wed Oct 1 17:03:20 2008 for openttd by  doxygen 1.5.6