Mercurial > hg > openttd
changeset 8254:7d580c9c41fb draft
(svn r11818) -Codechange: split player.h into smaller pieces.
line wrap: on
line diff
--- 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"
--- 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"
--- 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?
--- 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);
--- 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
--- 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
--- 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)
--- 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];
--- 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
--- 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) {
--- 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"
--- 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;
--- 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"
--- 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.
--- 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;
--- 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.
--- 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"
--- 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"
--- 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;
--- 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>
--- 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;
--- 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.
--- 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"
--- 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();
--- 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"
--- 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;
--- a/src/economy_type.h +++ b/src/economy_type.h @@ -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 +++ 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)
--- 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"
--- 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
--- 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();
--- 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.
--- 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"
--- 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"
--- 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,
--- 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
--- 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 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 +++ b/src/gui.h @@ -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 +++ 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;
--- 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"
--- 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>
--- 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 @@ 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 +++ 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;
--- 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"
--- 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
--- 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;
--- 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.
--- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -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 +++ 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"
--- 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
--- 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)
--- 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
--- 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
--- 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"
--- 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)
--- 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"
--- 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];
--- 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
--- 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];
--- 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"
--- 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"
--- a/src/openttd.h +++ b/src/openttd.h @@ -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 +++ 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"
--- 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,
deleted file mode 100644 --- a/src/player.h +++ /dev/null @@ -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 */
new file mode 100644 --- /dev/null +++ b/src/player_base.h @@ -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 */
new file mode 100644 --- /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 */
--- 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);
new file mode 100644 --- /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 */
new file mode 100644 --- /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 */
--- 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 @@ } } +bool IsHumanPlayer(PlayerID pi) +{ + return !GetPlayer(pi)->is_ai; +} + uint16 GetDrawStringPlayerColor(PlayerID player) {
--- 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? */
--- 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"
--- 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"
--- 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"
--- 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.
--- 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);
--- 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"
--- 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"
--- 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;
--- 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
--- 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"
--- 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 */
--- 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"
--- 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"
--- 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"
--- 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"
--- 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"
--- 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"
--- 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"
--- 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"
--- 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"
--- 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 {
--- 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"
--- 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"
--- 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) {
--- 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,
--- 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"
--- 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"
--- 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"
--- 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" /**
--- 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"
--- 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
--- a/src/variables.h +++ b/src/variables.h @@ -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 +++ 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"
--- 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"
--- 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 @@ 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 +++ 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
--- 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)
--- 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);
--- 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 {
--- 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"
--- 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"
--- 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 @@ 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 +++ 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 @@ }; 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;