OpenTTD Source 20250312-master-gcdcc6b491d
company_type.h File Reference

Types related to companies. More...

#include "core/enum_type.hpp"
#include "core/pool_type.hpp"

Go to the source code of this file.

Data Structures

class  CompanyMask
 

Typedefs

using CompanyID = PoolID< uint8_t, struct CompanyIDTag, 0xF, 0xFF >
 
using Owner = CompanyID
 
typedef uint32_t CompanyManagerFace
 Company manager face bits, info see in company_manager_face.h.
 

Enumerations

enum  CompanyRemoveReason : uint8_t {
  CRR_MANUAL , CRR_AUTOCLEAN , CRR_BANKRUPT , CRR_END ,
  CRR_NONE = CRR_MANUAL
}
 The reason why the company was removed. More...
 
enum  CompanyCtrlAction : uint8_t { CCA_NEW , CCA_NEW_AI , CCA_DELETE , CCA_END }
 The action to do with CMD_COMPANY_CTRL. More...
 
enum  CompanyAllowListCtrlAction : uint8_t { CALCA_ADD , CALCA_REMOVE , CALCA_END }
 The action to do with CMD_COMPANY_ALLOW_LIST_CTRL. More...
 

Variables

static constexpr CompanyID COMPANY_INACTIVE_CLIENT {253}
 The client is joining.
 
static constexpr CompanyID COMPANY_NEW_COMPANY {254}
 The client wants a new company.
 
static constexpr CompanyID COMPANY_SPECTATOR {255}
 The client is spectating.
 
static constexpr Owner OWNER_BEGIN = Owner::Begin()
 First owner.
 
static constexpr Owner OWNER_TOWN {0x0F}
 A town owns the tile, or a town is expanding.
 
static constexpr Owner OWNER_NONE {0x10}
 The tile has no ownership.
 
static constexpr Owner OWNER_WATER {0x11}
 The tile/execution is done by "water".
 
static constexpr Owner OWNER_DEITY {0x12}
 The object is owned by a superuser / goal script.
 
static constexpr Owner OWNER_END {0x13}
 Last + 1 owner.
 
static constexpr Owner INVALID_OWNER = Owner::Invalid()
 An invalid owner.
 
static const uint8_t MAX_COMPANIES = CompanyID::End().base()
 
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'.
 
static const uint MAX_HISTORY_QUARTERS = 24
 The maximum number of quarters kept as performance's history.
 
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.
 

Detailed Description

Types related to companies.

Definition in file company_type.h.

Typedef Documentation

◆ CompanyID

typedef Owner CompanyID

Definition at line 16 of file company_type.h.

◆ CompanyManagerFace

typedef uint32_t CompanyManagerFace

Company manager face bits, info see in company_manager_face.h.

Definition at line 52 of file company_type.h.

◆ Owner

using Owner = CompanyID

Definition at line 23 of file company_type.h.

Enumeration Type Documentation

◆ CompanyAllowListCtrlAction

The action to do with CMD_COMPANY_ALLOW_LIST_CTRL.

Enumerator
CALCA_ADD 

Create a public key.

CALCA_REMOVE 

Remove a public key.

CALCA_END 

Sentinel for end.

Definition at line 75 of file company_type.h.

◆ CompanyCtrlAction

enum CompanyCtrlAction : uint8_t

The action to do with CMD_COMPANY_CTRL.

Enumerator
CCA_NEW 

Create a new company.

CCA_NEW_AI 

Create a new AI company.

CCA_DELETE 

Delete a company.

CCA_END 

Sentinel for end.

Definition at line 66 of file company_type.h.

◆ CompanyRemoveReason

enum CompanyRemoveReason : uint8_t

The reason why the company was removed.

Enumerator
CRR_MANUAL 

The company is manually removed.

CRR_AUTOCLEAN 

The company is removed due to autoclean.

CRR_BANKRUPT 

The company went belly-up.

CRR_END 

Sentinel for end.

CRR_NONE 

Dummy reason for actions that don't need one.

Definition at line 55 of file company_type.h.

