src/player_type.h
changeset 10207 c291a21b304e
parent 9913 d9ce89020cc0
equal deleted inserted replaced
10206:0050610c0368 10207:c291a21b304e
     1 /* $Id$ */
     1 /* $Id$ */
     2 
     2 
     3 /** @file player_type.h Types related to players. */
     3 /** @file company_type.h Types related to companies. */
     4 
     4 
     5 #ifndef PLAYER_TYPE_H
     5 #ifndef COMPANY_TYPE_H
     6 #define PLAYER_TYPE_H
     6 #define COMPANY_TYPE_H
     7 
     7 
     8 #include "core/enum_type.hpp"
     8 #include "core/enum_type.hpp"
     9 
     9 
    10 /**
    10 /**
    11  * Enum for all players/owners.
    11  * Enum for all companies/owners.
    12  */
    12  */
    13 enum Owner {
    13 enum Owner {
    14 	/* Player identifiers All players below MAX_PLAYERS are playable
    14 	/* All companies below MAX_COMPANIES are playable
    15 	 * players, above, they are special, computer controlled players */
    15 	 * companies, above, they are special, computer controlled 'companies' */
    16 	OWNER_BEGIN     = 0x00, ///< First Owner
    16 	OWNER_BEGIN     = 0x00, ///< First owner
    17 	PLAYER_FIRST    = 0x00, ///< First Player, same as owner
    17 	COMPANY_FIRST   = 0x00, ///< First company, same as owner
    18 	MAX_PLAYERS     = 0x08, ///< Maximum numbe rof players
    18 	MAX_COMPANIES   = 0x08, ///< Maximum number of companies
    19 	OWNER_TOWN      = 0x0F, ///< A town owns the tile, or a town is expanding
    19 	OWNER_TOWN      = 0x0F, ///< A town owns the tile, or a town is expanding
    20 	OWNER_NONE      = 0x10, ///< The tile has no ownership
    20 	OWNER_NONE      = 0x10, ///< The tile has no ownership
    21 	OWNER_WATER     = 0x11, ///< The tile/execution is done by "water"
    21 	OWNER_WATER     = 0x11, ///< The tile/execution is done by "water"
    22 	OWNER_END,              ///< Last + 1 owner
    22 	OWNER_END,              ///< Last + 1 owner
    23 	INVALID_OWNER   = 0xFF, ///< An invalid owner
    23 	INVALID_OWNER   = 0xFF, ///< An invalid owner
    24 	INVALID_PLAYER  = 0xFF, ///< And a valid owner
    24 	INVALID_COMPANY = 0xFF, ///< An invalid company
    25 
    25 
    26 	/* 'Fake' Players used for networks */
    26 	/* 'Fake' companies used for networks */
    27 	PLAYER_INACTIVE_CLIENT = 253, ///< The client is joining
    27 	COMPANY_INACTIVE_CLIENT = 253, ///< The client is joining
    28 	PLAYER_NEW_COMPANY     = 254, ///< The client wants a new company
    28 	COMPANY_NEW_COMPANY     = 254, ///< The client wants a new company
    29 	PLAYER_SPECTATOR       = 255, ///< The client is spectating
    29 	COMPANY_SPECTATOR       = 255, ///< The client is spectating
    30 };
    30 };
    31 DECLARE_POSTFIX_INCREMENT(Owner);
    31 DECLARE_POSTFIX_INCREMENT(Owner);
    32 
    32 
    33 enum {
    33 enum {
    34 	MAX_LENGTH_PRESIDENT_NAME_BYTES  =  31, ///< The maximum length of a president name in bytes including '\0'
    34 	MAX_LENGTH_PRESIDENT_NAME_BYTES  =  31, ///< The maximum length of a president name in bytes including '\0'
    39 
    39 
    40 /** Define basic enum properties */
    40 /** Define basic enum properties */
    41 template <> struct EnumPropsT<Owner> : MakeEnumPropsT<Owner, byte, OWNER_BEGIN, OWNER_END, INVALID_OWNER> {};
    41 template <> struct EnumPropsT<Owner> : MakeEnumPropsT<Owner, byte, OWNER_BEGIN, OWNER_END, INVALID_OWNER> {};
    42 typedef TinyEnumT<Owner> OwnerByte;
    42 typedef TinyEnumT<Owner> OwnerByte;
    43 
    43 
    44 typedef Owner PlayerID;
    44 typedef Owner CompanyID;
    45 typedef OwnerByte PlayerByte;
    45 typedef OwnerByte CompanyByte;
    46 
    46 
    47 typedef uint8 PlayerMask;
    47 typedef uint8 CompanyMask;
    48 
    48 
    49 struct Player;
    49 struct Company;
    50 typedef uint32 PlayerFace; ///< player face bits, info see in player_face.h
    50 typedef uint32 CompanyManagerFace; ///< Company manager face bits, info see in company_manager_face.h
    51 
    51 
    52 #endif /* PLAYER_TYPE_H */
    52 #endif /* COMPANY_TYPE_H */