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 8 /** @file company_type.h Types related to companies. */ 9 10 #ifndef COMPANY_TYPE_H 11 #define COMPANY_TYPE_H 12 13 #include "core/enum_type.hpp" 14 15 /** 16 * Enum for all companies/owners. 17 */ 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 31 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 36 }; 37 DECLARE_POSTFIX_INCREMENT(Owner) 38 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' 41 42 static const uint MAX_HISTORY_QUARTERS = 24; ///< The maximum number of quarters kept as performance's history 43 44 /** Define basic enum properties */ 45 template <> struct EnumPropsT<Owner> : MakeEnumPropsT<Owner, byte, OWNER_BEGIN, OWNER_END, INVALID_OWNER> {}; 46 47 typedef Owner CompanyID; 48 49 typedef uint16 CompanyMask; 50 51 struct Company; 52 typedef uint32 CompanyManagerFace; ///< Company manager face bits, info see in company_manager_face.h 53 54 /** The reason why the company was removed. */ 55 enum CompanyRemoveReason { 56 CRR_MANUAL, ///< The company is manually removed. 57 CRR_AUTOCLEAN, ///< The company is removed due to autoclean. 58 CRR_BANKRUPT, ///< The company went belly-up. 59 60 CRR_END, ///< Sentinel for end. 61 }; 62 63 /** The action to do with CMD_COMPANY_CTRL. */ 64 enum CompanyCtrlAction { 65 CCA_NEW, ///< Create a new company. 66 CCA_NEW_AI, ///< Create a new AI company. 67 CCA_DELETE, ///< Delete a company. 68 69 CCA_END, ///< Sentinel for end. 70 }; 71 72 #endif /* COMPANY_TYPE_H */ 73