(svn r11818) -Codechange: split player.h into smaller pieces.
parent
63cc41cd1c
commit
2fc62eab05
@ -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 */
|
@ -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 */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue