src/player_type.h
author Tero Marttila <terom@fixme.fi>
Fri, 18 Jul 2008 22:41:08 +0300
changeset 11177 6d9a43c48924
parent 11153 cee0888d135a
permissions -rw-r--r--
set the GRFConfig's next ptr to NULL
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2159
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2159
diff changeset
     2
8750
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
     3
/** @file player_type.h Types related to players. */
145
6e5468217504 (svn r146) -Fix [AI]: Tunnel/bridge bug
truelight
parents: 84
diff changeset
     4
8750
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
     5
#ifndef PLAYER_TYPE_H
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
     6
#define PLAYER_TYPE_H
983
1be852dcdd4c (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents: 826
diff changeset
     7
8759
eae56497cf83 (svn r11827) -Codechange: do not include enum_type.hpp unnecessary.
rubidium
parents: 8750
diff changeset
     8
#include "core/enum_type.hpp"
eae56497cf83 (svn r11827) -Codechange: do not include enum_type.hpp unnecessary.
rubidium
parents: 8750
diff changeset
     9
4603
3ccd4ee0a2e2 (svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents: 4574
diff changeset
    10
/**
8750
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    11
 * Enum for all players/owners.
4603
3ccd4ee0a2e2 (svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents: 4574
diff changeset
    12
 */
8750
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    13
enum Owner {
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    14
	/* Player identifiers All players below MAX_PLAYERS are playable
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    15
	 * players, above, they are special, computer controlled players */
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    16
	OWNER_BEGIN     = 0x00, ///< First Owner
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    17
	PLAYER_FIRST    = 0x00, ///< First Player, same as owner
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    18
	MAX_PLAYERS     = 0x08, ///< Maximum numbe rof players
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    19
	OWNER_TOWN      = 0x0F, ///< A town owns the tile, or a town is expanding
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    20
	OWNER_NONE      = 0x10, ///< The tile has no ownership
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    21
	OWNER_WATER     = 0x11, ///< The tile/execution is done by "water"
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    22
	OWNER_END,              ///< Last + 1 owner
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    23
	INVALID_OWNER   = 0xFF, ///< An invalid owner
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    24
	INVALID_PLAYER  = 0xFF, ///< And a valid owner
4603
3ccd4ee0a2e2 (svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents: 4574
diff changeset
    25
8750
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    26
	/* 'Fake' Players used for networks */
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    27
	PLAYER_INACTIVE_CLIENT = 253, ///< The client is joining
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    28
	PLAYER_NEW_COMPANY     = 254, ///< The client wants a new company
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    29
	PLAYER_SPECTATOR       = 255, ///< The client is spectating
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    30
};
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    31
DECLARE_POSTFIX_INCREMENT(Owner);
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    32
11153
cee0888d135a (svn r13712) -Fix: enforce the length restrictions of company and president name in the commands too.
rubidium
parents: 8759
diff changeset
    33
enum {
cee0888d135a (svn r13712) -Fix: enforce the length restrictions of company and president name in the commands too.
rubidium
parents: 8759
diff changeset
    34
	MAX_LENGTH_PRESIDENT_NAME = 31, ///< The maximum length for a president's name
cee0888d135a (svn r13712) -Fix: enforce the length restrictions of company and president name in the commands too.
rubidium
parents: 8759
diff changeset
    35
	MAX_LENGTH_COMPANY_NAME   = 31, ///< The maximum length for a company's name
cee0888d135a (svn r13712) -Fix: enforce the length restrictions of company and president name in the commands too.
rubidium
parents: 8759
diff changeset
    36
};
cee0888d135a (svn r13712) -Fix: enforce the length restrictions of company and president name in the commands too.
rubidium
parents: 8759
diff changeset
    37
8750
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    38
/** Define basic enum properties */
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    39
template <> struct EnumPropsT<Owner> : MakeEnumPropsT<Owner, byte, OWNER_BEGIN, OWNER_END, INVALID_OWNER> {};
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    40
typedef TinyEnumT<Owner> OwnerByte;
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    41
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    42
typedef Owner PlayerID;
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    43
typedef OwnerByte PlayerByte;
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    44
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    45
struct Player;
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    46
typedef uint32 PlayerFace; ///< player face bits, info see in player_face.h
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    47
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8733
diff changeset
    48
#endif /* PLAYER_TYPE_H */