OpenTTD

company_type.h
Go to the documentation of this file.
1 /* $Id: company_type.h 23602 2011-12-19 20:50:36Z truebrain $ */
2
3 /*
4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 */
9
12 #ifndef COMPANY_TYPE_H
13 #define COMPANY_TYPE_H
14
15 #include "core/enum_type.hpp"
16
20 enum Owner {
21 /* All companies below MAX_COMPANIES are playable
22 * companies, above, they are special, computer controlled 'companies' */
23 OWNER_BEGIN = 0x00,
24 COMPANY_FIRST = 0x00,
25 MAX_COMPANIES = 0x0F,
26 OWNER_TOWN = 0x0F,
27 OWNER_NONE = 0x10,
28 OWNER_WATER = 0x11,
29 OWNER_DEITY = 0x12,
30 OWNER_END,
31 INVALID_OWNER = 0xFF,
32 INVALID_COMPANY = 0xFF,
33
34 /* 'Fake' companies used for networks */
35 COMPANY_INACTIVE_CLIENT = 253,
36 COMPANY_NEW_COMPANY = 254,
37 COMPANY_SPECTATOR = 255,
38 };
39 DECLARE_POSTFIX_INCREMENT(Owner)
40
41 static const uint MAX_LENGTH_PRESIDENT_NAME_CHARS = 32;
42 static const uint MAX_LENGTH_COMPANY_NAME_CHARS = 32;
43
44 static const uint MAX_HISTORY_QUARTERS = 24;
45
47 template <> struct EnumPropsT<Owner> : MakeEnumPropsT<Owner, byte, OWNER_BEGIN, OWNER_END, INVALID_OWNER> {};
48 typedef TinyEnumT<Owner> OwnerByte;
49
50 typedef Owner CompanyID;
51 typedef OwnerByte CompanyByte;
52
53 typedef uint16 CompanyMask;
54
55 struct Company;
56 typedef uint32 CompanyManagerFace;
57
59 enum CompanyRemoveReason {
60 CRR_MANUAL,
61 CRR_AUTOCLEAN,
62 CRR_BANKRUPT,
63
64 CRR_END,
65 };
66
67 #endif /* COMPANY_TYPE_H */
OWNER_END
Last + 1 owner.
Definition: company_type.h:30
MakeEnumPropsT
Helper template class that makes basic properties of given enumeration type visible from outsize...
Definition: enum_type.hpp:66
COMPANY_INACTIVE_CLIENT
The client is joining.
Definition: company_type.h:35
CRR_MANUAL
The company is manually removed.
Definition: company_type.h:60
MAX_LENGTH_PRESIDENT_NAME_CHARS
static const uint MAX_LENGTH_PRESIDENT_NAME_CHARS
The maximum length of a president name in characters including &#39;\0&#39;.
Definition: company_type.h:41
COMPANY_SPECTATOR
The client is spectating.
Definition: company_type.h:37
COMPANY_NEW_COMPANY
The client wants a new company.
Definition: company_type.h:36
enum_type.hpp
Type (helpers) for enums.
OWNER_DEITY
The object is owned by a superuser / goal script.
Definition: company_type.h:29
CRR_AUTOCLEAN
The company is removed due to autoclean.
Definition: company_type.h:61
OWNER_BEGIN
First owner.
Definition: company_type.h:23
CompanyManagerFace
uint32 CompanyManagerFace
Company manager face bits, info see in company_manager_face.h.
Definition: company_type.h:55
MAX_LENGTH_COMPANY_NAME_CHARS
static const uint MAX_LENGTH_COMPANY_NAME_CHARS
The maximum length of a company name in characters including &#39;\0&#39;.
Definition: company_type.h:42
EnumPropsT
Informative template class exposing basic enumeration properties used by several other templates belo...
Definition: enum_type.hpp:52
COMPANY_FIRST
First company, same as owner.
Definition: company_type.h:24
OWNER_NONE
The tile has no ownership.
Definition: company_type.h:27
CRR_END
Sentinel for end.
Definition: company_type.h:64
TinyEnumT< Owner >
MAX_COMPANIES
Maximum number of companies.
Definition: company_type.h:25
Company
Definition: company_base.h:110
MAX_HISTORY_QUARTERS
static const uint MAX_HISTORY_QUARTERS
The maximum number of quarters kept as performance&#39;s history.
Definition: company_type.h:44
OWNER_TOWN
A town owns the tile, or a town is expanding.
Definition: company_type.h:26
CRR_BANKRUPT
The company went belly-up.
Definition: company_type.h:62
CompanyRemoveReason
CompanyRemoveReason
The reason why the company was removed.
Definition: company_type.h:59
Owner
Owner
Enum for all companies/owners.
Definition: company_type.h:20
DECLARE_POSTFIX_INCREMENT
#define DECLARE_POSTFIX_INCREMENT(type)
Some enums need to have allowed incrementing (i.e.
Definition: enum_type.hpp:16
INVALID_COMPANY
An invalid company.
Definition: company_type.h:32
OWNER_WATER
The tile/execution is done by "water".
Definition: company_type.h:28
INVALID_OWNER
An invalid owner.
Definition: company_type.h:31