src/company_type.h
author rubidium
Thu, 18 Dec 2008 12:23:08 +0000
changeset 10436 8d3a9fbe8f19
parent 10208 72c00af5c95d
permissions -rw-r--r--
(svn r14689) -Change: make configure die on commonly made user mistakes, like not having SDL development files or zlib headers installed; you can still compile a dedicated server or a binary without zlib, but you have to explicitly force it.
8254
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff changeset
     1
/* $Id$ */
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff changeset
     2
10207
c291a21b304e (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents: 9913
diff changeset
     3
/** @file company_type.h Types related to companies. */
8254
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff changeset
     4
10207
c291a21b304e (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents: 9913
diff changeset
     5
#ifndef COMPANY_TYPE_H
c291a21b304e (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents: 9913
diff changeset
     6
#define COMPANY_TYPE_H
8254
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff changeset
     7
8263
2b3e64c5e680 (svn r11827) -Codechange: do not include enum_type.hpp unnecessary.
rubidium
parents: 8254
diff changeset
     8
#include "core/enum_type.hpp"
2b3e64c5e680 (svn r11827) -Codechange: do not include enum_type.hpp unnecessary.
rubidium
parents: 8254
diff changeset
     9
8254
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff changeset
    10
/**
10207
c291a21b304e (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents: 9913
diff changeset
    11
 * Enum for all companies/owners.
8254
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff changeset
    12
 */
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff changeset
    13
enum Owner {
10207
c291a21b304e (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents: 9913
diff changeset
    14
	/* All companies below MAX_COMPANIES are playable
c291a21b304e (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents: 9913
diff changeset
    15
	 * companies, above, they are special, computer controlled 'companies' */
c291a21b304e (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents: 9913
diff changeset
    16
	OWNER_BEGIN     = 0x00, ///< First owner
c291a21b304e (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents: 9913
diff changeset
    17
	COMPANY_FIRST   = 0x00, ///< First company, same as owner
c291a21b304e (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents: 9913
diff changeset
    18
	MAX_COMPANIES   = 0x08, ///< Maximum number of companies
8254
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff changeset
    19
	OWNER_TOWN      = 0x0F, ///< A town owns the tile, or a town is expanding
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff changeset
    20
	OWNER_NONE      = 0x10, ///< The tile has no ownership
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff changeset
    21
	OWNER_WATER     = 0x11, ///< The tile/execution is done by "water"
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff changeset
    22
	OWNER_END,              ///< Last + 1 owner
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff changeset
    23
	INVALID_OWNER   = 0xFF, ///< An invalid owner
10207
c291a21b304e (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents: 9913
diff changeset
    24
	INVALID_COMPANY = 0xFF, ///< An invalid company
8254
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff changeset
    25
10207
c291a21b304e (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents: 9913
diff changeset
    26
	/* 'Fake' companies used for networks */
c291a21b304e (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents: 9913
diff changeset
    27
	COMPANY_INACTIVE_CLIENT = 253, ///< The client is joining
c291a21b304e (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents: 9913
diff changeset
    28
	COMPANY_NEW_COMPANY     = 254, ///< The client wants a new company
c291a21b304e (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents: 9913
diff changeset
    29
	COMPANY_SPECTATOR       = 255, ///< The client is spectating
8254
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff changeset
    30
};
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff changeset
    31
DECLARE_POSTFIX_INCREMENT(Owner);
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff changeset
    32
9645
aee985cc98b5 (svn r13712) -Fix: enforce the length restrictions of company and president name in the commands too.
rubidium
parents: 8263
diff changeset
    33
enum {
9913
d9ce89020cc0 (svn r14063) -Codechange: replace some "magic" constants with enumified constants.
rubidium
parents: 9709
diff changeset
    34
	MAX_LENGTH_PRESIDENT_NAME_BYTES  =  31, ///< The maximum length of a president name in bytes including '\0'
d9ce89020cc0 (svn r14063) -Codechange: replace some "magic" constants with enumified constants.
rubidium
parents: 9709
diff changeset
    35
	MAX_LENGTH_PRESIDENT_NAME_PIXELS =  94, ///< The maximum length of a president name in pixels
d9ce89020cc0 (svn r14063) -Codechange: replace some "magic" constants with enumified constants.
rubidium
parents: 9709
diff changeset
    36
	MAX_LENGTH_COMPANY_NAME_BYTES    =  31, ///< The maximum length of a company name in bytes including '\0'
d9ce89020cc0 (svn r14063) -Codechange: replace some "magic" constants with enumified constants.
rubidium
parents: 9709
diff changeset
    37
	MAX_LENGTH_COMPANY_NAME_PIXELS   = 150, ///< The maximum length of a company name in pixels
9645
aee985cc98b5 (svn r13712) -Fix: enforce the length restrictions of company and president name in the commands too.
rubidium
parents: 8263
diff changeset
    38
};
aee985cc98b5 (svn r13712) -Fix: enforce the length restrictions of company and president name in the commands too.
rubidium
parents: 8263
diff changeset
    39
8254
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff changeset
    40
/** Define basic enum properties */
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff changeset
    41
template <> struct EnumPropsT<Owner> : MakeEnumPropsT<Owner, byte, OWNER_BEGIN, OWNER_END, INVALID_OWNER> {};
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff changeset
    42
typedef TinyEnumT<Owner> OwnerByte;
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff changeset
    43
10207
c291a21b304e (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents: 9913
diff changeset
    44
typedef Owner CompanyID;
c291a21b304e (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents: 9913
diff changeset
    45
typedef OwnerByte CompanyByte;
8254
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff changeset
    46
10207
c291a21b304e (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents: 9913
diff changeset
    47
typedef uint8 CompanyMask;
9709
fc8c47cbfcf2 (svn r13821) -Codechange: replace some uint8/bytes with more specificly named typedefs and replace a few magic numbers.
rubidium
parents: 9645
diff changeset
    48
10207
c291a21b304e (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents: 9913
diff changeset
    49
struct Company;
c291a21b304e (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents: 9913
diff changeset
    50
typedef uint32 CompanyManagerFace; ///< Company manager face bits, info see in company_manager_face.h
8254
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff changeset
    51
10207
c291a21b304e (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents: 9913
diff changeset
    52
#endif /* COMPANY_TYPE_H */