2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2008-09-30 20:39:50 +00:00
|
|
|
/** @file company_type.h Types related to companies. */
|
2008-01-12 14:10:35 +00:00
|
|
|
|
2008-09-30 20:39:50 +00:00
|
|
|
#ifndef COMPANY_TYPE_H
|
|
|
|
#define COMPANY_TYPE_H
|
2008-01-12 14:10:35 +00:00
|
|
|
|
2008-01-13 00:28:01 +00:00
|
|
|
#include "core/enum_type.hpp"
|
|
|
|
|
2008-01-12 14:10:35 +00:00
|
|
|
/**
|
2008-09-30 20:39:50 +00:00
|
|
|
* Enum for all companies/owners.
|
2008-01-12 14:10:35 +00:00
|
|
|
*/
|
2019-04-22 08:10:04 +00:00
|
|
|
enum Owner : byte {
|
2008-09-30 20:39:50 +00:00
|
|
|
/* All companies below MAX_COMPANIES are playable
|
|
|
|
* companies, above, they are special, computer controlled 'companies' */
|
|
|
|
OWNER_BEGIN = 0x00, ///< First owner
|
|
|
|
COMPANY_FIRST = 0x00, ///< First company, same as owner
|
2008-12-24 09:53:15 +00:00
|
|
|
MAX_COMPANIES = 0x0F, ///< Maximum number of companies
|
2008-01-12 14:10:35 +00:00
|
|
|
OWNER_TOWN = 0x0F, ///< A town owns the tile, or a town is expanding
|
|
|
|
OWNER_NONE = 0x10, ///< The tile has no ownership
|
|
|
|
OWNER_WATER = 0x11, ///< The tile/execution is done by "water"
|
2011-12-19 20:50:36 +00:00
|
|
|
OWNER_DEITY = 0x12, ///< The object is owned by a superuser / goal script
|
2008-01-12 14:10:35 +00:00
|
|
|
OWNER_END, ///< Last + 1 owner
|
|
|
|
INVALID_OWNER = 0xFF, ///< An invalid owner
|
2008-09-30 20:39:50 +00:00
|
|
|
INVALID_COMPANY = 0xFF, ///< An invalid company
|
2008-01-12 14:10:35 +00:00
|
|
|
|
2008-09-30 20:39:50 +00:00
|
|
|
/* 'Fake' companies used for networks */
|
|
|
|
COMPANY_INACTIVE_CLIENT = 253, ///< The client is joining
|
|
|
|
COMPANY_NEW_COMPANY = 254, ///< The client wants a new company
|
|
|
|
COMPANY_SPECTATOR = 255, ///< The client is spectating
|
2008-01-12 14:10:35 +00:00
|
|
|
};
|
2010-03-23 22:25:43 +00:00
|
|
|
DECLARE_POSTFIX_INCREMENT(Owner)
|
2008-01-12 14:10:35 +00:00
|
|
|
|
2011-04-17 18:42:17 +00:00
|
|
|
static const uint MAX_LENGTH_PRESIDENT_NAME_CHARS = 32; ///< The maximum length of a president name in characters including '\0'
|
|
|
|
static const uint MAX_LENGTH_COMPANY_NAME_CHARS = 32; ///< The maximum length of a company name in characters including '\0'
|
2008-07-17 11:19:20 +00:00
|
|
|
|
2011-05-19 21:03:23 +00:00
|
|
|
static const uint MAX_HISTORY_QUARTERS = 24; ///< The maximum number of quarters kept as performance's history
|
2009-08-03 20:02:25 +00:00
|
|
|
|
2023-04-16 18:14:22 +00:00
|
|
|
static const uint MIN_COMPETITORS_INTERVAL = 0; ///< The minimum interval (in minutes) between competitors.
|
|
|
|
static const uint MAX_COMPETITORS_INTERVAL = 500; ///< The maximum interval (in minutes) between competitors.
|
|
|
|
|
2008-09-30 20:39:50 +00:00
|
|
|
typedef Owner CompanyID;
|
2008-01-12 14:10:35 +00:00
|
|
|
|
2023-05-08 17:01:06 +00:00
|
|
|
typedef uint16_t CompanyMask;
|
2008-07-25 10:00:03 +00:00
|
|
|
|
2008-09-30 20:39:50 +00:00
|
|
|
struct Company;
|
2023-05-08 17:01:06 +00:00
|
|
|
typedef uint32_t CompanyManagerFace; ///< Company manager face bits, info see in company_manager_face.h
|
2008-01-12 14:10:35 +00:00
|
|
|
|
2011-10-15 20:42:32 +00:00
|
|
|
/** The reason why the company was removed. */
|
2023-05-08 17:01:06 +00:00
|
|
|
enum CompanyRemoveReason : uint8_t {
|
2011-10-15 20:42:32 +00:00
|
|
|
CRR_MANUAL, ///< The company is manually removed.
|
|
|
|
CRR_AUTOCLEAN, ///< The company is removed due to autoclean.
|
|
|
|
CRR_BANKRUPT, ///< The company went belly-up.
|
|
|
|
|
2011-12-19 17:48:04 +00:00
|
|
|
CRR_END, ///< Sentinel for end.
|
2021-11-02 20:34:39 +00:00
|
|
|
|
|
|
|
CRR_NONE = CRR_MANUAL, ///< Dummy reason for actions that don't need one.
|
2011-10-15 20:42:32 +00:00
|
|
|
};
|
|
|
|
|
2019-02-04 17:06:19 +00:00
|
|
|
/** The action to do with CMD_COMPANY_CTRL. */
|
2023-05-08 17:01:06 +00:00
|
|
|
enum CompanyCtrlAction : uint8_t {
|
2019-02-04 17:06:19 +00:00
|
|
|
CCA_NEW, ///< Create a new company.
|
|
|
|
CCA_NEW_AI, ///< Create a new AI company.
|
|
|
|
CCA_DELETE, ///< Delete a company.
|
|
|
|
|
|
|
|
CCA_END, ///< Sentinel for end.
|
|
|
|
};
|
|
|
|
|
2008-09-30 20:39:50 +00:00
|
|
|
#endif /* COMPANY_TYPE_H */
|