(svn r11702) -Codechange: move all date related stuff to date*.
authorrubidium
Wed, 26 Dec 2007 13:50:40 +0000
changeset 8636 2b158acb649c
parent 8635 3bbb6f87fced
child 8637 b5a7396c9b2f
(svn r11702) -Codechange: move all date related stuff to date*.
src/ai/default/default.cpp
src/ai/trolly/trolly.cpp
src/aircraft_cmd.cpp
src/airport.cpp
src/build_vehicle_gui.cpp
src/console_cmds.cpp
src/currency.cpp
src/currency.h
src/date.cpp
src/date.h
src/date_func.h
src/date_type.h
src/disaster_cmd.cpp
src/economy.cpp
src/engine.cpp
src/engine.h
src/genworld.cpp
src/genworld_gui.cpp
src/graph_gui.cpp
src/group_gui.cpp
src/industry.h
src/industry_cmd.cpp
src/industry_gui.cpp
src/landscape.cpp
src/main_gui.cpp
src/misc.cpp
src/misc_gui.cpp
src/network/core/game.h
src/network/core/udp.cpp
src/network/network.cpp
src/network/network_client.cpp
src/network/network_gui.cpp
src/network/network_server.cpp
src/network/network_udp.cpp
src/newgrf.cpp
src/newgrf_engine.cpp
src/newgrf_house.cpp
src/newgrf_industries.cpp
src/newgrf_spritegroup.cpp
src/newgrf_station.cpp
src/newgrf_text.cpp
src/news.h
src/news_gui.cpp
src/oldloader.cpp
src/openttd.cpp
src/openttd.h
src/player.h
src/player_gui.cpp
src/players.cpp
src/rail_gui.cpp
src/roadveh_cmd.cpp
src/screenshot.cpp
src/settings.cpp
src/settings_gui.cpp
src/ship_cmd.cpp
src/station.cpp
src/station_cmd.cpp
src/station_gui.cpp
src/strings.cpp
src/subsidy_gui.cpp
src/texteff.cpp
src/tile_cmd.h
src/timetable_cmd.cpp
src/timetable_gui.cpp
src/town.h
src/town_cmd.cpp
src/town_map.h
src/train_cmd.cpp
src/tunnelbridge_cmd.cpp
src/variables.h
src/vehicle.cpp
src/vehicle.h
src/vehicle_gui.cpp
src/waypoint.cpp
src/yapf/yapf.hpp
src/yapf/yapf_costcache.hpp
--- a/src/ai/default/default.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/ai/default/default.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -23,7 +23,7 @@
 #include "../../depot.h"
 #include "../../variables.h"
 #include "../../bridge.h"
-#include "../../date.h"
+#include "../../date_func.h"
 #include "../../tunnelbridge_map.h"
 #include "../../window_func.h"
 #include "../../functions.h"
--- a/src/ai/trolly/trolly.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/ai/trolly/trolly.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -32,7 +32,7 @@
 #include "../../gui.h"
 #include "../../depot.h"
 #include "../../vehicle.h"
-#include "../../date.h"
+#include "../../date_func.h"
 #include "../ai.h"
 #include "../../order.h"
 
--- a/src/aircraft_cmd.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/aircraft_cmd.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -26,12 +26,12 @@
 #include "newgrf_callbacks.h"
 #include "newgrf_text.h"
 #include "newgrf_sound.h"
-#include "date.h"
 #include "spritecache.h"
 #include "cargotype.h"
 #include "strings_func.h"
 #include "command_func.h"
 #include "window_func.h"
+#include "date_func.h"
 #include "functions.h"
 
 void Aircraft::UpdateDeltaXY(Direction direction)
--- a/src/airport.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/airport.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -8,9 +8,9 @@
 #include "airport.h"
 #include "variables.h"
 #include "airport_movement.h"
-#include "date.h"
 #include "core/bitmath_func.hpp"
 #include "core/alloc_func.hpp"
