summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ai/ai.h2
-rw-r--r--src/ai/default/default.cpp2
-rw-r--r--src/ai/trolly/build.cpp1
-rw-r--r--src/ai/trolly/pathfinder.cpp1
-rw-r--r--src/ai/trolly/trolly.cpp1
-rw-r--r--src/aircraft_cmd.cpp3
-rw-r--r--src/aircraft_gui.cpp1
-rw-r--r--src/airport_gui.cpp2
-rw-r--r--src/articulated_vehicles.cpp1
-rw-r--r--src/autoreplace_cmd.cpp2
-rw-r--r--src/autoreplace_gui.cpp2
-rw-r--r--src/blitter/8bpp_debug.cpp2
-rw-r--r--src/bridge_gui.cpp2
-rw-r--r--src/build_vehicle_gui.cpp2
-rw-r--r--src/clear_cmd.cpp3
-rw-r--r--src/command.cpp2
-rw-r--r--src/console.cpp2
-rw-r--r--src/console_cmds.cpp3
-rw-r--r--src/date.cpp3
-rw-r--r--src/debug.cpp1
-rw-r--r--src/debug.h3
-rw-r--r--src/depot.cpp2
-rw-r--r--src/depot_gui.cpp2
-rw-r--r--src/disaster_cmd.cpp1
-rw-r--r--src/dock_gui.cpp2
-rw-r--r--src/driver.cpp1
-rw-r--r--src/economy.cpp3
-rw-r--r--src/elrail.cpp1
-rw-r--r--src/engine.cpp3
-rw-r--r--src/engine_gui.cpp1
-rw-r--r--src/fileio.cpp30
-rw-r--r--src/fileio.h2
-rw-r--r--src/fios.cpp2
-rw-r--r--src/fontcache.cpp2
-rw-r--r--src/functions.h27
-rw-r--r--src/genworld.cpp1
-rw-r--r--src/genworld_gui.cpp2
-rw-r--r--src/gfx.cpp2
-rw-r--r--src/gfxinit.cpp1
-rw-r--r--src/graph_gui.cpp2
-rw-r--r--src/group_cmd.cpp3
-rw-r--r--src/group_gui.cpp2
-rw-r--r--src/gui.h1
-rw-r--r--src/heightmap.cpp1
-rw-r--r--src/industry_cmd.cpp3
-rw-r--r--src/industry_gui.cpp1
-rw-r--r--src/intro_gui.cpp3
-rw-r--r--src/landscape.cpp4
-rw-r--r--src/main_gui.cpp2
-rw-r--r--src/map.cpp2
-rw-r--r--src/misc.cpp2
-rw-r--r--src/misc_cmd.cpp2
-rw-r--r--src/misc_gui.cpp3
-rw-r--r--src/music_gui.cpp2
-rw-r--r--src/network/core/tcp.cpp1
-rw-r--r--src/network/network.cpp3
-rw-r--r--src/network/network_client.cpp2
-rw-r--r--src/network/network_gui.cpp3
-rw-r--r--src/network/network_server.cpp1
-rw-r--r--src/newgrf.cpp1
-rw-r--r--src/newgrf_config.cpp1
-rw-r--r--src/newgrf_engine.cpp1
-rw-r--r--src/newgrf_gui.cpp2
-rw-r--r--src/newgrf_house.cpp2
-rw-r--r--src/newgrf_industries.cpp2
-rw-r--r--src/newgrf_industrytiles.cpp2
-rw-r--r--src/newgrf_spritegroup.h2
-rw-r--r--src/newgrf_town.cpp2
-rw-r--r--src/news_gui.cpp2
-rw-r--r--src/npf.cpp2
-rw-r--r--src/oldloader.cpp2
-rw-r--r--src/oldpool.cpp1
-rw-r--r--src/openttd.cpp29
-rw-r--r--src/order_cmd.cpp3
-rw-r--r--src/order_gui.cpp2
-rw-r--r--src/os/macosx/splash.cpp1
-rw-r--r--src/os2.cpp3
-rw-r--r--src/player_face.h2
-rw-r--r--src/player_gui.cpp3
-rw-r--r--src/players.cpp2
-rw-r--r--src/rail_gui.cpp3
-rw-r--r--src/road.cpp1
-rw-r--r--src/road_gui.cpp3
-rw-r--r--src/roadveh_cmd.cpp2
-rw-r--r--src/roadveh_gui.cpp1
-rw-r--r--src/saveload.cpp2
-rw-r--r--src/screenshot.cpp1
-rw-r--r--src/settings.cpp1
-rw-r--r--src/settings.h5
-rw-r--r--src/settings_gui.cpp3
-rw-r--r--src/ship_cmd.cpp3
-rw-r--r--src/ship_gui.cpp1
-rw-r--r--src/signs.cpp3
-rw-r--r--src/signs_gui.cpp2
-rw-r--r--src/smallmap_gui.cpp1
-rw-r--r--src/sound.cpp1
-rw-r--r--src/sound/win32_s.cpp1
-rw-r--r--src/spritecache.cpp2
-rw-r--r--src/station.cpp3
-rw-r--r--src/station_cmd.cpp2
-rw-r--r--src/station_gui.cpp2
-rw-r--r--src/string.cpp1
-rw-r--r--src/strings.cpp2
-rw-r--r--src/subsidy_gui.cpp1
-rw-r--r--src/terraform_gui.cpp2
-rw-r--r--src/texteff.cpp2
-rw-r--r--src/tgp.cpp2
-rw-r--r--src/timetable_cmd.cpp3
-rw-r--r--src/timetable_gui.cpp1
-rw-r--r--src/town.h10
-rw-r--r--src/town_cmd.cpp1
-rw-r--r--src/town_gui.cpp1
-rw-r--r--src/town_map.h1
-rw-r--r--src/train_cmd.cpp2
-rw-r--r--src/train_gui.cpp1
-rw-r--r--src/transparency_gui.cpp1
-rw-r--r--src/tree_cmd.cpp2
-rw-r--r--src/tunnelbridge_cmd.cpp1
-rw-r--r--src/unix.cpp3
-rw-r--r--src/unmovable_cmd.cpp2
-rw-r--r--src/vehicle.cpp2
-rw-r--r--src/vehicle.h2
-rw-r--r--src/vehicle_gui.cpp3
-rw-r--r--src/video/cocoa/wnd_quartz.mm1
-rw-r--r--src/video/cocoa/wnd_quickdraw.mm1
-rw-r--r--src/video/dedicated_v.cpp1
-rw-r--r--src/video/sdl_v.cpp1
-rw-r--r--src/video/win32_v.cpp1
-rw-r--r--src/water_cmd.cpp2
-rw-r--r--src/waypoint.cpp3
-rw-r--r--src/widget.cpp3
-rw-r--r--src/win32.cpp3
-rw-r--r--src/window.cpp1
-rw-r--r--src/window_func.h7
134 files changed, 180 insertions, 169 deletions
diff --git a/src/ai/ai.h b/src/ai/ai.h
index 081d3e969..2fdb3c986 100644
--- a/src/ai/ai.h
+++ b/src/ai/ai.h
@@ -3,10 +3,10 @@
#ifndef AI_H
#define AI_H
-#include "../functions.h"
#include "../network/network.h"
#include "../player.h"
#include "../command_type.h"
+#include "../core/random_func.hpp"
/* How DoCommands look like for an AI */
struct AICommand {
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp
index b16fd8e30..8c016afc7 100644
--- a/src/ai/default/default.cpp
+++ b/src/ai/default/default.cpp
@@ -26,6 +26,8 @@
#include "../../bridge.h"
#include "../../date.h"
#include "../../tunnelbridge_map.h"
+#include "../../window_func.h"
+#include "../../functions.h"
#include "default.h"
diff --git a/src/ai/trolly/build.cpp b/src/ai/trolly/build.cpp
index 53bf9b782..932e23aca 100644
--- a/src/ai/trolly/build.cpp
+++ b/src/ai/trolly/build.cpp
@@ -3,7 +3,6 @@
#include "../../stdafx.h"
#include "../../openttd.h"
#include "../../debug.h"
-#include "../../functions.h"
#include "../../map.h"
#include "../../road_map.h"
#include "../../vehicle.h"
diff --git a/src/ai/trolly/pathfinder.cpp b/src/ai/trolly/pathfinder.cpp
index b81ddfebb..c97e080c7 100644
--- a/src/ai/trolly/pathfinder.cpp
+++ b/src/ai/trolly/pathfinder.cpp
@@ -4,7 +4,6 @@
#include "../../openttd.h"
#include "../../bridge_map.h"
#include "../../debug.h"
-#include "../../functions.h"
#include "../../map.h"
#include "../../command_func.h"
#include "trolly.h"
diff --git a/src/ai/trolly/trolly.cpp b/src/ai/trolly/trolly.cpp
index 373e297d2..388d59906 100644
--- a/src/ai/trolly/trolly.cpp
+++ b/src/ai/trolly/trolly.cpp
@@ -20,7 +20,6 @@
#include "../../stdafx.h"
#include "../../openttd.h"
#include "../../debug.h"
-#include "../../functions.h"
#include "../../road_map.h"
#include "../../station_map.h"
#include "table/strings.h"
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index 5baa1c74a..39728ffdc 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -7,7 +7,6 @@
#include "openttd.h"
#include "aircraft.h"
#include "debug.h"
-#include "functions.h"
#include "landscape.h"
#include "station_map.h"
#include "table/strings.h"
@@ -33,6 +32,8 @@
#include "cargotype.h"
#include "strings_func.h"
#include "command_func.h"
+#include "window_func.h"
+#include "functions.h"
void Aircraft::UpdateDeltaXY(Direction direction)
{
diff --git a/src/aircraft_gui.cpp b/src/aircraft_gui.cpp
index 426092bcd..d33722c14 100644
--- a/src/aircraft_gui.cpp
+++ b/src/aircraft_gui.cpp
@@ -6,7 +6,6 @@
#include "openttd.h"
#include "aircraft.h"
#include "debug.h"
-#include "functions.h"
#include "table/sprites.h"
#include "table/strings.h"
#include "map.h"
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index a19a3098e..8052f5df2 100644
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -6,7 +6,6 @@
#include "openttd.h"
#include "table/sprites.h"
#include "table/strings.h"
-#include "functions.h"
#include "map.h"
#include "window_gui.h"
#include "gui.h"
@@ -18,6 +17,7 @@
#include "station.h"
#include "airport.h"
#include "depot.h"
+#include "window_func.h"
static byte _selected_airport_type;
diff --git a/src/articulated_vehicles.cpp b/src/articulated_vehicles.cpp
index 35d1d4e86..2afa0aa75 100644
--- a/src/articulated_vehicles.cpp
+++ b/src/articulated_vehicles.cpp
@@ -4,7 +4,6 @@
#include "stdafx.h"
#include "openttd.h"
-#include "functions.h"
#include "vehicle.h"
#include "articulated_vehicles.h"
#include "engine.h"
diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp
index 994deee13..05d97973f 100644
--- a/src/autoreplace_cmd.cpp
+++ b/src/autoreplace_cmd.cpp
@@ -5,7 +5,6 @@
#include "roadveh.h"
#include "ship.h"
#include "table/strings.h"
-#include "functions.h"
#include "news.h"
#include "player.h"
#include "engine.h"
@@ -19,6 +18,7 @@
#include "order.h"
#include "strings_func.h"
#include "command_func.h"
+#include "functions.h"
/*
* move the cargo from one engine to another if possible
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index 2d666edea..552cdeef2 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
-#include "functions.h"
#include "table/sprites.h"
#include "table/strings.h"
#include "gui.h"
@@ -16,6 +15,7 @@
#include "group.h"
#include "rail.h"
#include "strings_func.h"
+#include "window_func.h"
static RailType _railtype_selected_in_replace_gui;
diff --git a/src/blitter/8bpp_debug.cpp b/src/blitter/8bpp_debug.cpp
index da4b7998f..d084965a1 100644
--- a/src/blitter/8bpp_debug.cpp
+++ b/src/blitter/8bpp_debug.cpp
@@ -4,7 +4,7 @@
#include "../stdafx.h"
#include "../zoom_func.h"
-#include "../functions.h"
+#include "../core/random_func.hpp"
#include "8bpp_debug.hpp"
static FBlitter_8bppDebug iFBlitter_8bppDebug;
diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp
index 5b0d0c32c..8d8d9fa99 100644
--- a/src/bridge_gui.cpp
+++ b/src/bridge_gui.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "table/strings.h"
-#include "functions.h"
#include "map.h"
#include "gui.h"
#include "window_gui.h"
@@ -16,6 +15,7 @@
#include "variables.h"
#include "bridge.h"
#include "strings_func.h"
+#include "window_func.h"
static struct BridgeData {
uint8 last_size;
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index 83d5d709f..bdf970626 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -9,7 +9,6 @@
#include "ship.h"
#include "aircraft.h"
#include "debug.h"
-#include "functions.h"
#include "table/sprites.h"
#include "table/strings.h"
#include "gui.h"
@@ -29,6 +28,7 @@
#include "group.h"
#include "road_map.h"
#include "strings_func.h"
+#include "window_func.h"
enum BuildVehicleWidgets {
diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp
index 117cdd385..d1c3eb57b 100644
--- a/src/clear_cmd.cpp
+++ b/src/clear_cmd.cpp
@@ -7,7 +7,6 @@
#include "clear_map.h"
#include "rail_map.h"
#include "table/strings.h"
-#include "functions.h"
#include "map.h"
#include "player.h"
#include "viewport.h"
@@ -23,6 +22,8 @@
#include "industry.h"
#include "water_map.h"
#include "tile_cmd.h"
+#include "vehicle.h"
+#include "functions.h"
/*
* In one terraforming command all four corners of a initial tile can be raised/lowered (though this is not available to the player).
diff --git a/src/command.cpp b/src/command.cpp
index 7cac47d15..141957abc 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "table/strings.h"
-#include "functions.h"
#include "landscape.h"
#include "map.h"
#include "tile_map.h"
@@ -18,6 +17,7 @@
#include "newgrf_storage.h"
#include "strings_func.h"
#include "gfx_func.h"
+#include "functions.h"
const char *_cmd_text = NULL;
diff --git a/src/console.cpp b/src/console.cpp
index f18c6749c..a85b21c4c 100644
--- a/src/console.cpp
+++ b/src/console.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "table/strings.h"
-#include "functions.h"
#include "gui.h"
#include "textbuf_gui.h"
#include "window_gui.h"
@@ -19,6 +18,7 @@
#include "network/network_data.h"
#include "network/network_server.h"
#include "core/alloc_func.hpp"
+#include "window_func.h"
#define ICON_BUFFER 79
#define ICON_HISTORY_SIZE 20
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index 8cd8fe41d..2cf4fb9d7 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -7,7 +7,6 @@
#include "console.h"
#include "debug.h"
#include "engine.h"
-#include "functions.h"
#include "landscape.h"
#include "saveload.h"
#include "string.h"
@@ -28,6 +27,8 @@
#include "network/network.h"
#include "strings_func.h"
#include "viewport.h"
+#include "window_func.h"
+#include "functions.h"
// ** scriptfile handling ** //
static FILE *_script_file;
diff --git a/src/date.cpp b/src/date.cpp
index 7f33fb744..36a87d194 100644
--- a/src/date.cpp
+++ b/src/date.cpp
@@ -10,8 +10,9 @@
#include "network/network.h"
#include "network/network_data.h"
#include "network/network_server.h"
-#include "functions.h"
#include "currency.h"
+#include "window_func.h"
+#include "functions.h"
#ifdef DEBUG_DUMP_COMMANDS
#include "saveload.h"
#endif
diff --git a/src/debug.cpp b/src/debug.cpp
index 2e645e1e2..41245b979 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -8,7 +8,6 @@
#include "openttd.h"
#include "console.h"
#include "debug.h"
-#include "functions.h"
#include "string.h"
#include "network/core/core.h"
diff --git a/src/debug.h b/src/debug.h
index c84ec7f46..30b495e6f 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -129,4 +129,7 @@ const char *GetDebugString();
}\
}
+void ShowInfo(const char *str);
+void CDECL ShowInfoF(const char *str, ...);
+
#endif /* DEBUG_H */
diff --git a/src/depot.cpp b/src/depot.cpp
index 6555c2c70..49327a3de 100644
--- a/src/depot.cpp
+++ b/src/depot.cpp
@@ -6,12 +6,12 @@
#include "openttd.h"
#include "vehicle.h"
#include "depot.h"
-#include "functions.h"
#include "landscape.h"
#include "map.h"
#include "table/strings.h"
#include "saveload.h"
#include "order.h"
+#include "window_func.h"
DEFINE_OLD_POOL_GENERIC(Depot, Depot)
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index f3a79875b..cedba0835 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -4,7 +4,6 @@
#include "stdafx.h"
#include "openttd.h"
-#include "functions.h"
#include "train.h"
#include "roadveh.h"
#include "ship.h"
@@ -22,6 +21,7 @@
#include "newgrf_engine.h"
#include "spritecache.h"
#include "strings_func.h"
+#include "window_func.h"
/*
* Since all depot window sizes aren't the same, we need to modify sizes a little.
diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp
index 491bcc29c..1a69e36c0 100644
--- a/src/disaster_cmd.cpp
+++ b/src/disaster_cmd.cpp
@@ -39,6 +39,7 @@
#include "table/sprites.h"
#include "date.h"
#include "strings_func.h"
+#include "functions.h"
enum DisasterSubType {
ST_Zeppeliner,
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp
index 855f39a2d..1a8a8f911 100644
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -6,7 +6,6 @@
#include "openttd.h"
#include "table/sprites.h"
#include "table/strings.h"
-#include "functions.h"
#include "map.h"
#include "tile_map.h"
#include "station.h"
@@ -18,6 +17,7 @@
#include "command_func.h"
#include "variables.h"
#include "water.h"
+#include "window_func.h"
static void ShowBuildDockStationPicker();
static void ShowBuildDocksDepotPicker();
diff --git a/src/driver.cpp b/src/driver.cpp
index ddd110bf6..3d3c11c8f 100644
--- a/src/driver.cpp
+++ b/src/driver.cpp
@@ -6,7 +6,6 @@
#include "openttd.h"
#include "debug.h"
#include "driver.h"
-#include "functions.h"
#include "string.h"
#include "sound/sound_driver.hpp"
diff --git a/src/economy.cpp b/src/economy.cpp
index 50bd3de4b..7bea083b2 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "currency.h"
-#include "functions.h"
#include "landscape.h"
#include "table/strings.h"
#include "table/sprites.h"
@@ -40,6 +39,8 @@
#include "group.h"
#include "strings_func.h"
#include "tile_cmd.h"
+#include "functions.h"
+#include "window_func.h"
/**
* Multiply two integer values and shift the results to right.
diff --git a/src/elrail.cpp b/src/elrail.cpp
index 837e04e42..f0517cd3a 100644
--- a/src/elrail.cpp
+++ b/src/elrail.cpp
@@ -49,7 +49,6 @@
#include "openttd.h"
#include "station_map.h"
#include "viewport.h"
-#include "functions.h" /* We should REALLY get rid of this goddamn file, as it is butt-ugly */
#include "variables.h" /* ... same here */
#include "landscape.h"
#include "rail_type.h"
diff --git a/src/engine.cpp b/src/engine.cpp
index dad623593..ceb9e6401 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
-#include "functions.h"
#include "table/strings.h"
#include "engine.h"
#include "player.h"
@@ -24,6 +23,8 @@
#include "misc/autoptr.hpp"
#include "strings_func.h"
#include "viewport.h"
+#include "functions.h"
+#include "window_func.h"
EngineInfo _engine_info[TOTAL_NUM_ENGINES];
RailVehicleInfo _rail_vehicle_info[NUM_TRAIN_ENGINES];
diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp
index 7586c0fb6..1c6db10de 100644
--- a/src/engine_gui.cpp
+++ b/src/engine_gui.cpp
@@ -6,7 +6,6 @@
#include "openttd.h"
#include "table/strings.h"
#include "table/sprites.h"
-#include "functions.h"
#include "gui.h"
#include "window_gui.h"
#include "viewport.h"
diff --git a/src/fileio.cpp b/src/fileio.cpp
index 3190013ca..513286dea 100644
--- a/src/fileio.cpp
+++ b/src/fileio.cpp
@@ -5,12 +5,12 @@
#include "stdafx.h"
#include "openttd.h"
#include "fileio.h"
-#include "functions.h"
#include "string.h"
#include "variables.h"
#include "debug.h"
#include "fios.h"
#include "core/alloc_func.hpp"
+#include "core/math_func.hpp"
#ifdef WIN32
#include <windows.h>
#else
@@ -764,3 +764,31 @@ void SanitizeFilename(char *filename)
}
}
}
+
+void *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize)
+{
+ FILE *in;
+ byte *mem;
+ size_t len;
+
+ in = fopen(filename, "rb");
+ if (in == NULL) return NULL;
+
+ fseek(in, 0, SEEK_END);
+ len = ftell(in);
+ fseek(in, 0, SEEK_SET);
+ if (len > maxsize || (mem = MallocT<byte>(len + 1)) == NULL) {
+ fclose(in);
+ return NULL;
+ }
+ mem[len] = 0;
+ if (fread(mem, len, 1, in) != 1) {
+ fclose(in);
+ free(mem);
+ return NULL;
+ }
+ fclose(in);
+
+ *lenp = len;
+ return mem;
+}
diff --git a/src/fileio.h b/src/fileio.h
index 9e589ba71..a8dfc5644 100644
--- a/src/fileio.h
+++ b/src/fileio.h
@@ -112,6 +112,8 @@ static inline const char *FioGetSubdirectory(Subdirectory subdir)
void SanitizeFilename(char *filename);
void AppendPathSeparator(char *buf, size_t buflen);
void DeterminePaths(const char *exe);
+void *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize);
+bool FileExists(const char *filename);
extern char *_personal_dir; ///< custom directory for personal settings, saves, newgrf, etc.
diff --git a/src/fios.cpp b/src/fios.cpp
index b2352d957..db8e4218b 100644
--- a/src/fios.cpp
+++ b/src/fios.cpp
@@ -8,12 +8,12 @@
#include "openttd.h"
#include "string.h"
#include "variables.h"
-#include "functions.h"
#include "heightmap.h"
#include "table/strings.h"
#include "fios.h"
#include "fileio.h"
#include "core/alloc_func.hpp"
+#include "functions.h"
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/src/fontcache.cpp b/src/fontcache.cpp
index 1f48d20db..d988ed7c5 100644
--- a/src/fontcache.cpp
+++ b/src/fontcache.cpp
@@ -4,7 +4,6 @@
#include "stdafx.h"
#include "openttd.h"
-#include "functions.h"
#include "debug.h"
#include "table/sprites.h"
#include "table/control_codes.h"
@@ -15,6 +14,7 @@
#include "blitter/factory.hpp"
#include "gfx_func.h"
#include "core/alloc_func.hpp"
+#include "core/math_func.hpp"
#ifdef WITH_FREETYPE
diff --git a/src/functions.h b/src/functions.h
index a1e136de9..528f9fd85 100644
--- a/src/functions.h
+++ b/src/functions.h
@@ -7,11 +7,8 @@
#include "core/random_func.hpp"
#include "command_type.h"
-#include "window_type.h"
#include "openttd.h"
-void UpdateTownMaxPass(Town *t);
-
/* clear_land.cpp */
void DrawHillyLandTile(const TileInfo *ti);
void DrawClearLandTile(const TileInfo *ti, byte set);
@@ -25,10 +22,6 @@ void SubtractMoneyFromPlayerFract(PlayerID player, CommandCost cost);
bool CheckOwnership(Owner owner);
bool CheckTileOwnership(TileIndex tile);
-/* standard */
-void ShowInfo(const char *str);
-void CDECL ShowInfoF(const char *str, ...);
-
/* openttd.cpp */
static inline TileIndex RandomTileSeed(uint32 r) { return TILE_MASK(r); }
static inline TileIndex RandomTile() { return TILE_MASK(Random()); }
@@ -67,14 +60,6 @@ void MarkTileDirty(int x, int y);
* @ingroup dirty
*/
void MarkTileDirtyByTile(TileIndex tile);
-void InvalidateWindow(WindowClass cls, WindowNumber number);
-void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_index);
-void InvalidateWindowClasses(WindowClass cls);
-void InvalidateWindowClassesData(WindowClass cls);
-void DeleteWindowById(WindowClass cls, WindowNumber number);
-void DeleteWindowByClass(WindowClass cls);
-
-bool EnsureNoVehicleOnGround(TileIndex tile);
/**
* Mark all viewports dirty for repaint.
@@ -85,15 +70,8 @@ void MarkAllViewportsDirty(int left, int top, int right, int bottom);
void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost);
void ShowFeederIncomeAnimation(int x, int y, int z, Money cost);
-bool CheckIfAuthorityAllows(TileIndex tile);
-Town *ClosestTownFromTile(TileIndex tile, uint threshold);
-void ChangeTownRating(Town *t, int add, int max);
-
-uint GetTownRadiusGroup(const Town* t, TileIndex tile);
void ShowHighscoreTable(int difficulty, int8 rank);
-void AfterLoadTown();
-void UpdatePatches();
void AskExitGame();
void AskExitToGameMenu();
@@ -115,13 +93,8 @@ void ShowSaveLoadDialog(int mode);
/* callback from drivers that is called if the game size changes dynamically */
void GameSizeChanged();
-bool FileExists(const char *filename);
const char *GetCurrentLocale(const char *param);
-void *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize);
-void LoadFromConfig();
-void SaveToConfig();
-void CheckConfig();
int ttd_main(int argc, char* argv[]);
void HandleExitGameRequest();
diff --git a/src/genworld.cpp b/src/genworld.cpp
index e97d64bff..dae486e8d 100644
--- a/src/genworld.cpp
+++ b/src/genworld.cpp
@@ -4,7 +4,6 @@
#include "stdafx.h"
#include "openttd.h"
-#include "functions.h"
#include "landscape.h"
#include "player.h"
#include "table/sprites.h"
diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp
index d41ba4251..109c19f88 100644
--- a/src/genworld_gui.cpp
+++ b/src/genworld_gui.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "heightmap.h"
-#include "functions.h"
#include "table/strings.h"
#include "table/sprites.h"
#include "gui.h"
@@ -25,6 +24,7 @@
#include "date.h"
#include "newgrf_config.h"
#include "strings_func.h"
+#include "window_func.h"
/**
* In what 'mode' the GenerateLandscapeWindowProc is.
diff --git a/src/gfx.cpp b/src/gfx.cpp
index b84bf63b3..b198c2e11 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -4,7 +4,6 @@
#include "stdafx.h"
#include "openttd.h"
-#include "functions.h"
#include "gfx_func.h"
#include "spritecache.h"
#include "string.h"
@@ -20,6 +19,7 @@
#include "blitter/factory.hpp"
#include "video/video_driver.hpp"
#include "strings_func.h"
+#include "core/math_func.hpp"
byte _dirkeys; ///< 1 = left, 2 = up, 4 = right, 8 = down
bool _fullscreen;
diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp
index b98ea8223..73c289cc2 100644
--- a/src/gfxinit.cpp
+++ b/src/gfxinit.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
-#include "functions.h"
#include "gfxinit.h"
#include "spritecache.h"
#include "table/sprites.h"
diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp
index f4b7e09a7..393cac5ff 100644
--- a/src/graph_gui.cpp
+++ b/src/graph_gui.cpp
@@ -6,7 +6,6 @@
#include "openttd.h"
#include "table/strings.h"
#include "table/sprites.h"
-#include "functions.h"
#include "gui.h"
#include "window_gui.h"
#include "player.h"
@@ -16,6 +15,7 @@
#include "cargotype.h"
#include "strings_func.h"
#include "core/alloc_func.hpp"
+#include "window_func.h"
/* Bitmasks of player and cargo indices that shouldn't be drawn. */
static uint _legend_excluded_players;
diff --git a/src/group_cmd.cpp b/src/group_cmd.cpp
index 2156df5a6..a9582a073 100644
--- a/src/group_cmd.cpp
+++ b/src/group_cmd.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "variables.h"
-#include "functions.h"
#include "player.h"
#include "table/strings.h"
#include "command_func.h"
@@ -19,6 +18,8 @@
#include "vehicle_gui.h"
#include "misc/autoptr.hpp"
#include "strings_func.h"
+#include "functions.h"
+#include "window_func.h"
/**
* Update the num engines of a groupID. Decrease the old one and increase the new one
diff --git a/src/group_gui.cpp b/src/group_gui.cpp
index 09606ce37..41c5b0361 100644
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -4,7 +4,6 @@
#include "stdafx.h"
#include "openttd.h"
-#include "functions.h"
#include "table/strings.h"
#include "table/sprites.h"
#include "gui.h"
@@ -22,6 +21,7 @@
#include "debug.h"
#include "strings_func.h"
#include "core/alloc_func.hpp"
+#include "window_func.h"
struct Sorting {
diff --git a/src/gui.h b/src/gui.h
index c758f13c2..5736821e8 100644
--- a/src/gui.h
+++ b/src/gui.h
@@ -8,6 +8,7 @@
#include "window_type.h"
#include "vehicle_type.h"
#include "gfx_type.h"
+#include "economy_type.h"
/* main_gui.cpp */
void CcPlaySound10(bool success, TileIndex tile, uint32 p1, uint32 p2);
diff --git a/src/heightmap.cpp b/src/heightmap.cpp
index cf23bb1cf..a8313af3c 100644
--- a/src/heightmap.cpp
+++ b/src/heightmap.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "variables.h"
-#include "functions.h"
#include "heightmap.h"
#include "clear_map.h"
#include "table/strings.h"
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 999537899..fff83d3ff 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "clear_map.h"
-#include "functions.h"
#include "industry_map.h"
#include "station_map.h"
#include "table/strings.h"
@@ -40,6 +39,8 @@
#include "water.h"
#include "strings_func.h"
#include "tile_cmd.h"
+#include "functions.h"
+#include "window_func.h"
void ShowIndustryViewWindow(int industry);
void BuildOilRig(TileIndex tile);
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 2dbdf993a..646275bda 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
-#include "functions.h"
#include "table/strings.h"
#include "table/sprites.h"
#include "map.h"
diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp
index 4a20a5725..18e5350b0 100644
--- a/src/intro_gui.cpp
+++ b/src/intro_gui.cpp
@@ -6,7 +6,6 @@
#include "openttd.h"
#include "table/strings.h"
#include "table/sprites.h"
-#include "functions.h"
#include "gui.h"
#include "window_gui.h"
#include "textbuf_gui.h"
@@ -19,6 +18,8 @@
#include "network/network_gui.h"
#include "newgrf.h"
#include "strings_func.h"
+#include "functions.h"
+#include "window_func.h"
static const Widget _select_game_widgets[] = {
{ WWT_CAPTION, RESIZE_NONE, 13, 0, 335, 0, 13, STR_0307_OPENTTD, STR_NULL},
diff --git a/src/landscape.cpp b/src/landscape.cpp
index 3c87ce6c2..3e5ae6bcc 100644
--- a/src/landscape.cpp
+++ b/src/landscape.cpp
@@ -6,7 +6,6 @@
#include "heightmap.h"
#include "clear_map.h"
#include "date.h"
-#include "functions.h"
#include "map.h"
#include "player.h"
#include "spritecache.h"
@@ -23,6 +22,9 @@
#include "genworld.h"
#include "tile_cmd.h"
#include "core/alloc_func.hpp"
+#include "functions.h"
+#include "window_func.h"
+#include "functions.h"
extern const TileTypeProcs
_tile_type_clear_procs,
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index a5505e2e5..26b369e95 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -6,7 +6,6 @@
#include "openttd.h"
#include "heightmap.h"
#include "currency.h"
-#include "functions.h"
#include "spritecache.h"
#include "station.h"
#include "table/sprites.h"
@@ -42,6 +41,7 @@
#include "newgrf_config.h"
#include "rail_gui.h"
#include "road_gui.h"
+#include "functions.h"
#include "network/network_data.h"
#include "network/network_client.h"
diff --git a/src/map.cpp b/src/map.cpp
index cd65a146e..3df9470a8 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -5,11 +5,11 @@
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
-#include "functions.h"
#include "map.h"
#include "direction_func.h"
#include "core/bitmath_func.hpp"
#include "core/alloc_func.hpp"
+#include "core/math_func.hpp"
#if defined(_MSC_VER) && _MSC_VER >= 1400 /* VStudio 2005 is stupid! */
/* Why the hell is that not in all MSVC headers?? */
diff --git a/src/misc.cpp b/src/misc.cpp
index 1827f17d4..5a8eb7068 100644
--- a/src/misc.cpp
+++ b/src/misc.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "currency.h"
-#include "functions.h"
#include "landscape.h"
#include "news.h"
#include "player.h"
@@ -26,6 +25,7 @@
#include "viewport.h"
#include "economy_func.h"
#include "zoom_func.h"
+#include "functions.h"
char _name_array[512][32];
diff --git a/src/misc_cmd.cpp b/src/misc_cmd.cpp
index e8e0d7630..2db1d5e0f 100644
--- a/src/misc_cmd.cpp
+++ b/src/misc_cmd.cpp
@@ -4,7 +4,6 @@
#include "stdafx.h"
#include "openttd.h"
-#include "functions.h"
#include "string.h"
#include "table/strings.h"
#include "command_func.h"
@@ -20,6 +19,7 @@
#include "strings_func.h"
#include "vehicle.h"
#include "gfx_func.h"
+#include "functions.h"
/** Change the player's face.
* @param tile unused
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 9861c4d44..8649dd3cf 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -6,7 +6,6 @@
#include "openttd.h"
#include "heightmap.h"
#include "debug.h"
-#include "functions.h"
#include "landscape.h"
#include "newgrf.h"
#include "newgrf_text.h"
@@ -41,6 +40,8 @@
#include "fios.h"
#include "tile_cmd.h"
#include "zoom_func.h"
+#include "functions.h"
+#include "window_func.h"
/* Variables to display file lists */
FiosItem *_fios_list;
diff --git a/src/music_gui.cpp b/src/music_gui.cpp
index e920afee2..be9f43a3d 100644
--- a/src/music_gui.cpp
+++ b/src/music_gui.cpp
@@ -6,7 +6,6 @@
#include "openttd.h"
#include "table/strings.h"
#include "table/sprites.h"
-#include "functions.h"
#include "fileio.h"
#include "sound.h"
#include "variables.h"
@@ -14,6 +13,7 @@
#include "music/music_driver.hpp"
#include "window_gui.h"
#include "strings_func.h"
+#include "window_func.h"
static byte _music_wnd_cursong;
static bool _song_is_active;
diff --git a/src/network/core/tcp.cpp b/src/network/core/tcp.cpp
index deb72a60b..eaed4bd07 100644
--- a/src/network/core/tcp.cpp
+++ b/src/network/core/tcp.cpp
@@ -11,7 +11,6 @@
#include "../../openttd.h"
#include "../../variables.h"
#include "table/strings.h"
-#include "../../functions.h"
#include "../network_data.h"
#include "packet.h"
diff --git a/src/network/network.cpp b/src/network/network.cpp
index d0558c4b7..b746cbbe3 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -9,7 +9,6 @@ extern const char _openttd_revision[];
#include "../openttd.h"
#include "../debug.h"
-#include "../functions.h"
#include "../string.h"
#include "../strings_func.h"
#include "../map.h"
@@ -31,6 +30,8 @@ extern const char _openttd_revision[];
#include "../md5.h"
#include "../fileio.h"
#include "../texteff.hpp"
+#include "../core/random_func.hpp"
+#include "../window_func.h"
/* Check whether NETWORK_NUM_LANDSCAPES is still in sync with NUM_LANDSCAPE */
assert_compile((int)NETWORK_NUM_LANDSCAPES == (int)NUM_LANDSCAPE);
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index e1ac2d5c5..df70842d7 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -10,7 +10,6 @@
#include "core/tcp.h"
#include "../date.h"
#include "table/strings.h"
-#include "../functions.h"
#include "network_client.h"
#include "network_gamelist.h"
#include "network_gui.h"
@@ -23,6 +22,7 @@
#include "../fileio.h"
#include "../md5.h"
#include "../strings_func.h"
+#include "../window_func.h"
// This file handles all the client-commands
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 485db74d4..8fab465c1 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -11,7 +11,6 @@
#include "../fios.h"
#include "table/strings.h"
-#include "../functions.h"
#include "network_data.h"
#include "network_client.h"
#include "network_gui.h"
@@ -26,6 +25,8 @@
#include "../string.h"
#include "../town.h"
#include "../newgrf.h"
+#include "../functions.h"
+#include "../window_func.h"
#define BGC 5
#define BTC 15
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index 47cd19228..d1719629e 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -13,7 +13,6 @@
#include "../aircraft.h"
#include "../date.h"
#include "table/strings.h"
-#include "../functions.h"
#include "network_server.h"
#include "network_udp.h"
#include "../console.h"
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 5a481000b..5ba7cd58e 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -9,7 +9,6 @@
#include "openttd.h"
#include "debug.h"
#include "fileio.h"
-#include "functions.h"
#include "engine.h"
#include "spritecache.h"
#include "station.h"
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index fb6a84424..80257b4a3 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -4,7 +4,6 @@
#include "stdafx.h"
#include "openttd.h"
-#include "functions.h"
#include "debug.h"
#include "variables.h"
#include "string.h"
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp
index 7afb4a91f..dbc2e88bd 100644
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -6,7 +6,6 @@
#include "openttd.h"
#include "variables.h"
#include "debug.h"
-#include "functions.h"
#include "engine.h"
#include "train.h"
#include "player.h"
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index 531cf3aa5..cf068b347 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -4,7 +4,6 @@
#include "stdafx.h"
#include "openttd.h"
-#include "functions.h"
#include "variables.h"
#include "gui.h"
#include "window_gui.h"
@@ -14,6 +13,7 @@
#include "newgrf.h"
#include "newgrf_config.h"
#include "strings_func.h"
+#include "window_func.h"
/** Parse an integerlist string and set each found value
* @param p the string to be parsed. Each element in the list is seperated by a
diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp
index f3c2c182b..c0153b04c 100644
--- a/src/newgrf_house.cpp
+++ b/src/newgrf_house.cpp
@@ -4,7 +4,6 @@
#include "stdafx.h"
#include "openttd.h"
-#include "functions.h"
#include "variables.h"
#include "debug.h"
#include "viewport.h"
@@ -25,6 +24,7 @@
#include "newgrf_sound.h"
#include "newgrf_commons.h"
#include "transparency.h"
+#include "functions.h"
static BuildingCounts _building_counts;
static HouseClassMapping _class_mapping[HOUSE_CLASS_MAX];
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index 986ad5ead..7c898ab2f 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
-#include "functions.h"
#include "variables.h"
#include "landscape.h"
#include "table/strings.h"
@@ -20,6 +19,7 @@
#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
* to those used by the game, the IDs used for overriding old industries must be
diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp
index f414d1413..da8d3faab 100644
--- a/src/newgrf_industrytiles.cpp
+++ b/src/newgrf_industrytiles.cpp
@@ -4,7 +4,6 @@
#include "stdafx.h"
#include "openttd.h"
-#include "functions.h"
#include "variables.h"
#include "debug.h"
#include "viewport.h"
@@ -23,6 +22,7 @@
#include "table/strings.h"
#include "sprite.h"
#include "transparency.h"
+#include "functions.h"
static uint32 GetGRFParameter(IndustryGfx indtile_id, byte parameter)
{
diff --git a/src/newgrf_spritegroup.h b/src/newgrf_spritegroup.h
index 06a45c7b9..3c3c2b351 100644
--- a/src/newgrf_spritegroup.h
+++ b/src/newgrf_spritegroup.h
@@ -8,6 +8,8 @@
#include "town.h"
#include "industry.h"
#include "newgrf_storage.h"
+#include "core/bitmath_func.hpp"
+#include "gfx_type.h"
/**
* Gets the value of a so-called newgrf "register".
diff --git a/src/newgrf_town.cpp b/src/newgrf_town.cpp
index ae534df45..2d5d77291 100644
--- a/src/newgrf_town.cpp
+++ b/src/newgrf_town.cpp
@@ -6,7 +6,7 @@
#include "openttd.h"
#include "variables.h"
#include "debug.h"
-#include "functions.h"
+#include "core/bitmath_func.hpp"
#include "town.h"
/** This function implements the town variables that newGRF defines.
diff --git a/src/news_gui.cpp b/src/news_gui.cpp
index 5a3382426..a3c24084d 100644
--- a/src/news_gui.cpp
+++ b/src/news_gui.cpp
@@ -3,7 +3,6 @@
#include "stdafx.h"
#include "openttd.h"
-#include "functions.h"
#include "table/sprites.h"
#include "table/strings.h"
#include "gui.h"
@@ -17,6 +16,7 @@
#include "string.h"
#include "transparency.h"
#include "strings_func.h"
+#include "window_func.h"
/** @file news_gui.cpp
*
diff --git a/src/npf.cpp b/src/npf.cpp
index 76bebf27c..94bdf1f02 100644
--- a/src/npf.cpp
+++ b/src/npf.cpp
@@ -8,7 +8,6 @@
#include "debug.h"
#include "tile_cmd.h"
#include "bridge.h"
-#include "functions.h"
#include "landscape.h"
#include "npf.h"
#include "aystar.h"
@@ -20,6 +19,7 @@
#include "network/network.h"
#include "water_map.h"
#include "tunnelbridge_map.h"
+#include "functions.h"
static AyStar _npf_aystar;
diff --git a/src/oldloader.cpp b/src/oldloader.cpp
index 91711f3a1..302550090 100644
--- a/src/oldloader.cpp
+++ b/src/oldloader.cpp
@@ -6,7 +6,6 @@
#include "openttd.h"
#include "station_map.h"
#include "table/strings.h"
-#include "functions.h"
#include "map.h"
#include "town.h"
#include "industry.h"
@@ -25,6 +24,7 @@
#include "ai/ai.h"
#include "date.h"
#include "zoom_func.h"
+#include "functions.h"
enum {
HEADER_SIZE = 49,
diff --git a/src/oldpool.cpp b/src/oldpool.cpp
index 9c447f421..f7455efe9 100644
--- a/src/oldpool.cpp
+++ b/src/oldpool.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
-#include "functions.h"
#include "oldpool.h"
#include "core/alloc_func.hpp"
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 004bb3275..560c3f42e 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -13,7 +13,6 @@
#include "openttd.h"
#include "table/strings.h"
#include "bridge_map.h"
-#include "functions.h"
#include "mixer.h"
#include "spritecache.h"
#include "gfxinit.h"
@@ -120,34 +119,6 @@ void CDECL ShowInfoF(const char *str, ...)
}
-void *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize)
-{
- FILE *in;
- byte *mem;
- size_t len;
-
- in = fopen(filename, "rb");
- if (in == NULL) return NULL;
-
- fseek(in, 0, SEEK_END);
- len = ftell(in);
- fseek(in, 0, SEEK_SET);
- if (len > maxsize || (mem = MallocT<byte>(len + 1)) == NULL) {
- fclose(in);
- return NULL;
- }
- mem[len] = 0;
- if (fread(mem, len, 1, in) != 1) {
- fclose(in);
- free(mem);
- return NULL;
- }
- fclose(in);
-
- *lenp = len;
- return mem;
-}
-
extern const char _openttd_revision[];
static void showhelp()
{
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index 16649da07..1f139f370 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -8,7 +8,6 @@
#include "airport.h"
#include "vehicle.h"
#include "depot.h"
-#include "functions.h"
#include "table/strings.h"
#include "waypoint.h"
#include "command_func.h"
@@ -21,6 +20,8 @@
#include "aircraft.h"
#include "strings_func.h"
#include "core/alloc_func.hpp"
+#include "functions.h"
+#include "window_func.h"
DEFINE_OLD_POOL_GENERIC(Order, Order)
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index 2f9852383..e232c34ae 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -8,7 +8,6 @@
#include "station_map.h"
#include "table/sprites.h"
#include "table/strings.h"
-#include "functions.h"
#include "map.h"
#include "gui.h"
#include "window_gui.h"
@@ -26,6 +25,7 @@
#include "cargotype.h"
#include "order.h"
#include "strings_func.h"
+#include "window_func.h"
enum OrderWindowWidgets {
ORDER_WIDGET_CLOSEBOX = 0,
diff --git a/src/os/macosx/splash.cpp b/src/os/macosx/splash.cpp
index 747ea59b9..f644b5d0e 100644
--- a/src/os/macosx/splash.cpp
+++ b/src/os/macosx/splash.cpp
@@ -4,7 +4,6 @@
#include "../../openttd.h"
#include "../../variables.h"
#include "../../debug.h"
-#include "../../functions.h"
#include "../../gfx_func.h"
#include "../../fileio.h"
#include "../../blitter/factory.hpp"
diff --git a/src/os2.cpp b/src/os2.cpp
index 4763d7c1d..918c99cb1 100644
--- a/src/os2.cpp
+++ b/src/os2.cpp
@@ -8,9 +8,10 @@
#include "string.h"
#include "table/strings.h"
#include "gui.h"
-#include "functions.h"
#include "fileio.h"
#include "fios.h" // opendir/readdir/closedir
+#include "functions.h"
+#include "core/random_func.hpp"
#include <dirent.h>
#include <unistd.h>
diff --git a/src/player_face.h b/src/player_face.h
index aceec8c4b..7f77dcaa6 100644
--- a/src/player_face.h
+++ b/src/player_face.h
@@ -5,6 +5,8 @@
#ifndef PLAYER_FACE_H
#define PLAYER_FACE_H
+#include "core/random_func.hpp"
+
/** The gender/race combinations that we have faces for */
enum GenderEthnicity {
GENDER_FEMALE = 0, ///< This bit set means a female, otherwise male
diff --git a/src/player_gui.cpp b/src/player_gui.cpp
index 9d36fb307..1887b48f7 100644
--- a/src/player_gui.cpp
+++ b/src/player_gui.cpp
@@ -6,7 +6,6 @@
#include "openttd.h"
#include "table/sprites.h"
#include "table/strings.h"
-#include "functions.h"
#include "gui.h"
#include "window_gui.h"
#include "textbuf_gui.h"
@@ -26,6 +25,8 @@
#include "network/network_gui.h"
#include "player_face.h"
#include "strings_func.h"
+#include "functions.h"
+#include "window_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 320e8f0f0..92846d70c 100644
--- a/src/players.cpp
+++ b/src/players.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "engine.h"
-#include "functions.h"
#include "string.h"
#include "table/strings.h"
#include "table/sprites.h"
@@ -30,6 +29,7 @@
#include "tile_map.h"
#include "strings_func.h"
#include "gfx_func.h"
+#include "functions.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 00037911d..367f47183 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -6,7 +6,6 @@
#include "openttd.h"
#include "table/sprites.h"
#include "table/strings.h"
-#include "functions.h"
#include "tile_cmd.h"
#include "landscape.h"
#include "date.h"
@@ -26,6 +25,8 @@
#include "newgrf_station.h"
#include "train.h"
#include "strings_func.h"
+#include "functions.h"
+#include "window_func.h"
#include "bridge_map.h"
#include "rail_map.h"
diff --git a/src/road.cpp b/src/road.cpp
index 0f5412f4c..2107ec0e3 100644
--- a/src/road.cpp
+++ b/src/road.cpp
@@ -2,7 +2,6 @@
#include "stdafx.h"
#include "openttd.h"
-#include "functions.h"
#include "rail_map.h"
#include "road_map.h"
#include "road_internal.h"
diff --git a/src/road_gui.cpp b/src/road_gui.cpp
index bdd852d72..e9d4c4a96 100644
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -6,7 +6,6 @@
#include "openttd.h"
#include "table/sprites.h"
#include "table/strings.h"
-#include "functions.h"
#include "map.h"
#include "gui.h"
#include "window_gui.h"
@@ -20,6 +19,8 @@
#include "station_map.h"
//needed for catchments
#include "station.h"
+#include "functions.h"
+#include "window_func.h"
static void ShowRVStationPicker(RoadStop::Type rs);
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index c78d073a7..fbe0571d5 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -37,6 +37,8 @@
#include "cargotype.h"
#include "strings_func.h"
#include "tunnelbridge_map.h"
+#include "functions.h"
+#include "window_func.h"
static const uint16 _roadveh_images[63] = {
diff --git a/src/roadveh_gui.cpp b/src/roadveh_gui.cpp
index aed1f3762..014684d72 100644
--- a/src/roadveh_gui.cpp
+++ b/src/roadveh_gui.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
-#include "functions.h"
#include "roadveh.h"
#include "table/sprites.h"
#include "table/strings.h"
diff --git a/src/saveload.cpp b/src/saveload.cpp
index 93edeeafb..21f23e54a 100644
--- a/src/saveload.cpp
+++ b/src/saveload.cpp
@@ -16,7 +16,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
-#include "functions.h"
#include "vehicle.h"
#include "station.h"
#include "thread.h"
@@ -30,6 +29,7 @@
#include "strings_func.h"
#include "gfx_func.h"
#include "core/alloc_func.hpp"
+#include "functions.h"
#include <list>
extern const uint16 SAVEGAME_VERSION = 83;
diff --git a/src/screenshot.cpp b/src/screenshot.cpp
index d95ce98a9..98e95ab23 100644
--- a/src/screenshot.cpp
+++ b/src/screenshot.cpp
@@ -3,7 +3,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
-#include "functions.h"
#include "table/strings.h"
#include "fileio.h"
#include "viewport.h"
diff --git a/src/settings.cpp b/src/settings.cpp
index d78c7b752..936088d67 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -22,7 +22,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "currency.h"
-#include "functions.h"
#include "screenshot.h"
#include "sound.h"
#include "string.h"
diff --git a/src/settings.h b/src/settings.h
index 426744d16..9ede73404 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -91,4 +91,9 @@ void IConsoleListPatches();
const SettingDesc *GetPatchFromName(const char *name, uint *i);
bool SetPatchValue(uint index, const Patches *object, int32 value);
+void LoadFromConfig();
+void SaveToConfig();
+void CheckConfig();
+void UpdatePatches();
+
#endif /* SETTINGS_H */
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index bdd8e161f..03207e952 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "currency.h"
-#include "functions.h"
#include "string.h"
#include "table/sprites.h"
#include "table/strings.h"
@@ -24,6 +23,8 @@
#include "date.h"
#include "newgrf_townname.h"
#include "strings_func.h"
+#include "functions.h"
+#include "window_func.h"
static uint32 _difficulty_click_a;
static uint32 _difficulty_click_b;
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index 706049e0f..adb1cf861 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -6,7 +6,6 @@
#include "openttd.h"
#include "ship.h"
#include "table/strings.h"
-#include "functions.h"
#include "tile_cmd.h"
#include "landscape.h"
#include "map.h"
@@ -34,6 +33,8 @@
#include "spritecache.h"
#include "misc/autoptr.hpp"
#include "strings_func.h"
+#include "functions.h"
+#include "window_func.h"
static const uint16 _ship_sprites[] = {0x0E5D, 0x0E55, 0x0E65, 0x0E6D};
diff --git a/src/ship_gui.cpp b/src/ship_gui.cpp
index af66dbe14..6d8b55503 100644
--- a/src/ship_gui.cpp
+++ b/src/ship_gui.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
-#include "functions.h"
#include "ship.h"
#include "table/strings.h"
#include "table/sprites.h"
diff --git a/src/signs.cpp b/src/signs.cpp
index ba9e80786..082ae4520 100644
--- a/src/signs.cpp
+++ b/src/signs.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "table/strings.h"
-#include "functions.h"
#include "landscape.h"
#include "player.h"
#include "signs.h"
@@ -17,6 +16,8 @@
#include "strings_func.h"
#include "viewport.h"
#include "zoom_func.h"
+#include "functions.h"
+#include "window_func.h"
SignID _new_sign_id;
uint _total_signs;
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp
index 2dbbd9f9b..03735a3af 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -6,7 +6,6 @@
#include "openttd.h"
#include "table/strings.h"
#include "table/sprites.h"
-#include "functions.h"
#include "gui.h"
#include "textbuf_gui.h"
#include "window_gui.h"
@@ -17,6 +16,7 @@
#include "command_func.h"
#include "strings_func.h"
#include "core/alloc_func.hpp"
+#include "window_func.h"
static const Sign **_sign_sort;
static uint _num_sign_sort;
diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp
index 0e6b340af..5498b17de 100644
--- a/src/smallmap_gui.cpp
+++ b/src/smallmap_gui.cpp
@@ -4,7 +4,6 @@
#include "stdafx.h"
#include "openttd.h"
-#include "functions.h"
#include "bridge_map.h"
#include "clear_map.h"
#include "industry_map.h"
diff --git a/src/sound.cpp b/src/sound.cpp
index 62176687a..659934550 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -4,7 +4,6 @@
#include "stdafx.h"
#include "openttd.h"
-#include "functions.h"
#include "landscape.h"
#include "map.h"
#include "mixer.h"
diff --git a/src/sound/win32_s.cpp b/src/sound/win32_s.cpp
index 3efff337a..9f330c824 100644
--- a/src/sound/win32_s.cpp
+++ b/src/sound/win32_s.cpp
@@ -3,7 +3,6 @@
#include "../stdafx.h"
#include "../openttd.h"
#include "../driver.h"
-#include "../functions.h"
#include "../mixer.h"
#include "../core/alloc_func.hpp"
#include "win32_s.h"
diff --git a/src/spritecache.cpp b/src/spritecache.cpp
index cf587c0ea..55890bb4c 100644
--- a/src/spritecache.cpp
+++ b/src/spritecache.cpp
@@ -7,12 +7,12 @@
#include "variables.h"
#include "string.h"
#include "debug.h"
-#include "functions.h"
#include "spritecache.h"
#include "table/sprites.h"
#include "fileio.h"
#include "spriteloader/grf.hpp"
#include "core/alloc_func.hpp"
+#include "core/math_func.hpp"
#ifdef WITH_PNG
#include "spriteloader/png.hpp"
#endif /* WITH_PNG */
diff --git a/src/station.cpp b/src/station.cpp
index c03e77e85..dfc5b2e59 100644
--- a/src/station.cpp
+++ b/src/station.cpp
@@ -6,7 +6,6 @@
#include "openttd.h"
#include "bridge_map.h"
#include "debug.h"
-#include "functions.h"
#include "station_map.h"
#include "table/sprites.h"
#include "table/strings.h"
@@ -32,6 +31,8 @@
#include "roadveh.h"
#include "station_gui.h"
#include "zoom_func.h"
+#include "functions.h"
+#include "window_func.h"
Station::Station(TileIndex tile)
{
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 08ca8c0e2..9c93f8d22 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -43,6 +43,8 @@
#include "water.h"
#include "station_gui.h"
#include "strings_func.h"
+#include "functions.h"
+#include "window_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 26b48fe4f..63345d11c 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
-#include "functions.h"
#include "table/strings.h"
#include "gui.h"
#include "window_gui.h"
@@ -25,6 +24,7 @@
#include "station.h"
#include "strings_func.h"
#include "core/alloc_func.hpp"
+#include "window_func.h"
typedef int CDECL StationSortListingTypeFunction(const void*, const void*);
diff --git a/src/string.cpp b/src/string.cpp
index 7441ecc27..a62fb6d04 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -4,7 +4,6 @@
#include "stdafx.h"
#include "openttd.h"
-#include "functions.h"
#include "string.h"
#include "table/control_codes.h"
#include "debug.h"
diff --git a/src/strings.cpp b/src/strings.cpp
index 101ec69b1..421b5311d 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "currency.h"
-#include "functions.h"
#include "string.h"
#include "table/strings.h"
#include "namegen.h"
@@ -34,6 +33,7 @@
#include "fontcache.h"
#include "gui.h"
#include "strings_func.h"
+#include "functions.h"
#if defined(TTD_BIG_ENDIAN)
#include "core/endian_func.hpp"
#endif
diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp
index 847b43018..e1cf5ada9 100644
--- a/src/subsidy_gui.cpp
+++ b/src/subsidy_gui.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "table/strings.h"
-#include "functions.h"
#include "station.h"
#include "industry.h"
#include "town.h"
diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp
index 19a8b1fd1..8818f01a4 100644
--- a/src/terraform_gui.cpp
+++ b/src/terraform_gui.cpp
@@ -8,7 +8,6 @@
#include "clear_map.h"
#include "table/sprites.h"
#include "table/strings.h"
-#include "functions.h"
#include "player.h"
#include "gui.h"
#include "window_gui.h"
@@ -18,6 +17,7 @@
#include "vehicle.h"
#include "signs.h"
#include "variables.h"
+#include "functions.h"
void CcTerraform(bool success, TileIndex tile, uint32 p1, uint32 p2)
{
diff --git a/src/texteff.cpp b/src/texteff.cpp
index 56ab24d92..8dab8f5ad 100644
--- a/src/texteff.cpp
+++ b/src/texteff.cpp
@@ -4,7 +4,6 @@
#include "stdafx.h"
#include "openttd.h"
-#include "functions.h"
#include "tile_cmd.h"
#include "landscape.h"
#include "viewport.h"
@@ -21,6 +20,7 @@
#include "transparency.h"
#include "strings_func.h"
#include "core/alloc_func.hpp"
+#include "functions.h"
enum {
MAX_TEXTMESSAGE_LENGTH = 200,
diff --git a/src/tgp.cpp b/src/tgp.cpp
index b65c39451..5310cb168 100644
--- a/src/tgp.cpp
+++ b/src/tgp.cpp
@@ -6,7 +6,6 @@
#include <math.h>
#include "openttd.h"
#include "clear_map.h"
-#include "functions.h"
#include "map.h"
#include "table/strings.h"
#include "clear_map.h"
@@ -16,6 +15,7 @@
#include "console.h"
#include "genworld.h"
#include "core/alloc_func.hpp"
+#include "core/random_func.hpp"
/*
*
diff --git a/src/timetable_cmd.cpp b/src/timetable_cmd.cpp
index 83d167f63..fd759c195 100644
--- a/src/timetable_cmd.cpp
+++ b/src/timetable_cmd.cpp
@@ -4,13 +4,14 @@
#include "stdafx.h"
#include "openttd.h"
-#include "functions.h"
#include "variables.h"
#include "table/strings.h"
#include "command_func.h"
#include "date.h"
#include "player.h"
#include "vehicle.h"
+#include "functions.h"
+#include "window_func.h"
static void ChangeTimetable(Vehicle *v, VehicleOrderID order_number, uint16 time, bool is_journey)
diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp
index bcfc0282a..ec4b51a11 100644
--- a/src/timetable_gui.cpp
+++ b/src/timetable_gui.cpp
@@ -4,7 +4,6 @@
#include "stdafx.h"
#include "openttd.h"
-#include "functions.h"
#include "variables.h"
#include "table/strings.h"
#include "command_func.h"
diff --git a/src/town.h b/src/town.h
index 0c22618ab..731e45b94 100644
--- a/src/town.h
+++ b/src/town.h
@@ -6,8 +6,8 @@
#define TOWN_H
#include "oldpool.h"
-#include "player.h"
-#include "functions.h"
+#include "core/random_func.hpp"
+#include "cargo_type.h"
enum {
HOUSE_NO_CLASS = 0,
@@ -350,5 +350,11 @@ uint OriginalTileRandomiser(uint x, uint y);
void ResetHouses();
void ClearTownHouse(Town *t, TileIndex tile);
+void AfterLoadTown();
+void UpdateTownMaxPass(Town *t);
+bool CheckIfAuthorityAllows(TileIndex tile);
+Town *ClosestTownFromTile(TileIndex tile, uint threshold);
+void ChangeTownRating(Town *t, int add, int max);
+uint GetTownRadiusGroup(const Town* t, TileIndex tile);
#endif /* TOWN_H */
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 4e982e94d..3bf97bc4d 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -44,6 +44,7 @@
#include "tunnelbridge_map.h"
#include "strings_func.h"
#include "string.h"
+#include "window_func.h"
/* Initialize the town-pool */
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index e5921b922..3c3db9c67 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
-#include "functions.h"
#include "table/sprites.h"
#include "table/strings.h"
#include "town.h"
diff --git a/src/town_map.h b/src/town_map.h
index 1c1b8e871..5f8eeaf11 100644
--- a/src/town_map.h
+++ b/src/town_map.h
@@ -8,6 +8,7 @@
#include "town.h"
#include "date.h"
#include "tile_map.h"
+#include "functions.h"
/**
* Get the index of which town this house/street is attached to.
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 67ef268be..c8f4c14a8 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -42,6 +42,8 @@
#include "table/sprites.h"
#include "tunnelbridge_map.h"
#include "strings_func.h"
+#include "functions.h"
+#include "window_func.h"
static bool TrainCheckIfLineEnds(Vehicle *v);
diff --git a/src/train_gui.cpp b/src/train_gui.cpp
index 2587169dc..5a09f339d 100644
--- a/src/train_gui.cpp
+++ b/src/train_gui.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
-#include "functions.h"
#include "table/sprites.h"
#include "table/strings.h"
#include "gui.h"
diff --git a/src/transparency_gui.cpp b/src/transparency_gui.cpp
index add27c2f4..2ecad02f9 100644
--- a/src/transparency_gui.cpp
+++ b/src/transparency_gui.cpp
@@ -4,7 +4,6 @@
#include "openttd.h"
#include "table/sprites.h"
#include "table/strings.h"
-#include "functions.h"
#include "gui.h"
#include "window_gui.h"
#include "viewport.h"
diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp
index 2888091fe..a70203197 100644
--- a/src/tree_cmd.cpp
+++ b/src/tree_cmd.cpp
@@ -21,6 +21,8 @@
#include "variables.h"
#include "genworld.h"
#include "transparency.h"
+#include "functions.h"
+#include "player.h"
/**
* List of tree placer algorithm.
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index 34f4d8b51..46bc47d9e 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -35,6 +35,7 @@
#include "tunnelbridge_map.h"
#include "table/bridge_land.h"
#include "strings_func.h"
+#include "functions.h"
const Bridge orig_bridge[] = {
diff --git a/src/unix.cpp b/src/unix.cpp
index f35b50b93..13e837835 100644
--- a/src/unix.cpp
+++ b/src/unix.cpp
@@ -4,11 +4,12 @@
#include "stdafx.h"
#include "openttd.h"
-#include "functions.h"
#include "string.h"
#include "table/strings.h"
#include "variables.h"
#include "textbuf_gui.h"
+#include "functions.h"
+#include "core/random_func.hpp"
#include <dirent.h>
#include <unistd.h>
diff --git a/src/unmovable_cmd.cpp b/src/unmovable_cmd.cpp
index 034341b7c..f9992846d 100644
--- a/src/unmovable_cmd.cpp
+++ b/src/unmovable_cmd.cpp
@@ -24,6 +24,8 @@
#include "bridge.h"
#include "autoslope.h"
#include "transparency.h"
+#include "functions.h"
+#include "window_func.h"
/** Destroy a HQ.
* During normal gameplay you can only implicitely destroy a HQ when you are
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index b5826bb17..3eeeffc75 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -42,6 +42,8 @@
#include "order.h"
#include "strings_func.h"
#include "zoom_func.h"
+#include "functions.h"
+#include "window_func.h"
#define INVALID_COORD (0x7fffffff)
#define GEN_HASH(x, y) ((GB((y), 6, 6) << 6) + GB((x), 7, 6))
diff --git a/src/vehicle.h b/src/vehicle.h
index b5ba98a49..d8735aaf4 100644
--- a/src/vehicle.h
+++ b/src/vehicle.h
@@ -812,6 +812,8 @@ static inline uint32 GetCmdSendToDepot(const Vehicle *v)
return GetCmdSendToDepot(v->type);
}
+bool EnsureNoVehicleOnGround(TileIndex tile);
+
/* This one is not used anymore. */
VARDEF VehicleID _vehicle_id_ctr_day;
VARDEF Vehicle *_place_clicked_vehicle;
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 7b6c5ac84..f443b343d 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
-#include "functions.h"
#include "player.h"
#include "station.h"
#include "table/sprites.h"
@@ -32,6 +31,8 @@
#include "group.h"
#include "group_gui.h"
#include "strings_func.h"
+#include "functions.h"
+#include "window_func.h"
struct Sorting {
Listing aircraft;
diff --git a/src/video/cocoa/wnd_quartz.mm b/src/video/cocoa/wnd_quartz.mm
index a04ba909e..b6e7ddba0 100644
--- a/src/video/cocoa/wnd_quartz.mm
+++ b/src/video/cocoa/wnd_quartz.mm
@@ -42,7 +42,6 @@
#include "../../variables.h"
#include "../../core/geometry_type.hpp"
#include "cocoa_v.h"
-#include "../../functions.h"
#include "../../core/math_func.hpp"
#include "../../gfx_func.h"
diff --git a/src/video/cocoa/wnd_quickdraw.mm b/src/video/cocoa/wnd_quickdraw.mm
index 8c1455ba6..8458c8088 100644
--- a/src/video/cocoa/wnd_quickdraw.mm
+++ b/src/video/cocoa/wnd_quickdraw.mm
@@ -42,7 +42,6 @@
#include "../../variables.h"
#include "../../core/geometry_type.hpp"
#include "cocoa_v.h"
-#include "../../functions.h"
#include "../../core/math_func.hpp"
#include "../../gfx_func.h"
diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp
index 5bc52032f..8ed14c29c 100644
--- a/src/video/dedicated_v.cpp
+++ b/src/video/dedicated_v.cpp
@@ -6,7 +6,6 @@
#include "../openttd.h"
#include "../debug.h"
-#include "../functions.h"
#include "../gfx_func.h"
#include "../network/network.h"
#include "../console.h"
diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp
index 05fb771b7..4461fbf32 100644
--- a/src/video/sdl_v.cpp
+++ b/src/video/sdl_v.cpp
@@ -6,7 +6,6 @@
#include "../openttd.h"
#include "../debug.h"
-#include "../functions.h"
#include "../gfx_func.h"
#include "../sdl.h"
#include "../variables.h"
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp
index d3d80daee..5fb4a4c60 100644
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -2,7 +2,6 @@
#include "../stdafx.h"
#include "../openttd.h"
-#include "../functions.h"
#include "../gfx_func.h"
#include "../variables.h"
#include "../win32.h"
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index a40129658..c9f90a17d 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -31,6 +31,8 @@
#include "misc/autoptr.hpp"
#include "transparency.h"
#include "strings_func.h"
+#include "functions.h"
+#include "window_func.h"
/** Array for the shore sprites */
static const SpriteID _water_shore_sprites[] = {
diff --git a/src/waypoint.cpp b/src/waypoint.cpp
index dbe2cd07c..f9b21b47f 100644
--- a/src/waypoint.cpp
+++ b/src/waypoint.cpp
@@ -6,7 +6,6 @@
#include "openttd.h"
#include "command_func.h"
-#include "functions.h"
#include "landscape.h"
#include "map.h"
#include "order.h"
@@ -26,6 +25,8 @@
#include "misc/autoptr.hpp"
#include "strings_func.h"
#include "viewport.h"
+#include "functions.h"
+#include "window_func.h"
enum {
MAX_WAYPOINTS_PER_TOWN = 64,
diff --git a/src/widget.cpp b/src/widget.cpp
index 2d7c9ad2c..6e3db2595 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -4,12 +4,13 @@
#include "stdafx.h"
#include "openttd.h"
-#include "functions.h"
#include "player.h"
#include "table/sprites.h"
#include "table/strings.h"
#include "viewport.h"
#include "window_gui.h"
+#include "window_func.h"
+
static Point HandleScrollbarHittest(const Scrollbar *sb, int top, int bottom)
{
diff --git a/src/win32.cpp b/src/win32.cpp
index 4b3ebc6fb..037c9beb1 100644
--- a/src/win32.cpp
+++ b/src/win32.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
-#include "functions.h"
#include "saveload.h"
#include "string.h"
#include "gfx_func.h"
@@ -22,6 +21,8 @@
#include "fios.h" // opendir/readdir/closedir
#include "fileio.h"
#include "core/alloc_func.hpp"
+#include "functions.h"
+#include "core/random_func.hpp"
#include <ctype.h>
#include <tchar.h>
#include <errno.h>
diff --git a/src/window.cpp b/src/window.cpp
index 605679f48..dc6a86364 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -6,7 +6,6 @@
#include <stdarg.h>
#include "openttd.h"
#include "debug.h"
-#include "functions.h"
#include "map.h"
#include "player.h"
#include "viewport.h"
diff --git a/src/window_func.h b/src/window_func.h
index 8d2049b2c..2af028356 100644
--- a/src/window_func.h
+++ b/src/window_func.h
@@ -39,4 +39,11 @@ void HideVitalWindows();
void ShowVitalWindows();
Window **FindWindowZPosition(const Window *w);
+void InvalidateWindow(WindowClass cls, WindowNumber number);
+void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_index);
+void InvalidateWindowClasses(WindowClass cls);
+void InvalidateWindowClassesData(WindowClass cls);
+void DeleteWindowById(WindowClass cls, WindowNumber number);
+void DeleteWindowByClass(WindowClass cls);
+
#endif /* WINDOW_FUNC_H */