Feature: Purchase land multiple tiles at a time
[openttd-github.git] / src / company_type.h
blob3bbcf731e6cc7cd3eff10de39b57a93eaa82bd2b
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 */
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"
15 /**
16 * Enum for all companies/owners.
18 enum Owner : byte {
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)
39 static const uint MAX_LENGTH_PRESIDENT_NAME_CHARS = 32; ///< The maximum length of a president name in characters including '\0'
40 static const uint MAX_LENGTH_COMPANY_NAME_CHARS = 32; ///< The maximum length of a company name in characters including '\0'
42 static const uint MAX_HISTORY_QUARTERS = 24; ///< The maximum number of quarters kept as performance's history
43 static const uint MAX_COMPANY_SHARE_OWNERS = 4; ///< The maximum number of shares of a company that can be owned by another company.
45 /** Define basic enum properties */
46 template <> struct EnumPropsT<Owner> : MakeEnumPropsT<Owner, byte, OWNER_BEGIN, OWNER_END, INVALID_OWNER> {};
48 typedef Owner CompanyID;
50 typedef uint16 CompanyMask;
52 struct Company;
53 typedef uint32 CompanyManagerFace; ///< Company manager face bits, info see in company_manager_face.h
55 /** The reason why the company was removed. */
56 enum CompanyRemoveReason : uint8 {
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 {
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 #endif /* COMPANY_TYPE_H */