summaryrefslogtreecommitdiff
path: root/date.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2006-08-14 14:21:15 +0000
committerrubidium <rubidium@openttd.org>2006-08-14 14:21:15 +0000
commit243872b4fd82a1ee024e98eaae3e17f6b36a6707 (patch)
treece66f3f78e1bc27ddba6fa055772ec9eb5492f84 /date.h
parent01cd75cc10a9a9d2cd1687b9914a5e7dfc4888c3 (diff)
downloadopenttd-243872b4fd82a1ee024e98eaae3e17f6b36a6707.tar.xz
(svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
-Cleanup: fix whitespace related coding style issues in date.[ch] -Cleanup: make original comments doxygen compatible and remove/change outdated comments
Diffstat (limited to 'date.h')
-rw-r--r--date.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/date.h b/date.h
new file mode 100644
index 000000000..96fa2799a
--- /dev/null
+++ b/date.h
@@ -0,0 +1,35 @@
+/* $Id$ */
+
+/**
+ * 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
+ */
+#define DAY_TICKS 74
+
+#define MAX_YEAR_BEGIN_REAL 1920
+#define MAX_YEAR_END_REAL 2090
+#define MAX_YEAR_END 170
+
+/* Year and Date are defined elsewhere */
+typedef uint8 Month;
+typedef uint8 Day;
+typedef uint16 DateFract;
+
+typedef struct YearMonthDay {
+ Year year;
+ Month month;
+ Day day;
+} YearMonthDay;
+
+extern Year _cur_year;
+extern Month _cur_month;
+extern Date _date;
+extern DateFract _date_fract;
+
+
+void SetDate(Date date);
+void ConvertDayToYMD(YearMonthDay *ymd, Date date);
+uint ConvertYMDToDay(Year year, Month month, Day day);
+Date ConvertIntDate(uint date);