(svn r27707) -Fix: Make the result of NewGRF's CARGO_NAME string code reliably print...
[openttd.git] / src / company_type.h
blob44a074e1043c96daf740d53dcdfd4e909ca3a811
1 /* $Id$ */
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 */
10 /** @file company_type.h Types related to companies. */
12 #ifndef COMPANY_TYPE_H
13 #define COMPANY_TYPE_H
15 #include "core/enum_type.hpp"
17 /**
18 * Enum for all companies/owners.
20 enum Owner {
21 /* All companies below MAX_COMPANIES are playable
22 * companies, above, they are special, computer controlled 'companies' */
23 OWNER_BEGIN = 0x00, ///< First owner
24 COMPANY_FIRST = 0x00, ///< First company, same as owner
25 MAX_COMPANIES = 0x0F, ///< Maximum number of companies
26 OWNER_TOWN = 0x0F, ///< A town owns the tile, or a town is expanding
27 OWNER_NONE = 0x10, ///< The tile has no ownership
28 OWNER_WATER = 0x11, ///< The tile/execution is done by "water"
29 OWNER_DEITY = 0x12, ///< The object is owned by a superuser / goal script
30 OWNER_END, ///< Last + 1 owner
31 INVALID_OWNER = 0xFF, ///< An invalid owner
32 INVALID_COMPANY = 0xFF, ///< An invalid company
34 /* 'Fake' companies used for networks */
35 COMPANY_INACTIVE_CLIENT = 253, ///< The client is joining
36 COMPANY_NEW_COMPANY = 254, ///< The client wants a new company
37 COMPANY_SPECTATOR = 255, ///< The client is spectating
39 DECLARE_POSTFIX_INCREMENT(Owner)
41 static const uint MAX_LENGTH_PRESIDENT_NAME_CHARS = 32; ///< The maximum length of a president name in characters including '\0'
42 static const uint MAX_LENGTH_COMPANY_NAME_CHARS = 32; ///< The maximum length of a company name in characters including '\0'
44 static const uint MAX_HISTORY_QUARTERS = 24; ///< The maximum number of quarters kept as performance's history
46 /** Define basic enum properties */
47 template <> struct EnumPropsT<Owner> : MakeEnumPropsT<Owner, byte, OWNER_BEGIN, OWNER_END, INVALID_OWNER> {};
48 typedef TinyEnumT<Owner> OwnerByte;
50 typedef Owner CompanyID;
51 typedef OwnerByte CompanyByte;
53 typedef uint16 CompanyMask;
55 struct Company;
56 typedef uint32 CompanyManagerFace; ///< Company manager face bits, info see in company_manager_face.h
58 /** The reason why the company was removed. */
59 enum CompanyRemoveReason {
60 CRR_MANUAL, ///< The company is manually removed.
61 CRR_AUTOCLEAN, ///< The company is removed due to autoclean.
62 CRR_BANKRUPT, ///< The company went belly-up.
64 CRR_END, ///< Sentinel for end.
67 #endif /* COMPANY_TYPE_H */