2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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 /** @file company_type.h Types related to companies. */
10 #ifndef COMPANY_TYPE_H
11 #define COMPANY_TYPE_H
13 #include "core/enum_type.hpp"
16 * Enum for all companies/owners.
18 enum Owner
: uint8_t {
19 /* All companies below MAX_COMPANIES are playable
20 * companies, above, they are special, computer controlled 'companies' */
21 OWNER_BEGIN
= 0x00, ///< First owner
22 COMPANY_FIRST
= 0x00, ///< First company, same as owner
23 MAX_COMPANIES
= 0x0F, ///< Maximum number of companies
24 OWNER_TOWN
= 0x0F, ///< A town owns the tile, or a town is expanding
25 OWNER_NONE
= 0x10, ///< The tile has no ownership
26 OWNER_WATER
= 0x11, ///< The tile/execution is done by "water"
27 OWNER_DEITY
= 0x12, ///< The object is owned by a superuser / goal script
28 OWNER_END
, ///< Last + 1 owner
29 INVALID_OWNER
= 0xFF, ///< An invalid owner
30 INVALID_COMPANY
= 0xFF, ///< An invalid company
32 /* 'Fake' companies used for networks */
33 COMPANY_INACTIVE_CLIENT
= 253, ///< The client is joining
34 COMPANY_NEW_COMPANY
= 254, ///< The client wants a new company
35 COMPANY_SPECTATOR
= 255, ///< The client is spectating
37 DECLARE_POSTFIX_INCREMENT(Owner
)
38 DECLARE_ENUM_AS_ADDABLE(Owner
)
40 static const uint MAX_LENGTH_PRESIDENT_NAME_CHARS
= 32; ///< The maximum length of a president name in characters including '\0'
41 static const uint MAX_LENGTH_COMPANY_NAME_CHARS
= 32; ///< The maximum length of a company name in characters including '\0'
43 static const uint MAX_HISTORY_QUARTERS
= 24; ///< The maximum number of quarters kept as performance's history
45 static const uint MIN_COMPETITORS_INTERVAL
= 0; ///< The minimum interval (in minutes) between competitors.
46 static const uint MAX_COMPETITORS_INTERVAL
= 500; ///< The maximum interval (in minutes) between competitors.
48 typedef Owner CompanyID
;
50 typedef uint16_t CompanyMask
;
53 typedef uint32_t CompanyManagerFace
; ///< Company manager face bits, info see in company_manager_face.h
55 /** The reason why the company was removed. */
56 enum CompanyRemoveReason
: uint8_t {
57 CRR_MANUAL
, ///< The company is manually removed.
58 CRR_AUTOCLEAN
, ///< The company is removed due to autoclean.
59 CRR_BANKRUPT
, ///< The company went belly-up.
61 CRR_END
, ///< Sentinel for end.
63 CRR_NONE
= CRR_MANUAL
, ///< Dummy reason for actions that don't need one.
66 /** The action to do with CMD_COMPANY_CTRL. */
67 enum CompanyCtrlAction
: uint8_t {
68 CCA_NEW
, ///< Create a new company.
69 CCA_NEW_AI
, ///< Create a new AI company.
70 CCA_DELETE
, ///< Delete a company.
72 CCA_END
, ///< Sentinel for end.
75 /** The action to do with CMD_COMPANY_ALLOW_LIST_CTRL. */
76 enum CompanyAllowListCtrlAction
: uint8_t {
77 CALCA_ADD
, ///< Create a public key.
78 CALCA_REMOVE
, ///< Remove a public key.
80 CALCA_END
, ///< Sentinel for end.
83 #endif /* COMPANY_TYPE_H */