+#include "date_func.h"
 
 /* Uncomment this to print out a full report of the airport-structure
  * You should either use
--- a/src/build_vehicle_gui.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/build_vehicle_gui.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -23,12 +23,12 @@
 #include "airport.h"
 #include "vehicle_gui.h"
 #include "newgrf_engine.h"
-#include "date.h"
 #include "cargotype.h"
 #include "group.h"
 #include "road_map.h"
 #include "strings_func.h"
 #include "window_func.h"
+#include "date_func.h"
 
 
 enum BuildVehicleWidgets {
--- a/src/console_cmds.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/console_cmds.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -23,13 +23,13 @@
 #include "station.h"
 #include "screenshot.h"
 #include "genworld.h"
-#include "date.h"
 #include "network/network.h"
 #include "strings_func.h"
 #include "viewport.h"
 #include "window_func.h"
 #include "functions.h"
 #include "map_func.h"
+#include "date_func.h"
 
 // ** scriptfile handling ** //
 static FILE *_script_file;
--- a/src/currency.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/currency.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -8,7 +8,7 @@
 #include "news.h"
 #include "variables.h"
 #include "table/strings.h"
-#include "date.h"
+#include "date_func.h"
 
 	//   exchange rate    prefix             symbol_pos
 	//   |  separator        |     postfix   |
--- a/src/currency.h	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/currency.h	Wed Dec 26 13:50:40 2007 +0000
@@ -5,6 +5,8 @@
 #ifndef CURRENCY_H
 #define CURRENCY_H
 
+#include "date_type.h"
+
 enum {
 	CF_NOEURO = 0,
 	CF_ISEURO = 1,
--- a/src/date.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/date.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -4,7 +4,6 @@
 
 #include "stdafx.h"
 #include "openttd.h"
-#include "date.h"
 #include "variables.h"
 #include "vehicle.h"
 #include "network/network.h"
@@ -13,6 +12,7 @@
 #include "currency.h"
 #include "window_func.h"
 #include "functions.h"
+#include "date_func.h"
 #ifdef DEBUG_DUMP_COMMANDS
 #include "saveload.h"
 #endif
--- a/src/date.h	Wed Dec 26 11:45:43 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/* $Id$ */
-
-/** @file date.h */
-
-#ifndef DATE_H
-#define DATE_H
-
-#include "openttd.h"
-
-/**
- * 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
-
-/*
- * ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR and DAYS_TILL_ORIGINAL_BASE_YEAR are
- * primarily used for loading newgrf and savegame data and returning some
- * newgrf (callback) functions that were in the original (TTD) inherited
- * format, where '_date == 0' meant that it was 1920-01-01.
- */
-
-/** The minimum starting year/base year of the original TTD */
-#define ORIGINAL_BASE_YEAR 1920
-/** The maximum year of the original TTD */
-#define ORIGINAL_MAX_YEAR 2090
-
-/**
- * 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)
-
-/* The absolute minimum & maximum years in OTTD */
-#define MIN_YEAR 0
-/* MAX_YEAR, nicely rounded value of the number of years that can
- * be encoded in a single 32 bits date, about 2^31 / 366 years. */
-#define MAX_YEAR 5000000
-
-/* Year and Date are defined elsewhere */
-typedef uint8  Month;
-typedef uint8  Day;
-typedef uint16 DateFract;
-
-struct YearMonthDay {
-	Year  year;
-	Month month;
-	Day   day;
-};
-
-extern Year      _cur_year;
-extern Month     _cur_month;
-extern Date      _date;
-extern DateFract _date_fract;
-
-
-void SetDate(Date date);
-void ConvertDateToYMD(Date date, YearMonthDay *ymd);
-Date ConvertYMDToDate(Year year, Month month, Day day);
-
-#endif /* DATE_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/date_func.h	Wed Dec 26 13:50:40 2007 +0000
@@ -0,0 +1,19 @@
+/* $Id$ */
+
+/** @file date_func.h Functions related to dates. */
+
+#ifndef DATE_FUNC_H
+#define DATE_FUNC_H
+
+#include "date_type.h"
+
+extern Year      _cur_year;
+extern Month     _cur_month;
+extern Date      _date;
+extern DateFract _date_fract;
+
+void SetDate(Date date);
+void ConvertDateToYMD(Date date, YearMonthDay *ymd);
+Date ConvertYMDToDate(Year year, Month month, Day day);
+
+#endif /* DATE_FUNC_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/date_type.h	Wed Dec 26 13:50:40 2007 +0000
@@ -0,0 +1,56 @@
+/* $Id$ */
+
+/** @file date_type.h Types related to the dates in OpenTTD. */
+
+#ifndef DATE_TYPE_H
+#define DATE_TYPE_H
+
+/**
+ * 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
+
+/*
+ * ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR and DAYS_TILL_ORIGINAL_BASE_YEAR are
+ * primarily used for loading newgrf and savegame data and returning some
+ * newgrf (callback) functions that were in the original (TTD) inherited
+ * format, where '_date == 0' meant that it was 1920-01-01.
+ */
+
+/** The minimum starting year/base year of the original TTD */
+#define ORIGINAL_BASE_YEAR 1920
+/** The maximum year of the original TTD */
+#define ORIGINAL_MAX_YEAR 2090
+
+/**
+ * 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)
+
+/* The absolute minimum & maximum years in OTTD */
+#define MIN_YEAR 0
+/* MAX_YEAR, nicely rounded value of the number of years that can
+ * be encoded in a single 32 bits date, about 2^31 / 366 years. */
+#define MAX_YEAR 5000000
+
+typedef int32  Date;
+typedef uint16 DateFract;
+
+typedef int32  Year;
+typedef uint8  Month;
+typedef uint8  Day;
+
+struct YearMonthDay {
+	Year  year;
+	Month month;
+	Day   day;
+};
+
+static const Year INVALID_YEAR = -1;
+static const Date INVALID_DATE = -1;
+
+#endif /* DATE_TYPE_H */
--- a/src/disaster_cmd.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/disaster_cmd.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -36,8 +36,8 @@
 #include "sound.h"
 #include "variables.h"
 #include "table/sprites.h"