Variable Documentation

◆ COMPANY_INACTIVE_CLIENT

constexpr CompanyID COMPANY_INACTIVE_CLIENT {253}
staticconstexpr

The client is joining.

Definition at line 19 of file company_type.h.

◆ COMPANY_NEW_COMPANY

◆ COMPANY_SPECTATOR

◆ INVALID_OWNER

◆ MAX_COMPANIES

const uint8_t MAX_COMPANIES = CompanyID::End().base()
static

Definition at line 32 of file company_type.h.

◆ MAX_COMPETITORS_INTERVAL

const uint MAX_COMPETITORS_INTERVAL = 500
static

The maximum interval (in minutes) between competitors.

Definition at line 39 of file company_type.h.

Referenced by AIConfigWindow::OnClick(), and AIConfigWindow::OnInvalidateData().

◆ MAX_HISTORY_QUARTERS

const uint MAX_HISTORY_QUARTERS = 24
static

The maximum number of quarters kept as performance's history.

Definition at line 36 of file company_type.h.

Referenced by CompaniesGenStatistics().

◆ MAX_LENGTH_COMPANY_NAME_CHARS

const uint MAX_LENGTH_COMPANY_NAME_CHARS = 32
static

The maximum length of a company name in characters including '\0'.

Definition at line 34 of file company_type.h.

Referenced by CmdRenameCompany(), GenerateCompanyName(), and CompanyWindow::OnClick().

◆ MAX_LENGTH_PRESIDENT_NAME_CHARS

const uint MAX_LENGTH_PRESIDENT_NAME_CHARS = 32
static

The maximum length of a president name in characters including '\0'.

Definition at line 33 of file company_type.h.

Referenced by CmdRenamePresident(), GeneratePresidentName(), and CompanyWindow::OnClick().

◆ MIN_COMPETITORS_INTERVAL

const uint MIN_COMPETITORS_INTERVAL = 0
static

The minimum interval (in minutes) between competitors.

Definition at line 38 of file company_type.h.

Referenced by AIConfigWindow::OnClick(), and AIConfigWindow::OnInvalidateData().

◆ OWNER_BEGIN

constexpr Owner OWNER_BEGIN = Owner::Begin()
staticconstexpr

First owner.

Definition at line 24 of file company_type.h.

Referenced by SRNDChunkHandler::Save().

◆ OWNER_DEITY

constexpr Owner OWNER_DEITY {0x12}
staticconstexpr

The object is owned by a superuser / goal script.

Definition at line 28 of file company_type.h.

Referenced by ScriptListWindow::ChangeScript(), CmdBuildBridge(), CmdBuildIndustry(), CmdBuildObject(), CmdBuildRoad(), CmdBuildSingleRail(), CmdBuildTunnel(), CmdChangeBankBalance(), CmdCreateGoal(), CmdCreateLeagueTable(), CmdCreateLeagueTableElement(), CmdCreateStoryPage(), CmdCreateStoryPageElement(), CmdCreateSubsidy(), CmdCustomNewsItem(), CmdEngineCtrl(), CmdExpandTown(), CmdFoundTown(), CmdGoalQuestion(), CmdGoalQuestionAnswer(), CmdIndustrySetExclusivity(), CmdIndustrySetFlags(), CmdIndustrySetProduction(), CmdIndustrySetText(), CmdPlaceSign(), CmdRemoveGoal(), CmdRemoveLeagueTableElement(), CmdRemoveStoryPage(), CmdRemoveStoryPageElement(), CmdScrollViewport(), CmdSetCompanyMaxLoan(), CmdSetGoalCompleted(), CmdSetGoalDestination(), CmdSetGoalProgress(), CmdSetGoalText(), CmdSetStoryPageDate(), CmdSetStoryPageTitle(), CmdShowStoryPage(), CmdTownCargoGoal(), CmdTownGrowthRate(), CmdTownRating(), CmdTownSetText(), CmdUpdateLeagueTableElementData(), CmdUpdateLeagueTableElementScore(), CmdUpdateStoryPageElement(), CompanyCanRenameSign(), GameInstance::Died(), ScriptListWindow::DrawWidget(), Game::GameLoop(), ScriptConfig::GetTextfile(), ScriptListWindow::GetWidgetString(), ScriptSettingsWindow::GetWidgetString(), ScriptTextfileWindow::GetWidgetString(), ScriptDebugWindow::GetWidgetString(), HandleClickOnSign(), HasRoadTypeAvail(), GameInstance::Initialize(), CommandHelperBase::InternalExecutePrepTest(), ScriptDebugWindow::IsDead(), IsEngineBuildable(), ScriptDebugWindow::IsValidDebugCompany(), SIGNChunkHandler::Load(), Game::NewEvent(), GSConfigWindow::OnClick(), ScriptSettingsWindow::OnClick(), ScriptDebugWindow::OnClick(), GSConfigWindow::OnInvalidateData(), ScriptTextfileWindow::OnInvalidateData(), ScriptDebugWindow::OnInvalidateData(), SignList::OwnerDeityFilter(), SignList::OwnerVisibilityFilter(), Game::Save(), ScriptListWindow::ScriptListWindow(), ScriptDebugWindow::SelectValidDebugCompany(), ShowScriptDebugWindowIfScriptError(), Game::StartNew(), ScriptDebugWindow::UpdateGSButtonState(), and ViewportAddSignStrings().

