(svn r11818) -Codechange: split player.h into smaller pieces.
--- a/src/ai/ai.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/ai/ai.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/ai/ai.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/ai/ai.h Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/ai/default/default.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/ai/default/default.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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?
--- a/src/ai/default/default.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/ai/default/default.h Sat Jan 12 14:10:35 2008 +0000
@@ -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);
--- a/src/ai/trolly/build.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/ai/trolly/build.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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
--- a/src/ai/trolly/pathfinder.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/ai/trolly/pathfinder.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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
--- a/src/ai/trolly/shared.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/ai/trolly/shared.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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)
--- a/src/ai/trolly/trolly.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/ai/trolly/trolly.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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];
--- a/src/ai/trolly/trolly.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/ai/trolly/trolly.h Sat Jan 12 14:10:35 2008 +0000
@@ -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
--- a/src/aircraft_cmd.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/aircraft_cmd.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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)
{
--- a/src/aircraft_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/aircraft_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/airport_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/airport_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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;
--- a/src/autoreplace_cmd.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/autoreplace_cmd.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/autoreplace_func.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/autoreplace_func.h Sat Jan 12 14:10:35 2008 +0000
@@ -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.
--- a/src/autoreplace_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/autoreplace_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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;
--- a/src/autoslope.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/autoslope.h Sat Jan 12 14:10:35 2008 +0000
@@ -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.
--- a/src/build_vehicle_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/build_vehicle_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/clear_cmd.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/clear_cmd.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/command.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/command.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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;
--- a/src/console.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/console.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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>
--- a/src/console_cmds.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/console_cmds.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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;
--- a/src/depot_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/depot_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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.
--- a/src/disaster_cmd.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/disaster_cmd.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/dock_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/dock_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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();
--- a/src/economy.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/economy.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/economy_func.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/economy_func.h Sat Jan 12 14:10:35 2008 +0000
@@ -12,6 +12,7 @@
#include "tile_type.h"
#include "town_type.h"
#include "industry_type.h"
+#include "player_type.h"
struct Player;
--- a/src/economy_type.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/economy_type.h Sat Jan 12 14:10:35 2008 +0000
@@ -127,4 +127,10 @@
INVALID_EXPENSES = 0xFF,
};
+/* The "steps" in loan size, in British Pounds! */
+enum {
+ LOAN_INTERVAL = 10000,
+ LOAN_INTERVAL_OLD_AI = 50000,
+};
+
#endif /* ECONOMY_TYPE_H */
--- a/src/elrail.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/elrail.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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)
--- a/src/engine.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/engine.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/engine.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/engine.h Sat Jan 12 14:10:35 2008 +0000
@@ -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
--- a/src/genworld.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/genworld.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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();
--- a/src/genworld.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/genworld.h Sat Jan 12 14:10:35 2008 +0000
@@ -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.
--- a/src/genworld_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/genworld_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/graph_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/graph_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/group.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/group.h Sat Jan 12 14:10:35 2008 +0000
@@ -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,
--- a/src/group_cmd.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/group_cmd.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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
--- a/src/group_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/group_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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 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 @@
/* 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) {
--- a/src/gui.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/gui.h Sat Jan 12 14:10:35 2008 +0000
@@ -85,9 +85,6 @@
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);
--- a/src/industry_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/industry_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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;
--- a/src/intro_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/intro_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/landscape.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/landscape.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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>
--- a/src/livery.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/livery.h Sat Jan 12 14:10:35 2008 +0000
@@ -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 @@
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 */
--- a/src/main_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/main_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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;
--- a/src/misc.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/misc.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/misc_cmd.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/misc_cmd.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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
--- a/src/misc_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/misc_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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;
--- a/src/network/core/tcp.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/network/core/tcp.h Sat Jan 12 14:10:35 2008 +0000
@@ -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.
--- a/src/network/network.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/network/network.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -32,6 +32,7 @@
#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 */
--- a/src/network/network.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/network/network.h Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/network/network_client.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/network/network_client.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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
--- a/src/network/network_data.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/network/network_data.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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)
--- a/src/network/network_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/network/network_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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
--- a/src/network/network_server.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/network/network_server.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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
--- a/src/network/network_udp.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/network/network_udp.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/newgrf.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/newgrf.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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)
--- a/src/newgrf_engine.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/newgrf_engine.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/newgrf_house.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/newgrf_house.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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];
--- a/src/newgrf_industries.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/newgrf_industries.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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
--- a/src/newgrf_station.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/newgrf_station.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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];
--- a/src/oldloader.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/oldloader.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/openttd.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/openttd.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/openttd.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/openttd.h Sat Jan 12 14:10:35 2008 +0000
@@ -45,8 +45,6 @@
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 @@
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 @@
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,
--- a/src/order_cmd.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/order_cmd.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/order_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/order_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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,
--- a/src/player.h Sat Jan 12 13:36:22 2008 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,155 +0,0 @@
-/* $Id$ */
-
-/** @file player.h */
-
-#ifndef PLAYER_H
-#define PLAYER_H
-
-#include "road_type.h"
-#include "rail_type.h"
-#include "date_type.h"
-#include "engine.h"
-#include "livery.h"
-#include "autoreplace_type.h"
-#include "economy_type.h"
-#include "tile_type.h"
-
-struct PlayerEconomyEntry {
- Money income;
- Money expenses;
- int32 delivered_cargo;
- int32 performance_history; ///< player score (scale 0-1000)
- 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;
-
- uint16 president_name_1;
- uint32 president_name_2;
-
- PlayerFace face;
-
- Money player_money;
- Money current_loan;
-
- byte player_color;
- Livery livery[LS_END];
- byte player_money_fraction;
- RailTypes avail_railtypes;
- RoadTypes avail_roadtypes;
- byte block_preview;
- PlayerByte index;
-
- uint16 cargo_types; ///< which cargo types were transported the last year
-
- TileIndex location_of_house;
- TileIndex last_build_coordinate;
-
- PlayerByte share_owners[4];
-
- Year inaugurated_year;
- byte num_valid_stat_ent;
-
- byte quarters_of_bankrupcy;
- byte bankrupt_asked; ///< which players were asked about buying it?
- int16 bankrupt_timeout;
- Money bankrupt_value;
-
- bool is_active;
- bool is_ai;
-
- Money yearly_expenses[3][13];
- PlayerEconomyEntry cur_economy;
- PlayerEconomyEntry old_economy[24];
- EngineRenewList engine_renew_list; ///< Defined later
- bool engine_renew;
- bool renew_keep_length;
- int16 engine_renew_months;
- uint32 engine_renew_money;
- 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);
-#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;
- byte count = 0;
-
- FOR_ALL_PLAYERS(p) {
- if (p->is_active) count++;
- }
-
- return count;
-}
-
-static inline Player *GetPlayer(PlayerID i)
-{
- assert(IsInsideBS(i, PLAYER_FIRST, lengthof(_players)));
- 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);
-
-#endif /* PLAYER_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/player_base.h Sat Jan 12 14:10:35 2008 +0000
@@ -0,0 +1,97 @@
+/* $Id$ */
+
+/** @file player_base.h Definition of stuff that is very close to a player, like the player struct itself. */
+
+#ifndef PLAYER_BASE_H
+#define PLAYER_BASE_H
+
+#include "road_type.h"
+#include "rail_type.h"
+#include "date_type.h"
+#include "engine.h"
+#include "livery.h"
+#include "autoreplace_type.h"
+#include "economy_type.h"
+#include "tile_type.h"
+
+struct PlayerEconomyEntry {
+ Money income;
+ Money expenses;
+ int32 delivered_cargo;
+ int32 performance_history; ///< player score (scale 0-1000)
+ Money company_value;
+};
+
+struct Player {
+ uint32 name_2;
+ uint16 name_1;
+
+ uint16 president_name_1;
+ uint32 president_name_2;
+
+ PlayerFace face;
+
+ Money player_money;
+ Money current_loan;
+
+ byte player_color;
+ Livery livery[LS_END];
+ byte player_money_fraction;
+ RailTypes avail_railtypes;
+ RoadTypes avail_roadtypes;
+ byte block_preview;
+ PlayerByte index;
+
+ uint16 cargo_types; ///< which cargo types were transported the last year
+
+ TileIndex location_of_house;
+ TileIndex last_build_coordinate;
+
+ PlayerByte share_owners[4];
+
+ Year inaugurated_year;
+ byte num_valid_stat_ent;
+
+ byte quarters_of_bankrupcy;
+ byte bankrupt_asked; ///< which players were asked about buying it?
+ int16 bankrupt_timeout;
+ Money bankrupt_value;
+
+ bool is_active;
+ bool is_ai;
+
+ Money yearly_expenses[3][13];
+ PlayerEconomyEntry cur_economy;
+ PlayerEconomyEntry old_economy[24];
+ EngineRenewList engine_renew_list; ///< Defined later
+ bool engine_renew;
+ bool renew_keep_length;
+ int16 engine_renew_months;
+ uint32 engine_renew_money;
+ uint16 num_engines[TOTAL_NUM_ENGINES]; ///< caches the number of engines of each type the player owns (no need to save this)
+};
+
+extern Player _players[MAX_PLAYERS];
+#define FOR_ALL_PLAYERS(p) for (p = _players; p != endof(_players); p++)
+
+static inline byte ActivePlayerCount()
+{
+ const Player *p;
+ byte count = 0;
+
+ FOR_ALL_PLAYERS(p) {
+ if (p->is_active) count++;
+ }
+
+ return count;
+}
+
+static inline Player *GetPlayer(PlayerID i)
+{
+ assert(IsInsideBS(i, PLAYER_FIRST, lengthof(_players)));
+ return &_players[i];
+}
+
+Money CalculateCompanyValue(const Player *p);
+
+#endif /* PLAYER_BASE_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/player_func.h Sat Jan 12 14:10:35 2008 +0000
@@ -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 */
--- a/src/player_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/player_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/player_gui.h Sat Jan 12 14:10:35 2008 +0000
@@ -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 */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/player_type.h Sat Jan 12 14:10:35 2008 +0000
@@ -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 */
--- a/src/players.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/players.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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 @@
}
}
+bool IsHumanPlayer(PlayerID pi)
+{
+ return !GetPlayer(pi)->is_ai;
+}
+
uint16 GetDrawStringPlayerColor(PlayerID player)
{
--- a/src/rail.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/rail.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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? */
--- a/src/rail_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/rail_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/road.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/road.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/road_cmd.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/road_cmd.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/road_func.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/road_func.h Sat Jan 12 14:10:35 2008 +0000
@@ -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.
--- a/src/road_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/road_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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);
--- a/src/roadveh_cmd.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/roadveh_cmd.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/saveload.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/saveload.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/screenshot.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/screenshot.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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;
--- a/src/settings.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/settings.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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
--- a/src/ship_cmd.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/ship_cmd.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/signal.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/signal.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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 */
--- a/src/signs.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/signs.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/signs_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/signs_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/smallmap_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/smallmap_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/station.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/station.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/station_cmd.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/station_cmd.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/station_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/station_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/strings.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/strings.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/subsidy_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/subsidy_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/terraform_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/terraform_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/tile_cmd.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/tile_cmd.h Sat Jan 12 14:10:35 2008 +0000
@@ -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 {
--- a/src/tile_map.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/tile_map.h Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/timetable_cmd.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/timetable_cmd.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/timetable_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/timetable_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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)
{
--- a/src/town.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/town.h Sat Jan 12 14:10:35 2008 +0000
@@ -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,
--- a/src/town_cmd.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/town_cmd.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/town_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/town_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/train_cmd.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/train_cmd.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/tree_cmd.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/tree_cmd.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -20,7 +20,7 @@
#include "genworld.h"
#include "transparency.h"
#include "functions.h"
-#include "player.h"
+#include "player_func.h"
#include "sound_func.h"
/**
--- a/src/tunnelbridge_cmd.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/tunnelbridge_cmd.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/unmovable_cmd.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/unmovable_cmd.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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
--- a/src/variables.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/variables.h Sat Jan 12 14:10:35 2008 +0000
@@ -86,8 +86,6 @@
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;
--- a/src/vehicle.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/vehicle.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/vehicle_base.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/vehicle_base.h Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/vehicle_gui.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/vehicle_gui.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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 @@
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 @@
break;
case VLW_STANDARD: /* Company Name */
- SetDParam(0, p->index);
+ SetDParam(0, owner);
SetDParam(1, w->vscroll.count);
break;
--- a/src/video/dedicated_v.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/video/dedicated_v.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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
--- a/src/viewport.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/viewport.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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)
--- a/src/water_cmd.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/water_cmd.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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);
--- a/src/waypoint.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/waypoint.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -30,7 +30,7 @@
#include "vehicle_base.h"
#include "string_func.h"
#include "signal_func.h"
-#include "player.h"
+#include "player_func.h"
enum {
--- a/src/widget.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/widget.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/window.cpp Sat Jan 12 13:36:22 2008 +0000
+++ b/src/window.cpp Sat Jan 12 14:10:35 2008 +0000
@@ -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"
--- a/src/window_func.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/window_func.h Sat Jan 12 14:10:35 2008 +0000
@@ -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 @@
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);
--- a/src/window_gui.h Sat Jan 12 13:36:22 2008 +0000
+++ b/src/window_gui.h Sat Jan 12 14:10:35 2008 +0000
@@ -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 @@
};
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;