summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ai/default/default.cpp2
-rw-r--r--src/ai/trolly/trolly.cpp2
-rw-r--r--src/aircraft_cmd.cpp2
-rw-r--r--src/airport.cpp2
-rw-r--r--src/build_vehicle_gui.cpp2
-rw-r--r--src/console_cmds.cpp2
-rw-r--r--src/currency.cpp2
-rw-r--r--src/currency.h2
-rw-r--r--src/date.cpp2
-rw-r--r--src/date_func.h19
-rw-r--r--src/date_type.h (renamed from src/date.h)27
-rw-r--r--src/disaster_cmd.cpp2
-rw-r--r--src/economy.cpp2
-rw-r--r--src/engine.cpp2
-rw-r--r--src/engine.h1
-rw-r--r--src/genworld.cpp2
-rw-r--r--src/genworld_gui.cpp2
-rw-r--r--src/graph_gui.cpp2
-rw-r--r--src/group_gui.cpp1
-rw-r--r--src/industry.h1
-rw-r--r--src/industry_cmd.cpp2
-rw-r--r--src/industry_gui.cpp1
-rw-r--r--src/landscape.cpp2
-rw-r--r--src/main_gui.cpp2
-rw-r--r--src/misc.cpp2
-rw-r--r--src/misc_gui.cpp2
-rw-r--r--src/network/core/game.h2
-rw-r--r--src/network/core/udp.cpp1
-rw-r--r--src/network/network.cpp2
-rw-r--r--src/network/network_client.cpp1
-rw-r--r--src/network/network_gui.cpp2
-rw-r--r--src/network/network_server.cpp2
-rw-r--r--src/network/network_udp.cpp2
-rw-r--r--src/newgrf.cpp2
-rw-r--r--src/newgrf_engine.cpp2
-rw-r--r--src/newgrf_house.cpp1
-rw-r--r--src/newgrf_industries.cpp1
-rw-r--r--src/newgrf_spritegroup.cpp2
-rw-r--r--src/newgrf_station.cpp2
-rw-r--r--src/newgrf_text.cpp1
-rw-r--r--src/news.h1
-rw-r--r--src/news_gui.cpp2
-rw-r--r--src/oldloader.cpp2
-rw-r--r--src/openttd.cpp2
-rw-r--r--src/openttd.h9
-rw-r--r--src/player.h1
-rw-r--r--src/player_gui.cpp2
-rw-r--r--src/players.cpp2
-rw-r--r--src/rail_gui.cpp2
-rw-r--r--src/roadveh_cmd.cpp2
-rw-r--r--src/screenshot.cpp2
-rw-r--r--src/settings.cpp1
-rw-r--r--src/settings_gui.cpp1
-rw-r--r--src/ship_cmd.cpp2
-rw-r--r--src/station.cpp2
-rw-r--r--src/station_cmd.cpp2
-rw-r--r--src/station_gui.cpp1
-rw-r--r--src/strings.cpp2
-rw-r--r--src/subsidy_gui.cpp2
-rw-r--r--src/texteff.cpp2
-rw-r--r--src/tile_cmd.h1
-rw-r--r--src/timetable_cmd.cpp1
-rw-r--r--src/timetable_gui.cpp1
-rw-r--r--src/town.h1
-rw-r--r--src/town_cmd.cpp1
-rw-r--r--src/town_map.h2
-rw-r--r--src/train_cmd.cpp2
-rw-r--r--src/tunnelbridge_cmd.cpp2
-rw-r--r--src/variables.h1
-rw-r--r--src/vehicle.cpp2
-rw-r--r--src/vehicle.h1
-rw-r--r--src/vehicle_gui.cpp1
-rw-r--r--src/waypoint.cpp2
-rw-r--r--src/yapf/yapf.hpp1
-rw-r--r--src/yapf/yapf_costcache.hpp1
75 files changed, 88 insertions, 87 deletions
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp
index dbedb9720..ae0e247de 100644
--- a/src/ai/default/default.cpp
+++ b/src/ai/default/default.cpp
@@ -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"
diff --git a/src/ai/trolly/trolly.cpp b/src/ai/trolly/trolly.cpp
index d03ea19b2..fe0f91395 100644
--- a/src/ai/trolly/trolly.cpp
+++ b/src/ai/trolly/trolly.cpp
@@ -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"
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index 38cc6f855..df149669e 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -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)
diff --git a/src/airport.cpp b/src/airport.cpp
index 719be3dd7..6002ab411 100644
--- a/src/airport.cpp
+++ b/src/airport.cpp
@@ -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
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index bdf970626..7d8102735 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -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 {
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index c25914831..9eb085453 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -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;
diff --git a/src/currency.cpp b/src/currency.cpp
index 8d7ecbef7..091a9fd80 100644
--- a/src/currency.cpp
+++ b/src/currency.cpp
@@ -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 |
diff --git a/src/currency.h b/src/currency.h
index 86b46e713..8d1eaff74 100644
--- a/src/currency.h
+++ b/src/currency.h
@@ -5,6 +5,8 @@
#ifndef CURRENCY_H
#define CURRENCY_H
+#include "date_type.h"
+
enum {
CF_NOEURO = 0,
CF_ISEURO = 1,
diff --git a/src/date.cpp b/src/date.cpp
index 36a87d194..adb54fd97 100644
--- a/src/date.cpp
+++ b/src/date.cpp
@@ -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
diff --git a/src/date_func.h b/src/date_func.h
new file mode 100644
index 000000000..d196fdb52
--- /dev/null
+++ b/src/date_func.h
@@ -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 */
diff --git a/src/date.h b/src/date_type.h
index 3e279f7e6..86885faeb 100644
--- a/src/date.h
+++ b/src/date_type.h
@@ -1,11 +1,9 @@
/* $Id$ */
-/** @file date.h */
+/** @file date_type.h Types related to the dates in OpenTTD. */
-#ifndef DATE_H
-#define DATE_H
-
-#include "openttd.h"
+#ifndef DATE_TYPE_H
+#define DATE_TYPE_H
/**
* 1 day is 74 ticks; _date_fract used to be uint16 and incremented by 885. On
@@ -39,10 +37,12 @@
* be encoded in a single 32 bits date, about 2^31 / 366 years. */
#define MAX_YEAR 5000000
-/* Year and Date are defined elsewhere */
+typedef int32 Date;
+typedef uint16 DateFract;
+
+typedef int32 Year;
typedef uint8 Month;
typedef uint8 Day;
-typedef uint16 DateFract;
struct YearMonthDay {
Year year;
@@ -50,14 +50,7 @@ struct YearMonthDay {
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);
+static const Year INVALID_YEAR = -1;
+static const Date INVALID_DATE = -1;
-#endif /* DATE_H */
+#endif /* DATE_TYPE_H */
diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp
index 592b54d40..f41663d0b 100644
--- a/src/disaster_cmd.cpp
+++ b/src/disaster_cmd.cpp
@@ -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 {
diff --git a/src/economy.cpp b/src/economy.cpp
index 28a7a50e0..84e0af5ed 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -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.
diff --git a/src/engine.cpp b/src/engine.cpp
index ceb9e6401..9b6d388c0 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -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];
diff --git a/src/engine.h b/src/engine.h
index ce9795ab9..8fece3082 100644
--- a/src/engine.h
+++ b/src/engine.h
@@ -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 {
diff --git a/src/genworld.cpp b/src/genworld.cpp
index 418bfb812..b374fdee4 100644
--- a/src/genworld.cpp
+++ b/src/genworld.cpp
@@ -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();
diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp
index 109c19f88..f8306e794 100644
--- a/src/genworld_gui.cpp
+++ b/src/genworld_gui.cpp
@@ -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.
diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp
index 393cac5ff..96aa63b90 100644
--- a/src/graph_gui.cpp
+++ b/src/graph_gui.cpp
@@ -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;
diff --git a/src/group_gui.cpp b/src/group_gui.cpp
index 41c5b0361..d891e3a38 100644
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -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"
diff --git a/src/industry.h b/src/industry.h
index 1350b351a..4e6dcb95d 100644
--- a/src/industry.h
+++ b/src/industry.h
@@ -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;
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index b332efd9d..09b4a08e8 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -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);
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index ce4f740b3..f90c8e6a1 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -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"
diff --git a/src/landscape.cpp b/src/landscape.cpp
index 0dc998ffc..ad92bc2ff 100644
--- a/src/landscape.cpp
+++ b/src/landscape.cpp
@@ -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,
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index 5fc5e4c2d..8f1954396 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -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"
diff --git a/src/misc.cpp b/src/misc.cpp
index 4a297d007..47d532aba 100644
--- a/src/misc.cpp
+++ b/src/misc.cpp
@@ -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];
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index da8f773c3..1f0deb8df 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -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;
diff --git a/src/network/core/game.h b/src/network/core/game.h
index 049e5020e..0c0123697 100644
--- a/src/network/core/game.h
+++ b/src/network/core/game.h
@@ -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
diff --git a/src/network/core/udp.cpp b/src/network/core/udp.cpp
index 8cd22ce62..6c8b56a53 100644
--- a/src/network/core/udp.cpp
+++ b/src/network/core/udp.cpp
@@ -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"
diff --git a/src/network/network.cpp b/src/network/network.cpp
index f7689d116..f1c11a3ec 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -14,7 +14,7 @@ extern const char _openttd_revision[];
#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"
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index 0b830c179..badfde557 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -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"
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 8fab465c1..cd550ee5d 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -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"
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index d1719629e..ed4b93959 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -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"
diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp
index 7388df6ec..573acadfa 100644
--- a/src/network/network_udp.cpp
+++ b/src/network/network_udp.cpp
@@ -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"
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 5ba7cd58e..d4ffc3ee4 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -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)
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp
index dbc2e88bd..e27594922 100644
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -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;
diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp
index c0153b04c..1f9a19491 100644
--- a/src/newgrf_house.cpp
+++ b/src/newgrf_house.cpp
@@ -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"
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index 7c898ab2f..5f5d7693d 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -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
diff --git a/src/newgrf_spritegroup.cpp b/src/newgrf_spritegroup.cpp
index c75565f6d..34f6c69ed 100644
--- a/src/newgrf_spritegroup.cpp
+++ b/src/newgrf_spritegroup.cpp
@@ -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);
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp
index 6d0db261e..7a0135501 100644
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -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];
diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp
index c3df2f1be..7866e2fa7 100644
--- a/src/newgrf_text.cpp
+++ b/src/newgrf_text.cpp
@@ -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
diff --git a/src/news.h b/src/news.h
index 23b84fa11..5d9baf94a 100644
--- a/src/news.h
+++ b/src/news.h
@@ -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)
diff --git a/src/news_gui.cpp b/src/news_gui.cpp
index a3c24084d..f4ebd5e88 100644
--- a/src/news_gui.cpp
+++ b/src/news_gui.cpp
@@ -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
*
diff --git a/src/oldloader.cpp b/src/oldloader.cpp
index 7deb8d22c..f3b3d65d5 100644
--- a/src/oldloader.cpp
+++ b/src/oldloader.cpp
@@ -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,
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 616aae591..81cdfabca 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -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"
diff --git a/src/openttd.h b/src/openttd.h
index c99b68d78..e5a6564d4 100644
--- a/src/openttd.h
+++ b/src/openttd.h
@@ -49,15 +49,6 @@ assert_compile(sizeof(DestinationID) == sizeof(DepotID));
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 {
diff --git a/src/player.h b/src/player.h
index f14d2e8d7..b53e21299 100644
--- a/src/player.h
+++ b/src/player.h
@@ -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"
diff --git a/src/player_gui.cpp b/src/player_gui.cpp
index 1887b48f7..cea411aa9 100644
--- a/src/player_gui.cpp
+++ b/src/player_gui.cpp
@@ -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);
diff --git a/src/players.cpp b/src/players.cpp
index 34aa25534..9f0f41cc0 100644
--- a/src/players.cpp
+++ b/src/players.cpp
@@ -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
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 85a8ec563..b33956dbb 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -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"
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 5a6fcd072..537a50662 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -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] = {
diff --git a/src/screenshot.cpp b/src/screenshot.cpp
index ea377981c..8b585f75a 100644
--- a/src/screenshot.cpp
+++ b/src/screenshot.cpp
@@ -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;
diff --git a/src/settings.cpp b/src/settings.cpp
index 936088d67..9dc4e5431 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -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"
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 64395cb36..442fa8b71 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -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"
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index e318689be..dde0843f9 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -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};
diff --git a/src/station.cpp b/src/station.cpp
index 49b26707b..8ad4499fb 100644
--- a/src/station.cpp
+++ b/src/station.cpp
@@ -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)
{
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index e7ad0b8c3..184e54c0a 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -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)
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 63345d11c..e6617270d 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -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"
diff --git a/src/strings.cpp b/src/strings.cpp
index 0ca9bfa79..b8df9af16 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -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"
diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp
index e1cf5ada9..2b638a602 100644
--- a/src/subsidy_gui.cpp
+++ b/src/subsidy_gui.cpp
@@ -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)
{
diff --git a/src/texteff.cpp b/src/texteff.cpp
index 8dab8f5ad..407ad8ebd 100644
--- a/src/texteff.cpp
+++ b/src/texteff.cpp
@@ -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 {
diff --git a/src/tile_cmd.h b/src/tile_cmd.h
index 4b08e9c5b..dacdfc571 100644
--- a/src/tile_cmd.h
+++ b/src/tile_cmd.h
@@ -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 {
diff --git a/src/timetable_cmd.cpp b/src/timetable_cmd.cpp
index fd759c195..b1e48d6b5 100644
--- a/src/timetable_cmd.cpp
+++ b/src/timetable_cmd.cpp
@@ -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"
diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp
index ec4b51a11..1bb4eed56 100644
--- a/src/timetable_gui.cpp
+++ b/src/timetable_gui.cpp
@@ -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"
diff --git a/src/town.h b/src/town.h
index 9487c3422..89e7dddbd 100644
--- a/src/town.h
+++ b/src/town.h
@@ -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,
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index bce49db02..c986d38ff 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -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"
diff --git a/src/town_map.h b/src/town_map.h
index 5f8eeaf11..cd63ae983 100644
--- a/src/town_map.h
+++ b/src/town_map.h
@@ -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"
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 107192f4e..b1e96aa40 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -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);
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index 86e0af2ad..963f774ae 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -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"
diff --git a/src/variables.h b/src/variables.h
index b47f7b192..e4af2dcbc 100644
--- a/src/variables.h
+++ b/src/variables.h
@@ -9,6 +9,7 @@
#include "openttd.h"
#include "tile_type.h"
#include "strings_type.h"
+#include "date_type.h"
/* ********* START OF SAVE REGION */
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 46e9fc5f6..9091edaed 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -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)
diff --git a/src/vehicle.h b/src/vehicle.h
index 68bf71bb1..31f3dfa74 100644
--- a/src/vehicle.h
+++ b/src/vehicle.h
@@ -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"
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index f443b343d..f622ba8cd 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -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"
diff --git a/src/waypoint.cpp b/src/waypoint.cpp
index 224af027f..e26e0e80a 100644
--- a/src/waypoint.cpp
+++ b/src/waypoint.cpp
@@ -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,
diff --git a/src/yapf/yapf.hpp b/src/yapf/yapf.hpp
index dda6780c8..f091514f3 100644
--- a/src/yapf/yapf.hpp
+++ b/src/yapf/yapf.hpp
@@ -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"
diff --git a/src/yapf/yapf_costcache.hpp b/src/yapf/yapf_costcache.hpp
index 5b459601a..24e7e2dbd 100644
--- a/src/yapf/yapf_costcache.hpp
+++ b/src/yapf/yapf_costcache.hpp
@@ -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