OpenTTD Source 20241224-master-gf74b0cf984
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
18enum Owner : uint8_t {
19 /* All companies below MAX_COMPANIES are playable
20 * companies, above, they are special, computer controlled 'companies' */
21 OWNER_BEGIN = 0x00,
24 OWNER_TOWN = 0x0F,
25 OWNER_NONE = 0x10,
26 OWNER_WATER = 0x11,
27 OWNER_DEITY = 0x12,
31
32 /* 'Fake' companies used for networks */
36};
39
40static const uint MAX_LENGTH_PRESIDENT_NAME_CHARS = 32;
41static const uint MAX_LENGTH_COMPANY_NAME_CHARS = 32;
42
43static const uint MAX_HISTORY_QUARTERS = 24;
44
45static const uint MIN_COMPETITORS_INTERVAL = 0;
46static const uint MAX_COMPETITORS_INTERVAL = 500;
47
48typedef Owner CompanyID;
49
50typedef uint16_t CompanyMask;
51
52struct Company;
53typedef uint32_t CompanyManagerFace;
54
65
74
82
83#endif /* COMPANY_TYPE_H */
static const uint MAX_LENGTH_PRESIDENT_NAME_CHARS
The maximum length of a president name in characters including '\0'.
static const uint MAX_LENGTH_COMPANY_NAME_CHARS
The maximum length of a company name in characters including '\0'.
CompanyCtrlAction
The action to do with CMD_COMPANY_CTRL.
@ CCA_NEW_AI
Create a new AI company.
@ CCA_DELETE
Delete a company.
@ CCA_NEW
Create a new company.
@ CCA_END
Sentinel for end.
CompanyAllowListCtrlAction
The action to do with CMD_COMPANY_ALLOW_LIST_CTRL.
@ CALCA_END
Sentinel for end.
@ CALCA_REMOVE
Remove a public key.
@ CALCA_ADD
Create a public key.
static const uint MAX_HISTORY_QUARTERS
The maximum number of quarters kept as performance's history.
uint32_t CompanyManagerFace
Company manager face bits, info see in company_manager_face.h.
static const uint MIN_COMPETITORS_INTERVAL
The minimum interval (in minutes) between competitors.
Owner
Enum for all companies/owners.
@ INVALID_COMPANY
An invalid company.
@ INVALID_OWNER
An invalid owner.
@ OWNER_END
Last + 1 owner.
@ COMPANY_SPECTATOR
The client is spectating.
@ COMPANY_INACTIVE_CLIENT
The client is joining.
@ COMPANY_FIRST
First company, same as owner.
@ OWNER_DEITY
The object is owned by a superuser / goal script.
@ OWNER_BEGIN
First owner.
@ OWNER_NONE
The tile has no ownership.
@ OWNER_WATER
The tile/execution is done by "water".
@ COMPANY_NEW_COMPANY
The client wants a new company.
@ OWNER_TOWN
A town owns the tile, or a town is expanding.
@ MAX_COMPANIES
Maximum number of companies.
CompanyRemoveReason
The reason why the company was removed.
@ CRR_BANKRUPT
The company went belly-up.
@ CRR_END
Sentinel for end.
@ CRR_AUTOCLEAN
The company is removed due to autoclean.
@ CRR_NONE
Dummy reason for actions that don't need one.
@ CRR_MANUAL
The company is manually removed.
static const uint MAX_COMPETITORS_INTERVAL
The maximum interval (in minutes) between competitors.
Type (helpers) for enums.
#define DECLARE_POSTFIX_INCREMENT(enum_type)
Some enums need to have allowed incrementing (i.e.
Definition enum_type.hpp:18
#define DECLARE_ENUM_AS_ADDABLE(EnumType)
Operator that allows this enumeration to be added to any other enumeration.
Definition enum_type.hpp:45