-#include "date.h"
 #include "strings_func.h"
+#include "date_func.h"
 #include "functions.h"
 
 enum DisasterSubType {
--- a/src/economy.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/economy.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -32,7 +32,6 @@
 #include "newgrf_industries.h"
 #include "newgrf_industrytiles.h"
 #include "unmovable.h"
-#include "date.h"
 #include "cargotype.h"
 #include "player_face.h"
 #include "group.h"
@@ -40,6 +39,7 @@
 #include "tile_cmd.h"
 #include "functions.h"
 #include "window_func.h"
+#include "date_func.h"
 
 /**
  * Multiply two integer values and shift the results to right.
--- a/src/engine.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/engine.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -16,7 +16,6 @@
 #include "train.h"
 #include "aircraft.h"
 #include "newgrf_cargo.h"
-#include "date.h"
 #include "table/engines.h"
 #include "group.h"
 #include "string.h"
@@ -25,6 +24,7 @@
 #include "viewport.h"
 #include "functions.h"
 #include "window_func.h"
+#include "date_func.h"
 
 EngineInfo _engine_info[TOTAL_NUM_ENGINES];
 RailVehicleInfo _rail_vehicle_info[NUM_TRAIN_ENGINES];
--- a/src/engine.h	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/engine.h	Wed Dec 26 13:50:40 2007 +0000
@@ -11,6 +11,7 @@
 #include "vehicle_type.h"
 #include "command_type.h"
 #include "gfx_type.h"
+#include "date_type.h"
 #include "sound.h"
 
 enum RailVehicleTypes {
--- a/src/genworld.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/genworld.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -17,9 +17,9 @@
 #include "debug.h"
 #include "settings.h"
 #include "heightmap.h"
-#include "date.h"
 #include "viewport.h"
 #include "map_func.h"
+#include "date_func.h"
 
 void GenerateClearTile();
 void GenerateIndustries();
--- a/src/genworld_gui.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/genworld_gui.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -21,10 +21,10 @@
 #include "genworld.h"
 #include "network/network.h"
 #include "thread.h"
-#include "date.h"
 #include "newgrf_config.h"
 #include "strings_func.h"
 #include "window_func.h"
+#include "date_func.h"
 
 /**
  * In what 'mode' the GenerateLandscapeWindowProc is.
--- a/src/graph_gui.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/graph_gui.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -11,11 +11,11 @@
 #include "player.h"
 #include "economy_func.h"
 #include "variables.h"
-#include "date.h"
 #include "cargotype.h"
 #include "strings_func.h"
 #include "core/alloc_func.hpp"
 #include "window_func.h"
+#include "date_func.h"
 
 /* Bitmasks of player and cargo indices that shouldn't be drawn. */
 static uint _legend_excluded_players;
--- a/src/group_gui.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/group_gui.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -15,7 +15,6 @@
 #include "vehicle_gui.h"
 #include "depot.h"
 #include "train.h"
-#include "date.h"
 #include "group.h"
 #include "viewport.h"
 #include "debug.h"
--- a/src/industry.h	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/industry.h	Wed Dec 26 13:50:40 2007 +0000
@@ -12,6 +12,7 @@
 #include "economy_type.h"
 #include "map_type.h"
 #include "slope_type.h"
+#include "date_type.h"
 
 typedef uint16 IndustryGfx;
 typedef uint8 IndustryType;
--- a/src/industry_cmd.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/industry_cmd.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -23,7 +23,6 @@
 #include "table/industry_land.h"
 #include "table/build_industry.h"
 #include "genworld.h"
-#include "date.h"
 #include "water_map.h"
 #include "tree_map.h"
 #include "cargotype.h"
@@ -40,6 +39,7 @@
 #include "tile_cmd.h"
 #include "functions.h"
 #include "window_func.h"
+#include "date_func.h"
 
 void ShowIndustryViewWindow(int industry);
 void BuildOilRig(TileIndex tile);
--- a/src/industry_gui.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/industry_gui.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -20,7 +20,6 @@
 #include "newgrf_callbacks.h"
 #include "newgrf_industries.h"
 #include "newgrf_text.h"
-#include "date.h"
 #include "strings_func.h"
 #include "map_func.h"
 
--- a/src/landscape.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/landscape.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -5,7 +5,6 @@
 #include "bridge_map.h"
 #include "heightmap.h"
 #include "clear_map.h"
-#include "date.h"
 #include "player.h"
 #include "spritecache.h"
 #include "table/sprites.h"
@@ -24,6 +23,7 @@
 #include "functions.h"
 #include "window_func.h"
 #include "functions.h"
+#include "date_func.h"
 
 extern const TileTypeProcs
 	_tile_type_clear_procs,
--- a/src/main_gui.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/main_gui.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -34,12 +34,12 @@
 #include "screenshot.h"
 #include "genworld.h"
 #include "settings.h"
-#include "date.h"
 #include "vehicle_gui.h"
 #include "transparency_gui.h"
 #include "newgrf_config.h"
 #include "rail_gui.h"
 #include "road_gui.h"
+#include "date_func.h"
 #include "functions.h"
 
 #include "network/network_data.h"
--- a/src/misc.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/misc.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -18,7 +18,6 @@
 #include "variables.h"
 #include "ai/ai.h"
 #include "newgrf_house.h"
-#include "date.h"
 #include "cargotype.h"
 #include "group.h"
 #include "viewport.h"
@@ -26,6 +25,7 @@
 #include "zoom_func.h"
 #include "functions.h"
 #include "map_func.h"
+#include "date_func.h"
 
 char _name_array[512][32];
 
--- a/src/misc_gui.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/misc_gui.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -31,7 +31,6 @@
 #include "train.h"
 #include "tgp.h"
 #include "settings.h"
-#include "date.h"
 #include "cargotype.h"
 #include "player_face.h"
 #include "strings_func.h"
@@ -41,6 +40,7 @@
 #include "zoom_func.h"
 #include "functions.h"
 #include "window_func.h"
+#include "date_func.h"
 
 /* Variables to display file lists */
 FiosItem *_fios_list;
--- a/src/network/core/game.h	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/network/core/game.h	Wed Dec 26 13:50:40 2007 +0000
@@ -11,8 +11,8 @@
 #ifdef ENABLE_NETWORK
 
 #include "config.h"
-#include "../../date.h"
 #include "../../newgrf_config.h"
+#include "../../date_type.h"
 
 /**
  * This is the struct used by both client and server
--- a/src/network/core/udp.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/network/core/udp.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -11,6 +11,7 @@
 #include "../../core/bitmath_func.hpp"
 #include "../../core/math_func.hpp"
 #include "../../core/alloc_func.hpp"
+#include "../../date_func.h"
 #include "packet.h"
 #include "udp.h"
 
--- a/src/network/network.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/network/network.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -14,7 +14,7 @@
 #include "../map_func.h"
 #include "../command_func.h"
 #include "../variables.h"
-#include "../date.h"
+#include "../date_func.h"
 #include "../newgrf_config.h"
 #include "table/strings.h"
 #include "network_client.h"
--- a/src/network/network_client.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/network/network_client.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -8,7 +8,6 @@
 #include "../openttd.h"
 #include "network_data.h"
 #include "core/tcp.h"
-#include "../date.h"
 #include "table/strings.h"
 #include "network_client.h"
 #include "network_gamelist.h"
--- a/src/network/network_gui.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/network/network_gui.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -7,7 +7,7 @@
 #include "../strings_func.h"
 #include "../table/sprites.h"
 #include "network.h"
-#include "../date.h"
+#include "../date_func.h"
 
 #include "../fios.h"
 #include "table/strings.h"
--- a/src/network/network_server.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/network/network_server.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -11,7 +11,7 @@
 #include "core/tcp.h"
 #include "../train.h"
 #include "../aircraft.h"
-#include "../date.h"
+#include "../date_func.h"
 #include "table/strings.h"
 #include "network_server.h"
 #include "network_udp.h"
--- a/src/network/network_udp.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/network/network_udp.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -13,7 +13,7 @@
 #include "../debug.h"
 #include "../string.h"
 #include "network_data.h"
-#include "../date.h"
+#include "../date_func.h"
 #include "../map_func.h"
 #include "network_gamelist.h"
 #include "network_udp.h"
--- a/src/newgrf.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/newgrf.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -24,7 +24,6 @@
 #include "newgrf_text.h"
 #include "table/sprites.h"
 #include "fontcache.h"
-#include "date.h"
 #include "currency.h"
 #include "landscape.h"
 #include "sound.h"
@@ -46,6 +45,7 @@
 #include "rail.h"
 #include "strings_func.h"
 #include "gfx_func.h"
+#include "date_func.h"
 
 /* TTDPatch extended GRF format codec
  * (c) Petr Baudis 2004 (GPL'd)
--- a/src/newgrf_engine.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/newgrf_engine.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -17,8 +17,8 @@
 #include "newgrf_station.h"
 #include "newgrf_spritegroup.h"
 #include "newgrf_cargo.h"
-#include "date.h"
 #include "cargotype.h"
+#include "date_func.h"
 
 
 int _traininfo_vehicle_pitch = 0;
--- a/src/newgrf_house.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/newgrf_house.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -8,7 +8,6 @@
 #include "debug.h"
 #include "viewport.h"
 #include "landscape.h"
-#include "date.h"
 #include "town.h"
 #include "town_map.h"
 #include "sound.h"
--- a/src/newgrf_industries.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/newgrf_industries.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -18,7 +18,6 @@
 #include "newgrf_commons.h"
 #include "newgrf_text.h"
 #include "newgrf_town.h"
-#include "date.h"
 #include "window_func.h"
 
 /* Since the industry IDs defined by the GRF file don't necessarily correlate
--- a/src/newgrf_spritegroup.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/newgrf_spritegroup.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -9,8 +9,8 @@
 #include "oldpool.h"
 #include "newgrf_callbacks.h"
 #include "newgrf_spritegroup.h"
-#include "date.h"
 #include "sprite.h"
+#include "date_func.h"
 
 static void SpriteGroupPoolCleanBlock(uint start_item, uint end_item);
 
--- a/src/newgrf_station.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/newgrf_station.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -18,11 +18,11 @@
 #include "newgrf_commons.h"
 #include "newgrf_station.h"
 #include "newgrf_spritegroup.h"
-#include "date.h"
 #include "cargotype.h"
 #include "town_map.h"
 #include "newgrf_town.h"
 #include "gfx_func.h"
+#include "date_func.h"
 
 static StationClass station_classes[STAT_CLASS_MAX];
 
--- a/src/newgrf_text.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/newgrf_text.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -18,7 +18,6 @@
 #include "newgrf.h"
 #include "newgrf_text.h"
 #include "table/control_codes.h"
-#include "date.h"
 #include "strings_func.h"
 
 #define GRFTAB  28
--- a/src/news.h	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/news.h	Wed Dec 26 13:50:40 2007 +0000
@@ -8,6 +8,7 @@
 #include "window_type.h"
 #include "vehicle_type.h"
 #include "tile_type.h"
+#include "date_type.h"
 
 struct NewsItem {
 	StringID string_id; ///< Message text (sometimes also used for storing other info)
--- a/src/news_gui.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/news_gui.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -12,11 +12,11 @@
 #include "vehicle.h"
 #include "sound.h"
 #include "variables.h"
-#include "date.h"
 #include "string.h"
 #include "transparency.h"
 #include "strings_func.h"
 #include "window_func.h"
+#include "date_func.h"
 
 /** @file news_gui.cpp
  *
--- a/src/oldloader.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/oldloader.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -21,9 +21,9 @@
 #include "depot.h"
 #include "newgrf_config.h"
 #include "ai/ai.h"
-#include "date.h"
 #include "zoom_func.h"
 #include "functions.h"
+#include "date_func.h"
 
 enum {
 	HEADER_SIZE = 49,
--- a/src/openttd.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/openttd.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -46,7 +46,6 @@
 #include "yapf/yapf.h"
 #include "settings.h"
 #include "genworld.h"
-#include "date.h"
 #include "clear_map.h"
 #include "fontcache.h"
 #include "newgrf.h"
@@ -62,6 +61,7 @@
 #include "video/video_driver.hpp"
 #include "strings_func.h"
 #include "zoom_func.h"
+#include "date_func.h"
 
 #include "bridge_map.h"
 #include "clear_map.h"
--- a/src/openttd.h	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/openttd.h	Wed Dec 26 13:50:40 2007 +0000
@@ -49,15 +49,6 @@
 assert_compile(sizeof(DestinationID) == sizeof(WaypointID));
 assert_compile(sizeof(DestinationID) == sizeof(StationID));
 
-
-enum {
-	INVALID_YEAR = -1,
-	INVALID_DATE = -1,
-};
-
-typedef int32 Year;
-typedef int32 Date;
-
 typedef uint32 PlayerFace; ///< player face bits, info see in player_face.h
 
 enum GameModes {
--- a/src/player.h	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/player.h	Wed Dec 26 13:50:40 2007 +0000
@@ -11,6 +11,7 @@
 #include "road_func.h"
 #include "cargo_type.h"
 #include "command_type.h"
+#include "date_type.h"
 #include "engine.h"
 #include "livery.h"
 #include "genworld.h"
--- a/src/player_gui.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/player_gui.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -18,7 +18,6 @@
 #include "roadveh.h"
 #include "train.h"
 #include "aircraft.h"
-#include "date.h"
 #include "newgrf.h"
 #include "network/network_data.h"
 #include "network/network_client.h"
@@ -27,6 +26,7 @@
 #include "strings_func.h"
 #include "functions.h"
 #include "window_func.h"
+#include "date_func.h"
 
 static void DoShowPlayerFinances(PlayerID player, bool show_small, bool show_stickied);
 static void DoSelectPlayerFace(PlayerID player, bool show_big);
--- a/src/players.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/players.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -20,7 +20,6 @@
 #include "variables.h"
 #include "engine.h"
 #include "ai/ai.h"
-#include "date.h"
 #include "player_face.h"
 #include "group.h"
 #include "settings.h"
@@ -29,6 +28,7 @@
 #include "strings_func.h"
 #include "gfx_func.h"
 #include "functions.h"
+#include "date_func.h"
 
 /**
  * Sets the local player and updates the patch settings that are set on a
--- a/src/rail_gui.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/rail_gui.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -8,7 +8,6 @@
 #include "table/strings.h"
 #include "tile_cmd.h"
 #include "landscape.h"
-#include "date.h"
 #include "gui.h"
 #include "window_gui.h"
 #include "station_gui.h"
@@ -26,6 +25,7 @@
 #include "strings_func.h"
 #include "functions.h"
 #include "window_func.h"
+#include "date_func.h"
 
 #include "bridge_map.h"
 #include "rail_map.h"
--- a/src/roadveh_cmd.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/roadveh_cmd.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -32,12 +32,12 @@
 #include "newgrf_text.h"
 #include "newgrf_sound.h"
 #include "yapf/yapf.h"
-#include "date.h"
 #include "cargotype.h"
 #include "strings_func.h"
 #include "tunnelbridge_map.h"
 #include "functions.h"
 #include "window_func.h"
+#include "date_func.h"
 
 
 static const uint16 _roadveh_images[63] = {
--- a/src/screenshot.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/screenshot.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -9,7 +9,6 @@
 #include "player.h"
 #include "screenshot.h"
 #include "variables.h"
-#include "date.h"
 #include "string.h"
 #include "blitter/factory.hpp"
 #include "fileio.h"
@@ -18,6 +17,7 @@
 #include "core/alloc_func.hpp"
 #include "core/endian_func.hpp"
 #include "map_func.h"
+#include "date_func.h"
 
 char _screenshot_format_name[8];
 uint _num_screenshot_formats;
--- a/src/settings.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/settings.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -36,7 +36,6 @@
 #include "newgrf.h"
 #include "newgrf_config.h"
 #include "genworld.h"
-#include "date.h"
 #include "rail.h"
 #include "train.h"
 #include "news.h"
--- a/src/settings_gui.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/settings_gui.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -20,7 +20,6 @@
 #include "variables.h"
 #include "settings.h"
 #include "vehicle.h"
-#include "date.h"
 #include "newgrf_townname.h"
 #include "strings_func.h"
 #include "functions.h"
--- a/src/ship_cmd.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/ship_cmd.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -28,12 +28,12 @@
 #include "newgrf_callbacks.h"
 #include "newgrf_text.h"
 #include "newgrf_sound.h"
-#include "date.h"
 #include "spritecache.h"
 #include "misc/autoptr.hpp"
 #include "strings_func.h"
 #include "functions.h"
 #include "window_func.h"
+#include "date_func.h"
 
 static const uint16 _ship_sprites[] = {0x0E5D, 0x0E55, 0x0E65, 0x0E6D};
 
--- a/src/station.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/station.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -25,13 +25,13 @@
 #include "newgrf_callbacks.h"
 #include "newgrf_station.h"
 #include "yapf/yapf.h"
-#include "date.h"
 #include "cargotype.h"
 #include "roadveh.h"
 #include "station_gui.h"
 #include "zoom_func.h"
 #include "functions.h"
 #include "window_func.h"
+#include "date_func.h"
 
 Station::Station(TileIndex tile)
 {
--- a/src/station_cmd.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/station_cmd.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -32,7 +32,6 @@
 #include "newgrf_callbacks.h"
 #include "newgrf_station.h"
 #include "yapf/yapf.h"
-#include "date.h"
 #include "misc/autoptr.hpp"
 #include "road_type.h"
 #include "road_internal.h" /* For drawing catenary/checking road removal */
@@ -44,6 +43,7 @@
 #include "strings_func.h"
 #include "functions.h"
 #include "window_func.h"
+#include "date_func.h"
 
 DEFINE_OLD_POOL_GENERIC(Station, Station)
 DEFINE_OLD_POOL_GENERIC(RoadStop, RoadStop)
--- a/src/station_gui.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/station_gui.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -16,7 +16,6 @@
 #include "command_func.h"
 #include "variables.h"
 #include "vehicle_gui.h"
-#include "date.h"
 #include "vehicle.h"
 #include "table/sprites.h"
 #include "cargotype.h"
--- a/src/strings.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/strings.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -19,7 +19,6 @@
 #include "newgrf_text.h"
 #include "table/control_codes.h"
 #include "music.h"
-#include "date.h"
 #include "industry.h"
 #include "fileio.h"
 #include "cargotype.h"
@@ -35,6 +34,7 @@
 #include "strings_func.h"
 #include "functions.h"
 #include "core/endian_func.hpp"
+#include "date_func.h"
 
 /* for opendir/readdir/closedir */
 # include "fios.h"
--- a/src/subsidy_gui.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/subsidy_gui.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -11,10 +11,10 @@
 #include "player.h"
 #include "economy_func.h"
 #include "variables.h"
-#include "date.h"
 #include "cargotype.h"
 #include "window_gui.h"
 #include "strings_func.h"
+#include "date_func.h"
 
 static void HandleSubsidyClick(int y)
 {
--- a/src/texteff.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/texteff.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -14,12 +14,12 @@
 #include "table/sprites.h"
 #include "blitter/factory.hpp"
 #include <stdarg.h> /* va_list */
-#include "date.h"
 #include "texteff.hpp"
 #include "video/video_driver.hpp"
 #include "transparency.h"
 #include "strings_func.h"
 #include "core/alloc_func.hpp"
+#include "date_func.h"
 #include "functions.h"
 
 enum {
--- a/src/tile_cmd.h	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/tile_cmd.h	Wed Dec 26 13:50:40 2007 +0000
@@ -11,6 +11,7 @@
 #include "vehicle_type.h"
 #include "cargo_type.h"
 #include "strings_type.h"
+#include "date_type.h"
 
 /** The returned bits of VehicleEnterTile. */
 enum VehicleEnterTileStatus {
--- a/src/timetable_cmd.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/timetable_cmd.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -7,7 +7,6 @@
 #include "variables.h"
 #include "table/strings.h"
 #include "command_func.h"
-#include "date.h"
 #include "player.h"
 #include "vehicle.h"
 #include "functions.h"
--- a/src/timetable_gui.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/timetable_gui.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -7,7 +7,6 @@
 #include "variables.h"
 #include "table/strings.h"
 #include "command_func.h"
-#include "date.h"
 #include "engine.h"
 #include "gui.h"
 #include "window_gui.h"
--- a/src/town.h	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/town.h	Wed Dec 26 13:50:40 2007 +0000
@@ -9,6 +9,7 @@
 #include "core/random_func.hpp"
 #include "cargo_type.h"
 #include "tile_type.h"
+#include "date_type.h"
 
 enum {
 	HOUSE_NO_CLASS   = 0,
--- a/src/town_cmd.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/town_cmd.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -28,7 +28,6 @@
 #include "variables.h"
 #include "bridge.h"
 #include "bridge_map.h"
-#include "date.h"
 #include "table/town_land.h"
 #include "genworld.h"
 #include "newgrf.h"
--- a/src/town_map.h	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/town_map.h	Wed Dec 26 13:50:40 2007 +0000
@@ -6,7 +6,7 @@
 #define TOWN_MAP_H
 
 #include "town.h"
-#include "date.h"
+#include "date_func.h"
 #include "tile_map.h"
 #include "functions.h"
 
--- a/src/train_cmd.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/train_cmd.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -35,7 +35,6 @@
 #include "newgrf_text.h"
 #include "direction_func.h"
 #include "yapf/yapf.h"
-#include "date.h"
 #include "cargotype.h"
 #include "group.h"
 #include "table/sprites.h"
@@ -43,6 +42,7 @@
 #include "strings_func.h"
 #include "functions.h"
 #include "window_func.h"
+#include "date_func.h"
 
 
 static bool TrainCheckIfLineEnds(Vehicle *v);
--- a/src/tunnelbridge_cmd.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/tunnelbridge_cmd.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -27,13 +27,13 @@
 #include "train.h"
 #include "water_map.h"
 #include "yapf/yapf.h"
-#include "date.h"
 #include "newgrf_sound.h"
 #include "autoslope.h"
 #include "transparency.h"
 #include "tunnelbridge_map.h"
 #include "table/bridge_land.h"
 #include "strings_func.h"
+#include "date_func.h"
 #include "functions.h"
 
 
--- a/src/variables.h	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/variables.h	Wed Dec 26 13:50:40 2007 +0000
@@ -9,6 +9,7 @@
 #include "openttd.h"
 #include "tile_type.h"
 #include "strings_type.h"
+#include "date_type.h"
 
 /* ********* START OF SAVE REGION */
 
--- a/src/vehicle.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/vehicle.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -33,7 +33,6 @@
 #include "water_map.h"
 #include "network/network.h"
 #include "yapf/yapf.h"
-#include "date.h"
 #include "newgrf_callbacks.h"
 #include "newgrf_engine.h"
 #include "newgrf_sound.h"
@@ -42,6 +41,7 @@
 #include "strings_func.h"
 #include "zoom_func.h"
 #include "functions.h"
+#include "date_func.h"
 #include "window_func.h"
 
 #define INVALID_COORD (0x7fffffff)
--- a/src/vehicle.h	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/vehicle.h	Wed Dec 26 13:50:40 2007 +0000
@@ -14,6 +14,7 @@
 #include "window_type.h"
 #include "gfx_type.h"
 #include "command_type.h"
+#include "date_type.h"
 #include "oldpool.h"
 #include "order.h"
 #include "cargopacket.h"
--- a/src/vehicle_gui.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/vehicle_gui.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -22,7 +22,6 @@
 #include "newgrf_callbacks.h"
 #include "newgrf_engine.h"
 #include "newgrf_text.h"
-#include "date.h"
 #include "ship.h"
 #include "aircraft.h"
 #include "roadveh.h"
--- a/src/waypoint.cpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/waypoint.cpp	Wed Dec 26 13:50:40 2007 +0000
@@ -19,7 +19,6 @@
 #include "table/strings.h"
 #include "vehicle.h"
 #include "yapf/yapf.h"
-#include "date.h"
 #include "newgrf.h"
 #include "string.h"
 #include "misc/autoptr.hpp"
@@ -28,6 +27,7 @@
 #include "functions.h"
 #include "window_func.h"
 #include "economy_func.h"
+#include "date_func.h"
 
 enum {
 	MAX_WAYPOINTS_PER_TOWN = 64,
--- a/src/yapf/yapf.hpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/yapf/yapf.hpp	Wed Dec 26 13:50:40 2007 +0000
@@ -16,7 +16,6 @@
 #include "../bridge.h"
 #include "../station.h"
 #include "../station_map.h"
-#include "../date.h"
 #include "../tile_cmd.h"
 #include "../landscape.h"
 #include "yapf.h"
--- a/src/yapf/yapf_costcache.hpp	Wed Dec 26 11:45:43 2007 +0000
+++ b/src/yapf/yapf_costcache.hpp	Wed Dec 26 13:50:40 2007 +0000
@@ -5,6 +5,7 @@
 #ifndef  YAPF_COSTCACHE_HPP
 #define  YAPF_COSTCACHE_HPP
 
+#include "../date_func.h"
 
 /** CYapfSegmentCostCacheNoneT - the formal only yapf cost cache provider that implements
  * PfNodeCacheFetch() and PfNodeCacheFlush() callbacks. Used when nodes don't have CachedData