OpenTTD Source  20240915-master-g3784a3d3d6
company_type.h
Go to the documentation of this file.
1 /*
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/>.
6  */
7 
10 #ifndef COMPANY_TYPE_H
11 #define COMPANY_TYPE_H
12 
13 #include "core/enum_type.hpp"
14 
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,
22  COMPANY_FIRST = 0x00,
23  MAX_COMPANIES = 0x0F,
24  OWNER_TOWN = 0x0F,
25  OWNER_NONE = 0x10,
26  OWNER_WATER = 0x11,
27  OWNER_DEITY = 0x12,
29  INVALID_OWNER = 0xFF,
30  INVALID_COMPANY = 0xFF,
31 
32  /* 'Fake' companies used for networks */
36 };
39 
40 static const uint MAX_LENGTH_PRESIDENT_NAME_CHARS = 32;
41 static const uint MAX_LENGTH_COMPANY_NAME_CHARS = 32;
42 
43 static const uint MAX_HISTORY_QUARTERS = 24;
44 
45 static const uint MIN_COMPETITORS_INTERVAL = 0;
46 static const uint MAX_COMPETITORS_INTERVAL = 500;
47 
48 typedef Owner CompanyID;
49 
50 typedef uint16_t CompanyMask;
51 
52 struct Company;
53 typedef uint32_t CompanyManagerFace;
54 
56 enum CompanyRemoveReason : uint8_t {
60 
62 
64 };
65 
67 enum CompanyCtrlAction : uint8_t {
71 
73 };
74 
79 
81 };
82 
83 #endif /* COMPANY_TYPE_H */
OWNER_DEITY
@ OWNER_DEITY
The object is owned by a superuser / goal script.
Definition: company_type.h:27
INVALID_COMPANY
@ INVALID_COMPANY
An invalid company.
Definition: company_type.h:30
INVALID_OWNER
@ INVALID_OWNER
An invalid owner.
Definition: company_type.h:29
COMPANY_NEW_COMPANY
@ COMPANY_NEW_COMPANY
The client wants a new company.
Definition: company_type.h:34
Owner
Owner
Enum for all companies/owners.
Definition: company_type.h:18
COMPANY_INACTIVE_CLIENT
@ COMPANY_INACTIVE_CLIENT
The client is joining.
Definition: company_type.h:33
MAX_LENGTH_COMPANY_NAME_CHARS
static const uint MAX_LENGTH_COMPANY_NAME_CHARS
The maximum length of a company name in characters including '\0'.
Definition: company_type.h:41
DECLARE_POSTFIX_INCREMENT
#define DECLARE_POSTFIX_INCREMENT(enum_type)
Some enums need to have allowed incrementing (i.e.
Definition: enum_type.hpp:14
COMPANY_FIRST
@ COMPANY_FIRST
First company, same as owner.
Definition: company_type.h:22
CALCA_END
@ CALCA_END
Sentinel for end.
Definition: company_type.h:80
MAX_LENGTH_PRESIDENT_NAME_CHARS
static const uint MAX_LENGTH_PRESIDENT_NAME_CHARS
The maximum length of a president name in characters including '\0'.
Definition: company_type.h:40
OWNER_NONE
@ OWNER_NONE
The tile has no ownership.
Definition: company_type.h:25
CALCA_REMOVE
@ CALCA_REMOVE
Remove a public key.
Definition: company_type.h:78
CCA_NEW_AI
@ CCA_NEW_AI
Create a new AI company.
Definition: company_type.h:69
CompanyAllowListCtrlAction
CompanyAllowListCtrlAction
The action to do with CMD_COMPANY_ALLOW_LIST_CTRL.
Definition: company_type.h:76
CompanyManagerFace
uint32_t CompanyManagerFace
Company manager face bits, info see in company_manager_face.h.
Definition: company_type.h:52
CRR_BANKRUPT
@ CRR_BANKRUPT
The company went belly-up.
Definition: company_type.h:59
MAX_HISTORY_QUARTERS
static const uint MAX_HISTORY_QUARTERS
The maximum number of quarters kept as performance's history.
Definition: company_type.h:43
OWNER_END
@ OWNER_END
Last + 1 owner.
Definition: company_type.h:28
OWNER_TOWN
@ OWNER_TOWN
A town owns the tile, or a town is expanding.
Definition: company_type.h:24
DECLARE_ENUM_AS_ADDABLE
#define DECLARE_ENUM_AS_ADDABLE(EnumType)
Operator that allows this enumeration to be added to any other enumeration.
Definition: enum_type.hpp:41
CCA_NEW
@ CCA_NEW
Create a new company.
Definition: company_type.h:68
MIN_COMPETITORS_INTERVAL
static const uint MIN_COMPETITORS_INTERVAL
The minimum interval (in minutes) between competitors.
Definition: company_type.h:45
CRR_NONE
@ CRR_NONE
Dummy reason for actions that don't need one.
Definition: company_type.h:63
OWNER_WATER
@ OWNER_WATER
The tile/execution is done by "water".
Definition: company_type.h:26
CompanyCtrlAction
CompanyCtrlAction
The action to do with CMD_COMPANY_CTRL.
Definition: company_type.h:67
CCA_END
@ CCA_END
Sentinel for end.
Definition: company_type.h:72
enum_type.hpp
CRR_AUTOCLEAN
@ CRR_AUTOCLEAN
The company is removed due to autoclean.
Definition: company_type.h:58
CALCA_ADD
@ CALCA_ADD
Create a public key.
Definition: company_type.h:77
COMPANY_SPECTATOR
@ COMPANY_SPECTATOR
The client is spectating.
Definition: company_type.h:35
OWNER_BEGIN
@ OWNER_BEGIN
First owner.
Definition: company_type.h:21
CRR_END
@ CRR_END
Sentinel for end.
Definition: company_type.h:61
MAX_COMPANIES
@ MAX_COMPANIES
Maximum number of companies.
Definition: company_type.h:23
MAX_COMPETITORS_INTERVAL
static const uint MAX_COMPETITORS_INTERVAL
The maximum interval (in minutes) between competitors.
Definition: company_type.h:46
CCA_DELETE
@ CCA_DELETE
Delete a company.
Definition: company_type.h:70
Company
Definition: company_base.h:133
CRR_MANUAL
@ CRR_MANUAL
The company is manually removed.
Definition: company_type.h:57
CompanyRemoveReason
CompanyRemoveReason
The reason why the company was removed.
Definition: company_type.h:56