summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-01-12 14:10:35 +0000
committerrubidium <rubidium@openttd.org>2008-01-12 14:10:35 +0000
commitac528411df2e42e066ab301517bd85743162f356 (patch)
treedd717901825d2b9701f42a6a4bedb895deb3017a /src
parentcbbc53e8f84067cae60c6f2e8e00682c968430a7 (diff)
downloadopenttd-ac528411df2e42e066ab301517bd85743162f356.tar.xz
(svn r11818) -Codechange: split player.h into smaller pieces.
Diffstat (limited to 'src')
-rw-r--r--src/ai/ai.cpp3
-rw-r--r--src/ai/ai.h1
-rw-r--r--src/ai/default/default.cpp3
-rw-r--r--src/ai/default/default.h2
-rw-r--r--src/ai/trolly/build.cpp2
-rw-r--r--src/ai/trolly/pathfinder.cpp2
-rw-r--r--src/ai/trolly/shared.cpp1
-rw-r--r--src/ai/trolly/trolly.cpp2
-rw-r--r--src/ai/trolly/trolly.h4
-rw-r--r--src/aircraft_cmd.cpp2
-rw-r--r--src/aircraft_gui.cpp1
-rw-r--r--src/airport_gui.cpp2
-rw-r--r--src/autoreplace_cmd.cpp2
-rw-r--r--src/autoreplace_func.h2
-rw-r--r--src/autoreplace_gui.cpp1
-rw-r--r--src/autoslope.h2
-rw-r--r--src/build_vehicle_gui.cpp2
-rw-r--r--src/clear_cmd.cpp1
-rw-r--r--src/command.cpp3
-rw-r--r--src/console.cpp1
-rw-r--r--src/console_cmds.cpp2
-rw-r--r--src/depot_gui.cpp2
-rw-r--r--src/disaster_cmd.cpp2
-rw-r--r--src/dock_gui.cpp2
-rw-r--r--src/economy.cpp3
-rw-r--r--src/economy_func.h1
-rw-r--r--src/economy_type.h6
-rw-r--r--src/elrail.cpp2
-rw-r--r--src/engine.cpp3
-rw-r--r--src/engine.h1
-rw-r--r--src/genworld.cpp3
-rw-r--r--src/genworld.h2
-rw-r--r--src/genworld_gui.cpp1
-rw-r--r--src/graph_gui.cpp3
-rw-r--r--src/group.h3
-rw-r--r--src/group_cmd.cpp2
-rw-r--r--src/group_gui.cpp5
-rw-r--r--src/gui.h3
-rw-r--r--src/industry_gui.cpp2
-rw-r--r--src/intro_gui.cpp1
-rw-r--r--src/landscape.cpp1
-rw-r--r--src/livery.h8
-rw-r--r--src/main_gui.cpp4
-rw-r--r--src/misc.cpp1
-rw-r--r--src/misc_cmd.cpp4
-rw-r--r--src/misc_gui.cpp4
-rw-r--r--src/network/core/tcp.h1
-rw-r--r--src/network/network.cpp1
-rw-r--r--src/network/network.h3
-rw-r--r--src/network/network_client.cpp3
-rw-r--r--src/network/network_data.cpp1
-rw-r--r--src/network/network_gui.cpp1
-rw-r--r--src/network/network_server.cpp3
-rw-r--r--src/network/network_udp.cpp2
-rw-r--r--src/newgrf.cpp2
-rw-r--r--src/newgrf_engine.cpp3
-rw-r--r--src/newgrf_house.cpp2
-rw-r--r--src/newgrf_industries.cpp3
-rw-r--r--src/newgrf_station.cpp2
-rw-r--r--src/oldloader.cpp3
-rw-r--r--src/openttd.cpp3
-rw-r--r--src/openttd.h30
-rw-r--r--src/order_cmd.cpp2
-rw-r--r--src/order_gui.cpp2
-rw-r--r--src/player_base.h (renamed from src/player.h)70
-rw-r--r--src/player_func.h53
-rw-r--r--src/player_gui.cpp10
-rw-r--r--src/player_gui.h20
-rw-r--r--src/player_type.h41
-rw-r--r--src/players.cpp16
-rw-r--r--src/rail.cpp3
-rw-r--r--src/rail_gui.cpp2
-rw-r--r--src/road.cpp3
-rw-r--r--src/road_cmd.cpp1
-rw-r--r--src/road_func.h1
-rw-r--r--src/road_gui.cpp2
-rw-r--r--src/roadveh_cmd.cpp3
-rw-r--r--src/saveload.cpp1
-rw-r--r--src/screenshot.cpp3
-rw-r--r--src/settings.cpp1
-rw-r--r--src/ship_cmd.cpp3
-rw-r--r--src/signal.cpp2
-rw-r--r--src/signs.cpp2
-rw-r--r--src/signs_gui.cpp2
-rw-r--r--src/smallmap_gui.cpp2
-rw-r--r--src/station.cpp2
-rw-r--r--src/station_cmd.cpp1
-rw-r--r--src/station_gui.cpp2
-rw-r--r--src/strings.cpp3
-rw-r--r--src/subsidy_gui.cpp1
-rw-r--r--src/terraform_gui.cpp3
-rw-r--r--src/tile_cmd.h1
-rw-r--r--src/tile_map.h1
-rw-r--r--src/timetable_cmd.cpp1
-rw-r--r--src/timetable_gui.cpp2
-rw-r--r--src/town.h1
-rw-r--r--src/town_cmd.cpp2
-rw-r--r--src/town_gui.cpp4
-rw-r--r--src/train_cmd.cpp3
-rw-r--r--src/tree_cmd.cpp2
-rw-r--r--src/tunnelbridge_cmd.cpp1
-rw-r--r--src/unmovable_cmd.cpp4
-rw-r--r--src/variables.h2
-rw-r--r--src/vehicle.cpp2
-rw-r--r--src/vehicle_base.h1
-rw-r--r--src/vehicle_gui.cpp5
-rw-r--r--src/video/dedicated_v.cpp1
-rw-r--r--src/viewport.cpp2
-rw-r--r--src/water_cmd.cpp2
-rw-r--r--src/waypoint.cpp2
-rw-r--r--src/widget.cpp3
-rw-r--r--src/window.cpp2
-rw-r--r--src/window_func.h2
-rw-r--r--src/window_gui.h8
114 files changed, 295 insertions, 189 deletions
diff --git a/src/ai/ai.cpp b/src/ai/ai.cpp
index 0654fcaa1..07b31f77d 100644
--- a/src/ai/ai.cpp
+++ b/src/ai/ai.cpp
@@ -2,11 +2,12 @@
#include "../stdafx.h"
#include "../openttd.h"
-#include "../player.h"
#include "../variables.h"
#include "../command_func.h"
#include "../network/network.h"
#include "../core/alloc_func.hpp"
+#include "../player_func.h"
+#include "../player_base.h"
#include "ai.h"
#include "default/default.h"
diff --git a/src/ai/ai.h b/src/ai/ai.h
index 96e25ef54..7ecc97571 100644
--- a/src/ai/ai.h
+++ b/src/ai/ai.h
@@ -4,7 +4,6 @@
#define AI_H
#include "../network/network.h"
-#include "../player.h"
#include "../command_type.h"
#include "../core/random_func.hpp"
#include "../settings_type.h"
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp
index 6d72f2043..b9d0f2f92 100644
--- a/src/ai/default/default.cpp
+++ b/src/ai/default/default.cpp
@@ -10,7 +10,6 @@
#include "../../road_map.h"
#include "../../roadveh.h"
#include "../../station_map.h"
-#include "../../player.h"
#include "../../tunnel_map.h"
#include "../../engine.h"
#include "../../command_func.h"
@@ -28,6 +27,8 @@
#include "../../vehicle_func.h"
#include "../../functions.h"
#include "../../saveload.h"
+#include "../../player_func.h"
+#include "../../player_base.h"
#include "default.h"
// remove some day perhaps?
diff --git a/src/ai/default/default.h b/src/ai/default/default.h
index 934f96f22..bbe84770f 100644
--- a/src/ai/default/default.h
+++ b/src/ai/default/default.h
@@ -4,6 +4,8 @@
#define DEFAULT_H
#include "../../direction_type.h"
+#include "../../vehicle_type.h"
+#include "../../rail_type.h"
void AiDoGameLoop(Player*);
void SaveLoad_AI(PlayerID id);
diff --git a/src/ai/trolly/build.cpp b/src/ai/trolly/build.cpp
index 388a40b66..44e03cb07 100644
--- a/src/ai/trolly/build.cpp
+++ b/src/ai/trolly/build.cpp
@@ -12,6 +12,8 @@
#include "../../bridge.h"
#include "../../vehicle_func.h"
#include "../../vehicle_base.h"
+#include "../../player_base.h"
+#include "../../player_func.h"
#include "../ai.h"
// Build HQ
diff --git a/src/ai/trolly/pathfinder.cpp b/src/ai/trolly/pathfinder.cpp
index 945691675..d3dcc96c2 100644
--- a/src/ai/trolly/pathfinder.cpp
+++ b/src/ai/trolly/pathfinder.cpp
@@ -12,6 +12,8 @@
#include "../../tunnelbridge_map.h"
#include "../ai.h"
#include "../../variables.h"
+#include "../../player_base.h"
+#include "../../player_func.h"
#define TEST_STATION_NO_DIR 0xFF
diff --git a/src/ai/trolly/shared.cpp b/src/ai/trolly/shared.cpp
index 8e0860432..7773934d3 100644
--- a/src/ai/trolly/shared.cpp
+++ b/src/ai/trolly/shared.cpp
@@ -5,6 +5,7 @@
#include "../../debug.h"
#include "../../map_func.h"
#include "../../vehicle_base.h"
+#include "../../player_base.h"
#include "trolly.h"
int AiNew_GetRailDirection(TileIndex tile_a, TileIndex tile_b, TileIndex tile_c)
diff --git a/src/ai/trolly/trolly.cpp b/src/ai/trolly/trolly.cpp
index 3f0cf58ba..8a863142e 100644
--- a/src/ai/trolly/trolly.cpp
+++ b/src/ai/trolly/trolly.cpp
@@ -36,6 +36,8 @@
#include "../../date_func.h"
#include "../ai.h"
#include "../../order.h"
+#include "../../player_base.h"
+#include "../../player_func.h"
PlayerAiNew _players_ainew[MAX_PLAYERS];
diff --git a/src/ai/trolly/trolly.h b/src/ai/trolly/trolly.h
index c367867f5..43966f423 100644
--- a/src/ai/trolly/trolly.h
+++ b/src/ai/trolly/trolly.h
@@ -4,7 +4,9 @@
#define AI_TROLLY_H
#include "../../aystar.h"
-#include "../../player.h"
+#include "../../player_type.h"
+#include "../../vehicle_type.h"
+#include "../../date_type.h"
/*
* These defines can be altered to change the behavoir of the AI
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index 75d64f485..cdf58a2eb 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -15,7 +15,6 @@
#include "engine.h"
#include "station.h"
#include "news.h"
-#include "player.h"
#include "aircraft.h"
#include "airport.h"
#include "vehicle_gui.h"
@@ -37,6 +36,7 @@
#include "autoreplace_func.h"
#include "autoreplace_gui.h"
#include "gfx_func.h"
+#include "player_func.h"
void Aircraft::UpdateDeltaXY(Direction direction)
{
diff --git a/src/aircraft_gui.cpp b/src/aircraft_gui.cpp
index fe73681bf..c9b733e76 100644
--- a/src/aircraft_gui.cpp
+++ b/src/aircraft_gui.cpp
@@ -10,7 +10,6 @@
#include "table/strings.h"
#include "gui.h"
#include "engine.h"
-#include "player.h"
#include "depot.h"
#include "vehicle_gui.h"
#include "newgrf_engine.h"
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index d83053ce3..a2a9e0a90 100644
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -19,7 +19,7 @@
#include "variables.h"
#include "viewport_func.h"
#include "gfx_func.h"
-#include "player.h"
+#include "player_func.h"
static byte _selected_airport_type;
diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp
index 3ef22d687..c06be60c9 100644
--- a/src/autoreplace_cmd.cpp
+++ b/src/autoreplace_cmd.cpp
@@ -6,7 +6,7 @@
#include "ship.h"
#include "table/strings.h"
#include "news.h"
-#include "player.h"
+#include "player_func.h"
#include "engine.h"
#include "debug.h"
#include "vehicle_gui.h"
diff --git a/src/autoreplace_func.h b/src/autoreplace_func.h
index cc1cdf194..e640b84bc 100644
--- a/src/autoreplace_func.h
+++ b/src/autoreplace_func.h
@@ -6,7 +6,7 @@
#define AUTOREPLACE_FUNC_H
#include "autoreplace_type.h"
-#include "player.h"
+#include "player_base.h"
/**
* Remove all engine replacement settings for the player.
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index 0a68db43e..ce18ac732 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -19,6 +19,7 @@
#include "vehicle_func.h"
#include "autoreplace_func.h"
#include "gfx_func.h"
+#include "player_func.h"
static RailType _railtype_selected_in_replace_gui;
diff --git a/src/autoslope.h b/src/autoslope.h
index 73f5392b1..036b43a57 100644
--- a/src/autoslope.h
+++ b/src/autoslope.h
@@ -7,7 +7,7 @@
#include "depot.h"
#include "settings_type.h"
-#include "player.h"
+#include "player_func.h"
/**
* Autoslope check for tiles with an entrance on an edge.
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index 3faa86d63..69cb432b0 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -17,7 +17,7 @@
#include "station.h"
#include "command_func.h"
#include "engine.h"
-#include "player.h"
+#include "player_func.h"
#include "depot.h"
#include "airport.h"
#include "vehicle_gui.h"
diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp
index 60ea33aa4..afcdc268c 100644
--- a/src/clear_cmd.cpp
+++ b/src/clear_cmd.cpp
@@ -6,7 +6,6 @@
#include "openttd.h"
#include "clear_map.h"
#include "table/strings.h"
-#include "player.h"
#include "command_func.h"
#include "bridge.h"
#include "landscape.h"
diff --git a/src/command.cpp b/src/command.cpp
index 95dde1d7f..d48cc9906 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -9,7 +9,6 @@
#include "tile_map.h"
#include "gui.h"
#include "command_func.h"
-#include "player.h"
#include "network/network.h"
#include "variables.h"
#include "genworld.h"
@@ -20,6 +19,8 @@
#include "town.h"
#include "date_func.h"
#include "debug.h"
+#include "player_func.h"
+#include "player_base.h"
const char *_cmd_text = NULL;
diff --git a/src/console.cpp b/src/console.cpp
index a31a30717..b5fbf83ab 100644
--- a/src/console.cpp
+++ b/src/console.cpp
@@ -8,7 +8,6 @@
#include "gui.h"
#include "textbuf_gui.h"
#include "window_gui.h"
-#include "player.h"
#include "variables.h"
#include <stdarg.h>
#include <string.h>
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index b47a6d521..ede00c4c2 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -30,6 +30,8 @@
#include "date_func.h"
#include "vehicle_func.h"
#include "string_func.h"
+#include "player_func.h"
+#include "player_base.h"
// ** scriptfile handling ** //
static FILE *_script_file;
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index d9de5b594..f628da3cb 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -23,7 +23,7 @@
#include "strings_func.h"
#include "window_func.h"
#include "vehicle_func.h"
-#include "player.h"
+#include "player_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 985ae8866..146f7c98e 100644
--- a/src/disaster_cmd.cpp
+++ b/src/disaster_cmd.cpp
@@ -30,7 +30,7 @@
#include "waypoint.h"
#include "town.h"
#include "industry.h"
-#include "player.h"
+#include "player_func.h"
#include "airport.h"
#include "variables.h"
#include "table/sprites.h"
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp
index 6add0c47a..a26a8a497 100644
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -20,7 +20,7 @@
#include "sound_func.h"
#include "viewport_func.h"
#include "gfx_func.h"
-#include "player.h"
+#include "player_func.h"
static void ShowBuildDockStationPicker();
static void ShowBuildDocksDepotPicker();
diff --git a/src/economy.cpp b/src/economy.cpp
index 02b928a42..30ebd96c6 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -9,7 +9,8 @@
#include "table/strings.h"
#include "table/sprites.h"
#include "news.h"
-#include "player.h"
+#include "player_base.h"
+#include "player_func.h"
#include "station.h"
#include "command_func.h"
#include "saveload.h"
diff --git a/src/economy_func.h b/src/economy_func.h
index af65dcd11..0f7a532b9 100644
--- a/src/economy_func.h
+++ b/src/economy_func.h
@@ -12,6 +12,7 @@
#include "tile_type.h"
#include "town_type.h"
#include "industry_type.h"
+#include "player_type.h"
struct Player;
diff --git a/src/economy_type.h b/src/economy_type.h
index b551e1512..9b12f4336 100644
--- a/src/economy_type.h
+++ b/src/economy_type.h
@@ -127,4 +127,10 @@ enum ExpensesType {
INVALID_EXPENSES = 0xFF,
};
+/* The "steps" in loan size, in British Pounds! */
+enum {
+ LOAN_INTERVAL = 10000,
+ LOAN_INTERVAL_OLD_AI = 50000,
+};
+
#endif /* ECONOMY_TYPE_H */
diff --git a/src/elrail.cpp b/src/elrail.cpp
index 827ab2cd0..e0b158aea 100644
--- a/src/elrail.cpp
+++ b/src/elrail.cpp
@@ -65,7 +65,7 @@
#include "transparency.h"
#include "tunnelbridge_map.h"
#include "vehicle_func.h"
-#include "player.h"
+#include "player_base.h"
static inline TLG GetTLG(TileIndex t)
diff --git a/src/engine.cpp b/src/engine.cpp
index 47d6ba047..c0813f87b 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -7,7 +7,8 @@
#include "debug.h"
#include "table/strings.h"
#include "engine.h"
-#include "player.h"
+#include "player_base.h"
+#include "player_func.h"
#include "command_func.h"
#include "news.h"
#include "saveload.h"
diff --git a/src/engine.h b/src/engine.h
index d4d004007..08f1caf8a 100644
--- a/src/engine.h
+++ b/src/engine.h
@@ -11,6 +11,7 @@
#include "gfx_type.h"
#include "date_type.h"
#include "sound_type.h"
+#include "player_type.h"
enum RailVehicleTypes {
RAILVEH_SINGLEHEAD, ///< indicates a "standalone" locomotive
diff --git a/src/genworld.cpp b/src/genworld.cpp
index 15c3f961b..9359ac014 100644
--- a/src/genworld.cpp
+++ b/src/genworld.cpp
@@ -5,7 +5,7 @@
#include "stdafx.h"
#include "openttd.h"
#include "landscape.h"
-#include "player.h"
+#include "player_func.h"
#include "table/sprites.h"
#include "variables.h"
#include "thread.h"
@@ -22,6 +22,7 @@
#include "map_func.h"
#include "date_func.h"
#include "core/random_func.hpp"
+#include "engine.h"
void GenerateClearTile();
void GenerateIndustries();
diff --git a/src/genworld.h b/src/genworld.h
index 4c78e612f..ebac04e16 100644
--- a/src/genworld.h
+++ b/src/genworld.h
@@ -15,6 +15,8 @@
#define OTTDThread void
#endif
+#include "player_type.h"
+
/*
* Order of these enums has to be the same as in lang/english.txt
* Otherwise you will get inconsistent behaviour.
diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp
index 1b34fc451..95f456752 100644
--- a/src/genworld_gui.cpp
+++ b/src/genworld_gui.cpp
@@ -11,7 +11,6 @@
#include "window_gui.h"
#include "textbuf_gui.h"
#include "gfxinit.h"
-#include "player.h"
#include "command_func.h"
#include "variables.h"
#include "settings_func.h"
diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp
index 995e3a63f..672ba51d0 100644
--- a/src/graph_gui.cpp
+++ b/src/graph_gui.cpp
@@ -8,7 +8,8 @@
#include "table/sprites.h"
#include "gui.h"
#include "window_gui.h"
-#include "player.h"
+#include "player_base.h"
+#include "player_gui.h"
#include "economy_func.h"
#include "variables.h"
#include "cargotype.h"
diff --git a/src/group.h b/src/group.h
index 08b354b00..caf58e0f9 100644
--- a/src/group.h
+++ b/src/group.h
@@ -6,6 +6,9 @@
#define GROUP_H
#include "oldpool.h"
+#include "player_type.h"
+#include "vehicle_type.h"
+#include "engine.h"
enum {
ALL_GROUP = 0xFFFD,
diff --git a/src/group_cmd.cpp b/src/group_cmd.cpp
index 967956b62..16f3d5cb7 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 "player.h"
#include "table/strings.h"
#include "command_func.h"
#include "saveload.h"
@@ -22,6 +21,7 @@
#include "autoreplace_base.h"
#include "autoreplace_func.h"
#include "string_func.h"
+#include "player_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 bb5b25e2c..7ec5287b6 100644
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -24,7 +24,7 @@
#include "string_func.h"
#include "viewport_func.h"
#include "gfx_func.h"
-#include "player.h"
+#include "player_func.h"
struct Sorting {
@@ -289,7 +289,6 @@ static void UpdateGroupActionDropdown(Window *w, GroupID gid, bool refresh = tru
static void GroupWndProc(Window *w, WindowEvent *e)
{
const PlayerID owner = (PlayerID)GB(w->window_number, 0, 8);
- const Player *p = GetPlayer(owner);
groupveh_d *gv = &WP(w, groupveh_d);
grouplist_d *gl = &WP(w, groupveh_d).gl;
@@ -369,7 +368,7 @@ static void GroupWndProc(Window *w, WindowEvent *e)
/* If selected_group == DEFAULT_GROUP || ALL_GROUP, draw the standard caption
We list all vehicles or ungrouped vehicles */
if (IsDefaultGroupID(gv->group_sel) || IsAllGroupID(gv->group_sel)) {
- SetDParam(0, p->index);
+ SetDParam(0, owner);
SetDParam(1, gv->l.list_length);
switch (gv->vehicle_type) {
diff --git a/src/gui.h b/src/gui.h
index 8ff80c1dc..5987259d5 100644
--- a/src/gui.h
+++ b/src/gui.h
@@ -85,9 +85,6 @@ void ShowBuildTreesScenToolbar();
void ShowTownDirectory();
void ShowIndustryDirectory();
void ShowSubsidiesList();
-void ShowPlayerStations(PlayerID player);
-void ShowPlayerFinances(PlayerID player);
-void ShowPlayerCompany(PlayerID player);
void ShowEstimatedCostOrIncome(Money cost, int x, int y);
void ShowErrorMessage(StringID msg_1, StringID msg_2, int x, int y);
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index bd873ffbd..a8e5b2f2d 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -23,7 +23,7 @@
#include "newgrf_text.h"
#include "strings_func.h"
#include "map_func.h"
-#include "player.h"
+#include "player_func.h"
bool _ignore_restrictions;
diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp
index 696b93760..3be6109b0 100644
--- a/src/intro_gui.cpp
+++ b/src/intro_gui.cpp
@@ -9,7 +9,6 @@
#include "gui.h"
#include "window_gui.h"
#include "textbuf_gui.h"
-#include "player.h"
#include "network/network.h"
#include "variables.h"
#include "heightmap.h"
diff --git a/src/landscape.cpp b/src/landscape.cpp
index 3c0e52a7f..c2acd0b70 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 "player.h"
#include "spritecache.h"
#include "table/sprites.h"
#include <stdarg.h>
diff --git a/src/livery.h b/src/livery.h
index 51da83c51..64d6deba5 100644
--- a/src/livery.h
+++ b/src/livery.h
@@ -5,6 +5,7 @@
#ifndef LIVERY_H
#define LIVERY_H
+#include "player_type.h"
/* List of different livery schemes. */
enum LiveryScheme {
@@ -63,4 +64,11 @@ struct Livery {
byte colour2; ///< Second colour, for vehicles with 2CC support.
};
+/**
+ * Reset the livery schemes to the player's primary colour.
+ * This is used on loading games without livery information and on new player start up.
+ * @param p Player to reset.
+ */
+void ResetPlayerLivery(Player *p);
+
#endif /* LIVERY_H */
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index 17a426043..24a98c4ec 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -14,7 +14,6 @@
#include "window_func.h"
#include "textbuf_gui.h"
#include "viewport_func.h"
-#include "player.h"
#include "command_func.h"
#include "news.h"
#include "town.h"
@@ -49,6 +48,9 @@
#include "strings_func.h"
#include "zoom_func.h"
#include "string_func.h"
+#include "player_base.h"
+#include "player_func.h"
+#include "player_gui.h"
static int _rename_id = 1;
static int _rename_what = -1;
diff --git a/src/misc.cpp b/src/misc.cpp
index 853d41b76..c3d078338 100644
--- a/src/misc.cpp
+++ b/src/misc.cpp
@@ -7,7 +7,6 @@
#include "currency.h"
#include "landscape.h"
#include "news.h"
-#include "player.h"
#include "table/strings.h"
#include "table/sprites.h"
#include "saveload.h"
diff --git a/src/misc_cmd.cpp b/src/misc_cmd.cpp
index 1f05f5fd1..efa1268aa 100644
--- a/src/misc_cmd.cpp
+++ b/src/misc_cmd.cpp
@@ -7,7 +7,6 @@
#include "table/strings.h"
#include "command_func.h"
#include "economy_func.h"
-#include "player.h"
#include "gui.h"
#include "window_func.h"
#include "textbuf_gui.h"
@@ -20,6 +19,9 @@
#include "functions.h"
#include "vehicle_func.h"
#include "string_func.h"
+#include "player_func.h"
+#include "player_base.h"
+#include "player_gui.h"
/** Change the player's face.
* @param tile unused
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index f403f0674..3e5ed9633 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -22,7 +22,8 @@
#include "gfx_func.h"
#include "station.h"
#include "command_func.h"
-#include "player.h"
+#include "player_func.h"
+#include "player_base.h"
#include "town.h"
#include "network/network.h"
#include "variables.h"
@@ -40,6 +41,7 @@
#include "date_func.h"
#include "sound_func.h"
#include "string_func.h"
+#include "player_gui.h"
/* Variables to display file lists */
FiosItem *_fios_list;
diff --git a/src/network/core/tcp.h b/src/network/core/tcp.h
index 8314edc17..16a795e28 100644
--- a/src/network/core/tcp.h
+++ b/src/network/core/tcp.h
@@ -12,6 +12,7 @@
#include "os_abstraction.h"
#include "core.h"
#include "packet.h"
+#include "../../tile_type.h"
/**
* Enum with all types of UDP packets.
diff --git a/src/network/network.cpp b/src/network/network.cpp
index cba0c3829..7b44daa5c 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -32,6 +32,7 @@ extern const char _openttd_revision[];
#include "../core/random_func.hpp"
#include "../window_func.h"
#include "../string_func.h"
+#include "../player_func.h"
#ifdef DEBUG_DUMP_COMMANDS
#include "../core/alloc_func.hpp"
#endif /* DEBUG_DUMP_COMMANDS */
diff --git a/src/network/network.h b/src/network/network.h
index 81075d137..7fd551704 100644
--- a/src/network/network.h
+++ b/src/network/network.h
@@ -5,7 +5,8 @@
#ifdef ENABLE_NETWORK
-#include "../player.h"
+#include "../player_type.h"
+#include "../economy_type.h"
#include "core/config.h"
#include "core/game.h"
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index 0691cfabc..190f6b944 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -22,6 +22,9 @@
#include "../strings_func.h"
#include "../window_func.h"
#include "../string_func.h"
+#include "../player_func.h"
+#include "../player_base.h"
+#include "../player_gui.h"
// This file handles all the client-commands
diff --git a/src/network/network_data.cpp b/src/network/network_data.cpp
index 33e594256..f864fefd8 100644
--- a/src/network/network_data.cpp
+++ b/src/network/network_data.cpp
@@ -11,6 +11,7 @@
#include "../core/alloc_func.hpp"
#include "../string_func.h"
#include "../date_func.h"
+#include "../player_func.h"
// Add a command to the local command queue
void NetworkAddCommandQueue(NetworkTCPSocketHandler *cs, CommandPacket *cp)
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 20c5e8ca4..ee7106bcf 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -27,6 +27,7 @@
#include "../core/alloc_func.hpp"
#include "../string_func.h"
#include "../gfx_func.h"
+#include "../player_func.h"
#define BGC 5
#define BTC 15
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index 21f14356f..bb56bba89 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -23,6 +23,9 @@
#include "../core/alloc_func.hpp"
#include "../fileio.h"
#include "../string_func.h"
+#include "../player_base.h"
+#include "../player_func.h"
+#include "../player_gui.h"
// This file handles all the server-commands
diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp
index 741e83b40..441b45b0a 100644
--- a/src/network/network_udp.cpp
+++ b/src/network/network_udp.cpp
@@ -20,6 +20,8 @@
#include "../newgrf_config.h"
#include "../core/endian_func.hpp"
#include "../string_func.h"
+#include "../player_base.h"
+#include "../player_func.h"
#include "core/udp.h"
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 2ff8ed712..acccbf467 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -47,7 +47,7 @@
#include "sound_func.h"
#include "string_func.h"
#include "road_func.h"
-#include "player.h"
+#include "player_base.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 5a3de90e2..85af072ae 100644
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -8,7 +8,8 @@
#include "debug.h"
#include "engine.h"
#include "train.h"
-#include "player.h"
+#include "player_func.h"
+#include "player_base.h"
#include "station.h"
#include "airport.h"
#include "newgrf.h"
diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp
index 191f918bf..929e61890 100644
--- a/src/newgrf_house.cpp
+++ b/src/newgrf_house.cpp
@@ -23,7 +23,7 @@
#include "newgrf_commons.h"
#include "transparency.h"
#include "functions.h"
-#include "player.h"
+#include "player_func.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 be941f75f..4fd63b79f 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -20,7 +20,8 @@
#include "newgrf_town.h"
#include "window_func.h"
#include "town.h"
-#include "player.h"
+#include "player_func.h"
+#include "player_base.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_station.cpp b/src/newgrf_station.cpp
index e4b5cb02a..13c6da683 100644
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -23,7 +23,7 @@
#include "newgrf_town.h"
#include "gfx_func.h"
#include "date_func.h"
-#include "player.h"
+#include "player_func.h"
static StationClass station_classes[STAT_CLASS_MAX];
diff --git a/src/oldloader.cpp b/src/oldloader.cpp
index 52731c48c..86782a263 100644
--- a/src/oldloader.cpp
+++ b/src/oldloader.cpp
@@ -9,7 +9,8 @@
#include "town.h"
#include "industry.h"
#include "station.h"
-#include "player.h"
+#include "player_func.h"
+#include "player_base.h"
#include "engine.h"
#include "aircraft.h"
#include "roadveh.h"
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 7890c3cf6..426d85710 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -24,7 +24,8 @@
#include "gfx_func.h"
#include "window_func.h"
#include "window_gui.h"
-#include "player.h"
+#include "player_func.h"
+#include "player_base.h"
#include "command_func.h"
#include "town.h"
#include "industry.h"
diff --git a/src/openttd.h b/src/openttd.h
index 228fa5fa0..aea9a5336 100644
--- a/src/openttd.h
+++ b/src/openttd.h
@@ -45,8 +45,6 @@ assert_compile(sizeof(DestinationID) == sizeof(DepotID));
assert_compile(sizeof(DestinationID) == sizeof(WaypointID));
assert_compile(sizeof(DestinationID) == sizeof(StationID));
-typedef uint32 PlayerFace; ///< player face bits, info see in player_face.h
-
enum GameModes {
GM_MENU,
GM_NORMAL,
@@ -82,33 +80,6 @@ enum InitializeGameModes {
IG_DATE_RESET = 1, /* Reset the date when initializing a game */
};
-enum Owner {
- PLAYER_INACTIVE_CLIENT = 253,
- PLAYER_NEW_COMPANY = 254,
- PLAYER_SPECTATOR = 255,
- OWNER_BEGIN = 0x00,
- PLAYER_FIRST = 0x00,
- MAX_PLAYERS = 8,
- OWNER_TOWN = 0x0F, // a town owns the tile
- OWNER_NONE = 0x10, // nobody owns the tile
- OWNER_WATER = 0x11, // "water" owns the tile
- OWNER_END = 0x12,
- INVALID_OWNER = 0xFF,
- INVALID_PLAYER = 0xFF,
- /* Player identifiers All players below MAX_PLAYERS are playable
- * players, above, they are special, computer controlled players */
-};
-
-typedef Owner PlayerID;
-
-DECLARE_POSTFIX_INCREMENT(Owner);
-
-/** Define basic enum properties */
-template <> struct EnumPropsT<Owner> : MakeEnumPropsT<Owner, byte, OWNER_BEGIN, OWNER_END, INVALID_OWNER> {};
-typedef TinyEnumT<Owner> OwnerByte;
-typedef OwnerByte PlayerByte;
-
-
enum TransportType {
/* These constants are for now linked to the representation of bridges
* and tunnels, so they can be used by GetTileTrackStatus_TunnelBridge.
@@ -128,7 +99,6 @@ enum TransportType {
template <> struct EnumPropsT<TransportType> : MakeEnumPropsT<TransportType, byte, TRANSPORT_BEGIN, TRANSPORT_END, INVALID_TRANSPORT> {};
typedef TinyEnumT<TransportType> TransportTypeByte;
-
/* Display Options */
enum {
DO_SHOW_TOWN_NAMES = 0,
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index d2bd70db6..c301da838 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -11,7 +11,7 @@
#include "waypoint.h"
#include "command_func.h"
#include "station.h"
-#include "player.h"
+#include "player_func.h"
#include "news.h"
#include "saveload.h"
#include "vehicle_gui.h"
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index f7a0b32e6..d58489642 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -27,7 +27,7 @@
#include "window_func.h"
#include "vehicle_func.h"
#include "settings_type.h"
-#include "player.h"
+#include "player_func.h"
enum OrderWindowWidgets {
ORDER_WIDGET_CLOSEBOX = 0,
diff --git a/src/player.h b/src/player_base.h
index cc6133d72..ce068e9e4 100644
--- a/src/player.h
+++ b/src/player_base.h
@@ -1,9 +1,9 @@
/* $Id$ */
-/** @file player.h */
+/** @file player_base.h Definition of stuff that is very close to a player, like the player struct itself. */
-#ifndef PLAYER_H
-#define PLAYER_H
+#ifndef PLAYER_BASE_H
+#define PLAYER_BASE_H
#include "road_type.h"
#include "rail_type.h"
@@ -22,12 +22,6 @@ struct PlayerEconomyEntry {
Money company_value;
};
-/* The "steps" in loan size, in British Pounds! */
-enum {
- LOAN_INTERVAL = 10000,
- LOAN_INTERVAL_OLD_AI = 50000,
-};
-
struct Player {
uint32 name_2;
uint16 name_1;
@@ -77,22 +71,9 @@ struct Player {
uint16 num_engines[TOTAL_NUM_ENGINES]; ///< caches the number of engines of each type the player owns (no need to save this)
};
-uint16 GetDrawStringPlayerColor(PlayerID player);
-
-void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player);
-void GetNameOfOwner(Owner owner, TileIndex tile);
-Money CalculateCompanyValue(const Player *p);
-void InvalidatePlayerWindows(const Player *p);
-void SetLocalPlayer(PlayerID new_player);
+extern Player _players[MAX_PLAYERS];
#define FOR_ALL_PLAYERS(p) for (p = _players; p != endof(_players); p++)
-VARDEF PlayerByte _local_player;
-VARDEF PlayerByte _current_player;
-
-VARDEF Player _players[MAX_PLAYERS];
-/* NOSAVE: can be determined from player structs */
-VARDEF byte _player_colors[MAX_PLAYERS];
-
static inline byte ActivePlayerCount()
{
const Player *p;
@@ -111,45 +92,6 @@ static inline Player *GetPlayer(PlayerID i)
return &_players[i];
}
-static inline bool IsLocalPlayer()
-{
- return _local_player == _current_player;
-}
-
-static inline bool IsValidPlayer(PlayerID pi)
-{
- return IsInsideBS(pi, PLAYER_FIRST, MAX_PLAYERS);
-}
-
-static inline bool IsHumanPlayer(PlayerID pi)
-{
- return !GetPlayer(pi)->is_ai;
-}
-
-static inline bool IsInteractivePlayer(PlayerID pi)
-{
- return pi == _local_player;
-}
-
-void DrawPlayerIcon(PlayerID p, int x, int y);
-
-struct HighScore {
- char company[100];
- StringID title; ///< NO_SAVE, has troubles with changing string-numbers.
- uint16 score; ///< do NOT change type, will break hs.dat
-};
-
-VARDEF HighScore _highscore_table[5][5]; // 4 difficulty-settings (+ network); top 5
-void SaveToHighScore();
-void LoadFromHighScore();
-int8 SaveHighScoreValue(const Player *p);
-int8 SaveHighScoreValueNetwork();
-
-/**
- * Reset the livery schemes to the player's primary colour.
- * This is used on loading games without livery information and on new player start up.
- * @param p Player to reset.
- */
-void ResetPlayerLivery(Player *p);
+Money CalculateCompanyValue(const Player *p);
-#endif /* PLAYER_H */
+#endif /* PLAYER_BASE_H */
diff --git a/src/player_func.h b/src/player_func.h
new file mode 100644
index 000000000..2017e2cc6
--- /dev/null
+++ b/src/player_func.h
@@ -0,0 +1,53 @@
+/* $Id$ */
+
+/** @file player_func.h Functions related to players. */
+
+#ifndef PLAYER_FUNC_H
+#define PLAYER_FUNC_H
+
+#include "core/math_func.hpp"
+#include "player_type.h"
+#include "tile_type.h"
+
+void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player);
+void GetNameOfOwner(Owner owner, TileIndex tile);
+void SetLocalPlayer(PlayerID new_player);
+
+extern PlayerByte _local_player;
+extern PlayerByte _current_player;
+/* NOSAVE: can be determined from player structs */
+extern byte _player_colors[MAX_PLAYERS];
+extern PlayerFace _player_face; ///< for player face storage in openttd.cfg
+
+bool IsHumanPlayer(PlayerID pi);
+
+static inline bool IsLocalPlayer()
+{
+ return _local_player == _current_player;
+}
+
+static inline bool IsValidPlayer(PlayerID pi)
+{
+ return IsInsideBS(pi, PLAYER_FIRST, MAX_PLAYERS);
+}
+
+static inline bool IsInteractivePlayer(PlayerID pi)
+{
+ return pi == _local_player;
+}
+
+
+
+struct HighScore {
+ char company[100];
+ StringID title; ///< NO_SAVE, has troubles with changing string-numbers.
+ uint16 score; ///< do NOT change type, will break hs.dat
+};
+
+extern HighScore _highscore_table[5][5]; // 4 difficulty-settings (+ network); top 5
+void SaveToHighScore();
+void LoadFromHighScore();
+int8 SaveHighScoreValue(const Player *p);
+int8 SaveHighScoreValueNetwork();
+
+#endif /* PLAYER_FUNC_H */
diff --git a/src/player_gui.cpp b/src/player_gui.cpp
index 22c9f4e28..afdb26586 100644
--- a/src/player_gui.cpp
+++ b/src/player_gui.cpp
@@ -11,7 +11,8 @@
#include "textbuf_gui.h"
#include "viewport_func.h"
#include "gfx_func.h"
-#include "player.h"
+#include "player_func.h"
+#include "player_base.h"
#include "command_func.h"
#include "network/network.h"
#include "variables.h"
@@ -29,6 +30,13 @@
#include "date_func.h"
#include "string_func.h"
+/* player face selection window */
+struct facesel_d {
+ PlayerFace face; // player face bits
+ bool advanced; // advance player face selection window
+};
+assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(facesel_d));
+
static void DoShowPlayerFinances(PlayerID player, bool show_small, bool show_stickied);
static void DoSelectPlayerFace(PlayerID player, bool show_big);
diff --git a/src/player_gui.h b/src/player_gui.h
new file mode 100644
index 000000000..a1ed36fcb
--- /dev/null
+++ b/src/player_gui.h
@@ -0,0 +1,20 @@
+/* $Id$ */
+
+/** @file player_gui.h GUI Functions related to players. */
+
+#ifndef PLAYER_GUI_H
+#define PLAYER_GUI_H
+
+#include "player_type.h"
+
+uint16 GetDrawStringPlayerColor(PlayerID player);
+void DrawPlayerIcon(PlayerID p, int x, int y);
+
+void ShowPlayerStations(PlayerID player);
+void ShowPlayerFinances(PlayerID player);
+void ShowPlayerCompany(PlayerID player);
+
+void InvalidatePlayerWindows(const Player *p);
+void DeletePlayerWindows(PlayerID pi);
+
+#endif /* PLAYER_GUI_H */
diff --git a/src/player_type.h b/src/player_type.h
new file mode 100644
index 000000000..0e183fabe
--- /dev/null
+++ b/src/player_type.h
@@ -0,0 +1,41 @@
+/* $Id$ */
+
+/** @file player_type.h Types related to players. */
+
+#ifndef PLAYER_TYPE_H
+#define PLAYER_TYPE_H
+
+/**
+ * Enum for all players/owners.
+ */
+enum Owner {
+ /* Player identifiers All players below MAX_PLAYERS are playable
+ * players, above, they are special, computer controlled players */
+ OWNER_BEGIN = 0x00, ///< First Owner
+ PLAYER_FIRST = 0x00, ///< First Player, same as owner
+ MAX_PLAYERS = 0x08, ///< Maximum numbe rof players
+ OWNER_TOWN = 0x0F, ///< A town owns the tile, or a town is expanding
+ OWNER_NONE = 0x10, ///< The tile has no ownership
+ OWNER_WATER = 0x11, ///< The tile/execution is done by "water"
+ OWNER_END, ///< Last + 1 owner
+ INVALID_OWNER = 0xFF, ///< An invalid owner
+ INVALID_PLAYER = 0xFF, ///< And a valid owner
+
+ /* 'Fake' Players used for networks */
+ PLAYER_INACTIVE_CLIENT = 253, ///< The client is joining
+ PLAYER_NEW_COMPANY = 254, ///< The client wants a new company
+ PLAYER_SPECTATOR = 255, ///< The client is spectating
+};
+DECLARE_POSTFIX_INCREMENT(Owner);
+
+/** Define basic enum properties */
+template <> struct EnumPropsT<Owner> : MakeEnumPropsT<Owner, byte, OWNER_BEGIN, OWNER_END, INVALID_OWNER> {};
+typedef TinyEnumT<Owner> OwnerByte;
+
+typedef Owner PlayerID;
+typedef OwnerByte PlayerByte;
+
+struct Player;
+typedef uint32 PlayerFace; ///< player face bits, info see in player_face.h
+
+#endif /* PLAYER_TYPE_H */
diff --git a/src/players.cpp b/src/players.cpp
index 3945b2424..c2f587f9a 100644
--- a/src/players.cpp
+++ b/src/players.cpp
@@ -7,7 +7,8 @@
#include "engine.h"
#include "table/strings.h"
#include "table/sprites.h"
-#include "player.h"
+#include "player_func.h"
+#include "player_gui.h"
#include "town.h"
#include "station.h"
#include "news.h"
@@ -35,6 +36,14 @@
#include "road_func.h"
#include "rail.h"
+Player _players[MAX_PLAYERS];
+PlayerByte _local_player;
+PlayerByte _current_player;
+/* NOSAVE: can be determined from player structs */
+byte _player_colors[MAX_PLAYERS];
+PlayerFace _player_face; ///< for player face storage in openttd.cfg
+HighScore _highscore_table[5][5]; // 4 difficulty-settings (+ network); top 5
+
/**
* Sets the local player and updates the patch settings that are set on a
* per-company (player) basis to reflect the core's state in the GUI.
@@ -58,6 +67,11 @@ void SetLocalPlayer(PlayerID new_player)
}
}
+bool IsHumanPlayer(PlayerID pi)
+{
+ return !GetPlayer(pi)->is_ai;
+}
+
uint16 GetDrawStringPlayerColor(PlayerID player)
{
diff --git a/src/rail.cpp b/src/rail.cpp
index f903098ce..99119ce09 100644
--- a/src/rail.cpp
+++ b/src/rail.cpp
@@ -11,7 +11,8 @@
#include "tunnelbridge_map.h"
#include "settings_type.h"
#include "date_func.h"
-#include "player.h"
+#include "player_func.h"
+#include "player_base.h"
/* XXX: Below 3 tables store duplicate data. Maybe remove some? */
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index efe86595a..96a1cc176 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -27,7 +27,7 @@
#include "window_func.h"
#include "date_func.h"
#include "sound_func.h"
-#include "player.h"
+#include "player_func.h"
#include "bridge_map.h"
#include "rail_map.h"
diff --git a/src/road.cpp b/src/road.cpp
index 698bb37fe..7fa9b4398 100644
--- a/src/road.cpp
+++ b/src/road.cpp
@@ -7,7 +7,8 @@
#include "road_internal.h"
#include "water_map.h"
#include "genworld.h"
-#include "player.h"
+#include "player_func.h"
+#include "player_base.h"
#include "engine.h"
#include "settings_type.h"
#include "date_func.h"
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index 9094884a3..b8d5025d8 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -18,7 +18,6 @@
#include "town_map.h"
#include "viewport_func.h"
#include "command_func.h"
-#include "player.h"
#include "town.h"
#include "yapf/yapf.h"
#include "depot.h"
diff --git a/src/road_func.h b/src/road_func.h
index 59de2d0a5..6cc9b6a94 100644
--- a/src/road_func.h
+++ b/src/road_func.h
@@ -8,6 +8,7 @@
#include "core/bitmath_func.hpp"
#include "road_type.h"
#include "direction_func.h"
+#include "player_type.h"
/**
* Whether the given roadtype is valid.
diff --git a/src/road_gui.cpp b/src/road_gui.cpp
index f5194c367..5e793adc0 100644
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -23,7 +23,7 @@
#include "window_func.h"
#include "vehicle_func.h"
#include "sound_func.h"
-#include "player.h"
+#include "player_func.h"
static void ShowRVStationPicker(RoadStop::Type rs);
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index b445cdd03..83a9b1588 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -18,7 +18,8 @@
#include "news.h"
#include "pathfind.h"
#include "npf.h"
-#include "player.h"
+#include "player_func.h"
+#include "player_base.h"
#include "depot.h"
#include "bridge.h"
#include "tunnel_map.h"
diff --git a/src/saveload.cpp b/src/saveload.cpp
index 0a627a0dd..9970c6458 100644
--- a/src/saveload.cpp
+++ b/src/saveload.cpp
@@ -19,7 +19,6 @@
#include "station.h"
#include "thread.h"
#include "town.h"
-#include "player.h"
#include "saveload.h"
#include "network/network.h"
#include "variables.h"
diff --git a/src/screenshot.cpp b/src/screenshot.cpp
index 822a3e0cf..46e81fc62 100644
--- a/src/screenshot.cpp
+++ b/src/screenshot.cpp
@@ -7,7 +7,7 @@
#include "fileio.h"
#include "viewport_func.h"
#include "gfx_func.h"
-#include "player.h"
+#include "core/math_func.hpp"
#include "screenshot.h"
#include "variables.h"
#include "blitter/factory.hpp"
@@ -18,6 +18,7 @@
#include "core/endian_func.hpp"
#include "map_func.h"
#include "date_func.h"
+#include "player_func.h"
char _screenshot_format_name[8];
uint _num_screenshot_formats;
diff --git a/src/settings.cpp b/src/settings.cpp
index af6999ed4..773cdd45b 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -42,6 +42,7 @@
#include "vehicle_func.h"
#include "sound_func.h"
#include "core/alloc_func.hpp"
+#include "player_func.h"
#ifdef WITH_FREETYPE
#include "fontcache.h"
#endif
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index 0d4dff71e..161e7ea1a 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -15,7 +15,8 @@
#include "station.h"
#include "news.h"
#include "engine.h"
-#include "player.h"
+#include "player_func.h"
+#include "player_base.h"
#include "npf.h"
#include "depot.h"
#include "vehicle_gui.h"
diff --git a/src/signal.cpp b/src/signal.cpp
index b4e0bcfb6..d00931487 100644
--- a/src/signal.cpp
+++ b/src/signal.cpp
@@ -17,7 +17,7 @@
#include "track_type.h"
#include "track_func.h"
#include "signal_func.h"
-#include "player.h"
+#include "player_func.h"
/** these are the maximums used for updating signal blocks */
diff --git a/src/signs.cpp b/src/signs.cpp
index 7ae5d631f..cc20cab6e 100644
--- a/src/signs.cpp
+++ b/src/signs.cpp
@@ -6,7 +6,7 @@
#include "openttd.h"
#include "table/strings.h"
#include "landscape.h"
-#include "player.h"
+#include "player_func.h"
#include "signs.h"
#include "saveload.h"
#include "command_func.h"
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp
index 87c1b860b..6debec117 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -9,7 +9,7 @@
#include "gui.h"
#include "textbuf_gui.h"
#include "window_gui.h"
-#include "player.h"
+#include "player_gui.h"
#include "signs.h"
#include "debug.h"
#include "variables.h"
diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp
index ce583c9d5..0ca556a1e 100644
--- a/src/smallmap_gui.cpp
+++ b/src/smallmap_gui.cpp
@@ -18,7 +18,7 @@
#include "tunnel_map.h"
#include "viewport_func.h"
#include "gfx_func.h"
-#include "player.h"
+#include "player_base.h"
#include "town.h"
#include "variables.h"
#include "blitter/factory.hpp"
diff --git a/src/station.cpp b/src/station.cpp
index 2a04a88c6..404be9bba 100644
--- a/src/station.cpp
+++ b/src/station.cpp
@@ -13,7 +13,7 @@
#include "town.h"
#include "news.h"
#include "saveload.h"
-#include "player.h"
+#include "player_func.h"
#include "airport.h"
#include "sprite.h"
#include "depot.h"
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index a57784b58..2b927645d 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -19,7 +19,6 @@
#include "town.h"
#include "news.h"
#include "saveload.h"
-#include "player.h"
#include "airport.h"
#include "sprite.h"
#include "depot.h"
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 1648adb00..d7a768479 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -10,7 +10,7 @@
#include "window_gui.h"
#include "textbuf_gui.h"
#include "station.h"
-#include "player.h"
+#include "player_func.h"
#include "economy_func.h"
#include "town.h"
#include "command_func.h"
diff --git a/src/strings.cpp b/src/strings.cpp
index f5d063603..053984593 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -34,7 +34,8 @@
#include "date_func.h"
#include "vehicle_base.h"
#include "string_func.h"
-#include "player.h"
+#include "player_func.h"
+#include "player_base.h"
/* for opendir/readdir/closedir */
# include "fios.h"
diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp
index f88d288dd..bec2f7cdb 100644
--- a/src/subsidy_gui.cpp
+++ b/src/subsidy_gui.cpp
@@ -8,7 +8,6 @@
#include "station.h"
#include "industry.h"
#include "town.h"
-#include "player.h"
#include "economy_func.h"
#include "variables.h"
#include "cargotype.h"
diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp
index 79d7bc124..a38ce3ddb 100644
--- a/src/terraform_gui.cpp
+++ b/src/terraform_gui.cpp
@@ -8,7 +8,8 @@
#include "clear_map.h"
#include "table/sprites.h"
#include "table/strings.h"
-#include "player.h"
+#include "player_func.h"
+#include "player_base.h"
#include "gui.h"
#include "window_gui.h"
#include "viewport_func.h"
diff --git a/src/tile_cmd.h b/src/tile_cmd.h
index dacdfc571..cecb65e3b 100644
--- a/src/tile_cmd.h
+++ b/src/tile_cmd.h
@@ -12,6 +12,7 @@
#include "cargo_type.h"
#include "strings_type.h"
#include "date_type.h"
+#include "player_type.h"
/** The returned bits of VehicleEnterTile. */
enum VehicleEnterTileStatus {
diff --git a/src/tile_map.h b/src/tile_map.h
index faf5f8dd6..2723443fb 100644
--- a/src/tile_map.h
+++ b/src/tile_map.h
@@ -7,6 +7,7 @@
#include "tile_type.h"
#include "slope_type.h"
+#include "player_type.h"
#include "map_func.h"
#include "core/bitmath_func.hpp"
diff --git a/src/timetable_cmd.cpp b/src/timetable_cmd.cpp
index ea6f5d476..e46055f1d 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 "player.h"
#include "functions.h"
#include "window_func.h"
#include "vehicle_func.h"
diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp
index ca21d0102..cfecc3ed6 100644
--- a/src/timetable_gui.cpp
+++ b/src/timetable_gui.cpp
@@ -17,7 +17,7 @@
#include "vehicle_base.h"
#include "string_func.h"
#include "gfx_func.h"
-#include "player.h"
+#include "player_func.h"
static int GetOrderFromTimetableWndPt(Window *w, int y, const Vehicle *v)
{
diff --git a/src/town.h b/src/town.h
index 50dbb171e..65de8e3e9 100644
--- a/src/town.h
+++ b/src/town.h
@@ -11,6 +11,7 @@
#include "tile_type.h"
#include "date_type.h"
#include "town_type.h"
+#include "player_type.h"
enum {
HOUSE_NO_CLASS = 0,
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index ec7ca4e02..45151d476 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -18,7 +18,7 @@
#include "command_func.h"
#include "industry.h"
#include "station.h"
-#include "player.h"
+#include "player_base.h"
#include "news.h"
#include "saveload.h"
#include "gui.h"
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index e0091cb26..99c68967b 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -14,7 +14,9 @@
#include "window_gui.h"
#include "textbuf_gui.h"
#include "command_func.h"
-#include "player.h"
+#include "player_func.h"
+#include "player_base.h"
+#include "player_gui.h"
#include "network/network.h"
#include "variables.h"
#include "strings_func.h"
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 0a562c641..3eeb4ba18 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -21,7 +21,8 @@
#include "table/train_cmd.h"
#include "news.h"
#include "engine.h"
-#include "player.h"
+#include "player_func.h"
+#include "player_base.h"
#include "depot.h"
#include "waypoint.h"
#include "vehicle_gui.h"
diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp
index aacfe21d2..0c7a79659 100644
--- a/src/tree_cmd.cpp
+++ b/src/tree_cmd.cpp
@@ -20,7 +20,7 @@
#include "genworld.h"
#include "transparency.h"
#include "functions.h"
-#include "player.h"
+#include "player_func.h"
#include "sound_func.h"
/**
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index 26e43e872..57a56a48a 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -18,7 +18,6 @@
#include "unmovable_map.h"
#include "viewport_func.h"
#include "command_func.h"
-#include "player.h"
#include "town.h"
#include "variables.h"
#include "bridge.h"
diff --git a/src/unmovable_cmd.cpp b/src/unmovable_cmd.cpp
index 8a89ae775..ec735edeb 100644
--- a/src/unmovable_cmd.cpp
+++ b/src/unmovable_cmd.cpp
@@ -10,7 +10,8 @@
#include "landscape.h"
#include "command_func.h"
#include "viewport_func.h"
-#include "player.h"
+#include "player_func.h"
+#include "player_base.h"
#include "gui.h"
#include "station.h"
#include "town.h"
@@ -26,6 +27,7 @@
#include "functions.h"
#include "window_func.h"
#include "vehicle_func.h"
+#include "player_gui.h"
/** Destroy a HQ.
* During normal gameplay you can only implicitely destroy a HQ when you are
diff --git a/src/variables.h b/src/variables.h
index 11f5d3e90..253956d53 100644
--- a/src/variables.h
+++ b/src/variables.h
@@ -86,8 +86,6 @@ VARDEF StringID _error_message;
VARDEF bool _rightclick_emulate;
-VARDEF PlayerFace _player_face; ///< for player face storage in openttd.cfg
-
/* IN/OUT parameters to commands */
VARDEF TileIndex _build_tunnel_endtile;
VARDEF bool _generating_world;
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index d86536131..6631a064a 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -18,7 +18,7 @@
#include "news.h"
#include "command_func.h"
#include "saveload.h"
-#include "player.h"
+#include "player_func.h"
#include "engine.h"
#include "debug.h"
#include "vehicle_gui.h"
diff --git a/src/vehicle_base.h b/src/vehicle_base.h
index 734137667..9e630e0ea 100644
--- a/src/vehicle_base.h
+++ b/src/vehicle_base.h
@@ -15,6 +15,7 @@
#include "gfx_type.h"
#include "command_type.h"
#include "date_type.h"
+#include "player_type.h"
#include "oldpool.h"
#include "order.h"
#include "cargopacket.h"
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 3df4fb6c7..5f35fa8dc 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -5,7 +5,7 @@
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
-#include "player.h"
+#include "player_func.h"
#include "station.h"
#include "table/sprites.h"
#include "table/strings.h"
@@ -939,7 +939,6 @@ static void DrawVehicleListWindow(Window *w)
int max;
int i;
const PlayerID owner = (PlayerID)w->caption_color;
- const Player *p = GetPlayer(owner);
const uint16 window_type = w->window_number & VLW_MASK;
const uint16 index = GB(w->window_number, 16, 16);
@@ -959,7 +958,7 @@ static void DrawVehicleListWindow(Window *w)
break;
case VLW_STANDARD: /* Company Name */
- SetDParam(0, p->index);
+ SetDParam(0, owner);
SetDParam(1, w->vscroll.count);
break;
diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp
index 97b53e87f..0ba791c93 100644
--- a/src/video/dedicated_v.cpp
+++ b/src/video/dedicated_v.cpp
@@ -15,6 +15,7 @@
#include "../fios.h"
#include "../blitter/factory.hpp"
#include "../core/alloc_func.hpp"
+#include "../player_func.h"
#include "dedicated_v.h"
#ifdef BEOS_NET_SERVER
diff --git a/src/viewport.cpp b/src/viewport.cpp
index 03fe84a09..31f64163a 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -25,7 +25,7 @@
#include "strings_func.h"
#include "zoom_func.h"
#include "vehicle_func.h"
-#include "player.h"
+#include "player_func.h"
#define VIEWPORT_DRAW_MEM (65536 * 2)
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index 2d31c7038..76c69d59d 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -33,7 +33,7 @@
#include "vehicle_func.h"
#include "sound_func.h"
#include "variables.h"
-#include "player.h"
+#include "player_func.h"
static Vehicle *FindFloodableVehicleOnTile(TileIndex tile);
diff --git a/src/waypoint.cpp b/src/waypoint.cpp
index b228b0671..116a40144 100644
--- a/src/waypoint.cpp
+++ b/src/waypoint.cpp
@@ -30,7 +30,7 @@
#include "vehicle_base.h"
#include "string_func.h"
#include "signal_func.h"
-#include "player.h"
+#include "player_func.h"
enum {
diff --git a/src/widget.cpp b/src/widget.cpp
index 3e3dd2357..e45e38653 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -4,7 +4,8 @@
#include "stdafx.h"
#include "openttd.h"
-#include "player.h"
+#include "core/math_func.hpp"
+#include "player_func.h"
#include "table/sprites.h"
#include "table/strings.h"
#include "gfx_func.h"
diff --git a/src/window.cpp b/src/window.cpp
index 9d1b8f57d..5253244f3 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -6,7 +6,7 @@
#include <stdarg.h>
#include "openttd.h"
#include "debug.h"
-#include "player.h"
+#include "player_func.h"
#include "gfx_func.h"
#include "console.h"
#include "viewport_func.h"
diff --git a/src/window_func.h b/src/window_func.h
index 2af028356..299f4fc96 100644
--- a/src/window_func.h
+++ b/src/window_func.h
@@ -6,6 +6,7 @@
#define WINDOW_FUNC_H
#include "window_type.h"
+#include "player_type.h"
/**
* Marks the window as dirty for repaint.
@@ -18,7 +19,6 @@ void SendWindowMessageClass(WindowClass wnd_class, int msg, int wparam, int lpar
Window *FindWindowById(WindowClass cls, WindowNumber number);
void DeleteWindow(Window *w);
-void DeletePlayerWindows(PlayerID pi);
void ChangeWindowOwner(PlayerID old_player, PlayerID new_player);
void ResizeWindow(Window *w, int x, int y);
diff --git a/src/window_gui.h b/src/window_gui.h
index cb1ffa02d..277ef3c27 100644
--- a/src/window_gui.h
+++ b/src/window_gui.h
@@ -8,6 +8,7 @@
#include "core/bitmath_func.hpp"
#include "vehicle_type.h"
#include "viewport_type.h"
+#include "player_type.h"
/**
* The maximum number of windows that can be opened.
@@ -367,13 +368,6 @@ struct smallmap_d {
};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(smallmap_d));
-/* player face selection window */
-struct facesel_d {
- PlayerFace face; // player face bits
- bool advanced; // advance player face selection window
-};
-assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(facesel_d));
-
struct refit_d {
int sel;
struct RefitOption *cargo;