◆ OWNER_END

constexpr Owner OWNER_END {0x13}
staticconstexpr

Last + 1 owner.

Definition at line 29 of file company_type.h.

Referenced by CheckOwnership(), and SRNDChunkHandler::Save().

◆ OWNER_NONE

constexpr Owner OWNER_NONE {0x10}
staticconstexpr

The tile has no ownership.

Definition at line 26 of file company_type.h.

Referenced by _GenerateWorld(), LinkGraphOverlay::AddLinks(), AfterLoadGame(), AutoslopeEnabled(), BuildObject(), CompanyStationsWindow::BuildStationsList(), CanConvertUnownedRoadType(), CanRemoveRoadWithStop(), ChangeOwnershipOfCompanyItems(), CheckAllowRemoveRoad(), CheckAllowRemoveTunnelBridge(), CheckClearTile(), CheckFlatLandRoadStop(), CmdBuildBridge(), CmdBuildBuoy(), CmdBuildCanal(), CmdBuildObject(), CmdBuildRoad(), CmdBuildTunnel(), CmdIndustrySetExclusivity(), CmdInsertOrder(), CmdOpenCloseAirport(), CmdRenameWaypoint(), ConvertRoadTypeOwner(), CreateNewIndustry(), DisasterVehicle::DisasterVehicle(), DoCreateNewIndustry(), DrawRoadTypeCatenary(), LinkGraphOverlay::DrawStationDots(), SignListWindow::DrawWidget(), CompanyStationsWindow::DrawWidget(), GetOrderCmdFromTile(), GetRoadOwner(), GetSmallMapOwnerPixels(), GrowTownAtRoad(), OrderList::InsertOrderAt(), SIGNChunkHandler::Load(), MakeClear(), MakeField(), MakeOilrig(), MakeTree(), MayLoadUnderExclusiveRights(), MoveBuoysToWaypoints(), CompanyStationsWindow::OnClick(), LandInfoWindow::OnInit(), WaypointWindow::OnInvalidateData(), StationViewWindow::OnPaint(), BuildIndustryWindow::OnPlaceObject(), OnTick_Companies(), PlaceInitialIndustry(), LinkGraphOverlay::RebuildCache(), RemoveGenericRoadStop(), RemoveLock(), SearchLumberMillTrees(), AIScannerInfo::SelectRandomAI(), SetLocalCompany(), SetRoadOwner(), StateGameLoop(), VehicleListIdentifier::ToWindowNumber(), TownActionBuildStatue(), ViewportAddSignStrings(), ViewportAddStationStrings(), Order::~Order(), and Station::~Station().

◆ OWNER_TOWN

◆ OWNER_WATER