(svn r11818) -Codechange: split player.h into smaller pieces.

pull/155/head
rubidium 17 years ago
parent 63cc41cd1c
commit 2fc62eab05

@ -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"

@ -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"

@ -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?

@ -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);

@ -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

@ -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

@ -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)

@ -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];

@ -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

@ -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)
{

@ -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"

@ -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;

@ -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"

@ -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.

@ -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;

@ -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.

@ -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"

@ -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"

@ -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;

@ -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>

@ -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;

@ -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.

@ -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"

@ -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();

@ -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"

@ -12,6 +12,7 @@
#include "tile_type.h"
#include "town_type.h"
#include "industry_type.h"
#include "player_type.h"
struct Player;

@ -127,4 +127,10 @@ enum ExpensesType {
INVALID_EXPENSES = 0xFF,
};
/* The "steps" in loan size, in British Pounds! */
enum {
LOAN_INTERVAL = 10000,
LOAN_INTERVAL_OLD_AI = 50000,
};
#endif /* ECONOMY_TYPE_H */

@ -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)

@ -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"

@ -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

@ -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();

@ -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.

@ -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"

@ -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"

@ -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,

@ -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

@ -24,7 +24,7 @@
#include "string_func.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "player.h"
#include "player_func.h"
struct Sorting {
@ -289,7 +289,6 @@ static void UpdateGroupActionDropdown(Window *w, GroupID gid, bool refresh = tru
static void GroupWndProc(Window *w, WindowEvent *e)
{
const PlayerID owner = (PlayerID)GB(w->window_number, 0, 8);
const Player *p = GetPlayer(owner);
groupveh_d *gv = &WP(w, groupveh_d);
grouplist_d *gl = &WP(w, groupveh_d).gl;
@ -369,7 +368,7 @@ static void GroupWndProc(Window *w, WindowEvent *e)
/* If selected_group == DEFAULT_GROUP || ALL_GROUP, draw the standard caption
We list all vehicles or ungrouped vehicles */
if (IsDefaultGroupID(gv->group_sel) || IsAllGroupID(gv->group_sel)) {
SetDParam(0, p->index);
SetDParam(0, owner);
SetDParam(1, gv->l.list_length);
switch (gv->vehicle_type) {

@ -85,9 +85,6 @@ void ShowBuildTreesScenToolbar();
void ShowTownDirectory();
void ShowIndustryDirectory();
void ShowSubsidiesList();
void ShowPlayerStations(PlayerID player);
void ShowPlayerFinances(PlayerID player);
void ShowPlayerCompany(PlayerID player);
void ShowEstimatedCostOrIncome(Money cost, int x, int y);
void ShowErrorMessage(StringID msg_1, StringID msg_2, int x, int y);

@ -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;

@ -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"

@ -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>

@ -5,6 +5,7 @@
#ifndef LIVERY_H
#define LIVERY_H
#include "player_type.h"
/* List of different livery schemes. */
enum LiveryScheme {
@ -63,4 +64,11 @@ struct Livery {
byte colour2; ///< Second colour, for vehicles with 2CC support.
};
/**
* Reset the livery schemes to the player's primary colour.
* This is used on loading games without livery information and on new player start up.
* @param p Player to reset.
*/
void ResetPlayerLivery(Player *p);
#endif /* LIVERY_H */

@ -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;

@ -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"

@ -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

@ -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;

@ -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.

@ -32,6 +32,7 @@ extern const char _openttd_revision[];
#include "../core/random_func.hpp"
#include "../window_func.h"
#include "../string_func.h"
#include "../player_func.h"
#ifdef DEBUG_DUMP_COMMANDS
#include "../core/alloc_func.hpp"
#endif /* DEBUG_DUMP_COMMANDS */

@ -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"

@ -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

@ -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)

@ -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

@ -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

@ -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"

@ -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)

@ -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"

@ -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];

@ -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

@ -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];

@ -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"

@ -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"

@ -45,8 +45,6 @@ assert_compile(sizeof(DestinationID) == sizeof(DepotID));
assert_compile(sizeof(DestinationID) == sizeof(WaypointID));
assert_compile(sizeof(DestinationID) == sizeof(StationID));
typedef uint32 PlayerFace; ///< player face bits, info see in player_face.h
enum GameModes {
GM_MENU,
GM_NORMAL,
@ -82,33 +80,6 @@ enum InitializeGameModes {
IG_DATE_RESET = 1, /* Reset the date when initializing a game */
};
enum Owner {
PLAYER_INACTIVE_CLIENT = 253,
PLAYER_NEW_COMPANY = 254,
PLAYER_SPECTATOR = 255,
OWNER_BEGIN = 0x00,
PLAYER_FIRST = 0x00,
MAX_PLAYERS = 8,
OWNER_TOWN = 0x0F, // a town owns the tile
OWNER_NONE = 0x10, // nobody owns the tile
OWNER_WATER = 0x11, // "water" owns the tile
OWNER_END = 0x12,
INVALID_OWNER = 0xFF,
INVALID_PLAYER = 0xFF,
/* Player identifiers All players below MAX_PLAYERS are playable
* players, above, they are special, computer controlled players */
};
typedef Owner PlayerID;
DECLARE_POSTFIX_INCREMENT(Owner);
/** Define basic enum properties */
template <> struct EnumPropsT<Owner> : MakeEnumPropsT<Owner, byte, OWNER_BEGIN, OWNER_END, INVALID_OWNER> {};
typedef TinyEnumT<Owner> OwnerByte;
typedef OwnerByte PlayerByte;
enum TransportType {
/* These constants are for now linked to the representation of bridges
* and tunnels, so they can be used by GetTileTrackStatus_TunnelBridge.
@ -128,7 +99,6 @@ enum TransportType {
template <> struct EnumPropsT<TransportType> : MakeEnumPropsT<TransportType, byte, TRANSPORT_BEGIN, TRANSPORT_END, INVALID_TRANSPORT> {};
typedef TinyEnumT<TransportType> TransportTypeByte;
/* Display Options */
enum {
DO_SHOW_TOWN_NAMES = 0,

@ -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"

@ -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,

@ -1,9 +1,9 @@
/* $Id$ */
/** @file player.h */
/** @file player_base.h Definition of stuff that is very close to a player, like the player struct itself. */
#ifndef PLAYER_H
#define PLAYER_H
#ifndef PLAYER_BASE_H
#define PLAYER_BASE_H
#include "road_type.h"
#include "rail_type.h"
@ -22,12 +22,6 @@ struct PlayerEconomyEntry {
Money company_value;
};
/* The "steps" in loan size, in British Pounds! */
enum {
LOAN_INTERVAL = 10000,
LOAN_INTERVAL_OLD_AI = 50000,
};
struct Player {
uint32 name_2;
uint16 name_1;
@ -77,22 +71,9 @@ struct Player {
uint16 num_engines[TOTAL_NUM_ENGINES]; ///< caches the number of engines of each type the player owns (no need to save this)
};
uint16 GetDrawStringPlayerColor(PlayerID player);
void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player);
void GetNameOfOwner(Owner owner, TileIndex tile);
Money CalculateCompanyValue(const Player *p);
void InvalidatePlayerWindows(const Player *p);
void SetLocalPlayer(PlayerID new_player);
extern Player _players[MAX_PLAYERS];
#define FOR_ALL_PLAYERS(p) for (p = _players; p != endof(_players); p++)
VARDEF PlayerByte _local_player;
VARDEF PlayerByte _current_player;
VARDEF Player _players[MAX_PLAYERS];
/* NOSAVE: can be determined from player structs */
VARDEF byte _player_colors[MAX_PLAYERS];
static inline byte ActivePlayerCount()
{
const Player *p;
@ -111,45 +92,6 @@ static inline Player *GetPlayer(PlayerID i)
return &_players[i];
}
static inline bool IsLocalPlayer()
{
return _local_player == _current_player;
}
static inline bool IsValidPlayer(PlayerID pi)
{
return IsInsideBS(pi, PLAYER_FIRST, MAX_PLAYERS);
}
static inline bool IsHumanPlayer(PlayerID pi)
{
return !GetPlayer(pi)->is_ai;
}
static inline bool IsInteractivePlayer(PlayerID pi)
{
return pi == _local_player;
}
void DrawPlayerIcon(PlayerID p, int x, int y);
struct HighScore {
char company[100];
StringID title; ///< NO_SAVE, has troubles with changing string-numbers.
uint16 score; ///< do NOT change type, will break hs.dat
};
VARDEF HighScore _highscore_table[5][5]; // 4 difficulty-settings (+ network); top 5
void SaveToHighScore();
void LoadFromHighScore();
int8 SaveHighScoreValue(const Player *p);
int8 SaveHighScoreValueNetwork();
/**
* Reset the livery schemes to the player's primary colour.
* This is used on loading games without livery information and on new player start up.
* @param p Player to reset.
*/
void ResetPlayerLivery(Player *p);
Money CalculateCompanyValue(const Player *p);
#endif /* PLAYER_H */
#endif /* PLAYER_BASE_H */

@ -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 */

@ -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);

@ -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 */

@ -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 */

@ -7,7 +7,8 @@
#include "engine.h"
#include "table/strings.h"
#include "table/sprites.h"
#include "player.h"
#include "player_func.h"
#include "player_gui.h"
#include "town.h"
#include "station.h"
#include "news.h"
@ -35,6 +36,14 @@
#include "road_func.h"
#include "rail.h"
Player _players[MAX_PLAYERS];
PlayerByte _local_player;
PlayerByte _current_player;
/* NOSAVE: can be determined from player structs */
byte _player_colors[MAX_PLAYERS];
PlayerFace _player_face; ///< for player face storage in openttd.cfg
HighScore _highscore_table[5][5]; // 4 difficulty-settings (+ network); top 5
/**
* Sets the local player and updates the patch settings that are set on a
* per-company (player) basis to reflect the core's state in the GUI.
@ -58,6 +67,11 @@ void SetLocalPlayer(PlayerID new_player)
}
}
bool IsHumanPlayer(PlayerID pi)
{
return !GetPlayer(pi)->is_ai;
}
uint16 GetDrawStringPlayerColor(PlayerID player)
{

@ -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? */

@ -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"

@ -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"

@ -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"

@ -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.

@ -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);

@ -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"

@ -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"

@ -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;

@ -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

@ -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"

@ -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 */

@ -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"

@ -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"

@ -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"

@ -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"

@ -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"

@ -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"

@ -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"

@ -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"

@ -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"

@ -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 {

@ -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"

@ -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"

@ -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)
{

@ -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,

@ -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"

@ -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"

@ -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"

@ -20,7 +20,7 @@
#include "genworld.h"
#include "transparency.h"
#include "functions.h"
#include "player.h"
#include "player_func.h"
#include "sound_func.h"
/**

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save