OpenTTD Source: src/company_type.h File Reference

OpenTTD Source 15.0-RC2

Data Structures | Typedefs | Enumerations | Variables
company_type.h File Reference

Types related to companies. More...

`#include "core/base_bitset_type.hpp"`
`#include "core/pool_type.hpp"`

Go to the source code of this file.

## Data Structures
class | CompanyMask
struct | CompanyManagerFace

## Typedefs
using | CompanyID = PoolID< uint8_t, struct CompanyIDTag, 0xF, 0xFF >
using | Owner = CompanyID

## 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.

## ◆ Owner

using Owner = CompanyID

Definition at line 23 of file company_type.h.

## Enumeration Type Documentation

## ◆ CompanyAllowListCtrlAction

enum CompanyAllowListCtrlAction : uint8_t

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 80 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 71 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 60 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

constexpr CompanyID COMPANY_NEW_COMPANY {254}
| staticconstexpr

The client wants a new company.

Definition at line 20 of file company_type.h.

Referenced by CompanyButtonLine::Draw(), AfterNewGRFScan::OnNewGRFsScanned(), ParseCompanyFromConnectionString(), NetworkClientListWindow::RebuildList(), ServerNetworkGameSocketHandler::Receive_CLIENT_COMMAND(), ServerNetworkGameSocketHandler::Receive_CLIENT_IDENTIFY(), and ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE().

## ◆ COMPANY_SPECTATOR

constexpr CompanyID COMPANY_SPECTATOR {255}
| staticconstexpr

The client is spectating.

Definition at line 21 of file company_type.h.

Referenced by CmdCompanyCtrl(), CompanyButtonLine::Draw(), StatusBarWindow::DrawWidget(), GenerateWorld(), GetMaskOfTownActions(), CommandHelperBase::InternalExecutePrepTest(), CommandHelperBase::InternalExecuteProcessResult(), CommandHelperBase::InternalExecuteValidateTestAndPrepExec(), LoadIntroGame(), LoadUnloadVehicle(), VideoDriver_Dedicated::MainLoop(), MakeScreenshotName(), MenuClickCompany(), NetworkClientsToSpectators(), NetworkServerDoMove(), NetworkGameWindow::OnClick(), StatusBarWindow::OnClick(), GoalListWindow::OnInvalidateData(), CompanyWindow::OnPaint(), MainToolbarWindow::OnPaint(), OnStartGame(), ParseCompanyFromConnectionString(), NetworkClientListWindow::RebuildList(), NetworkClientListWindow::RebuildListCompany(), ServerNetworkGameSocketHandler::Receive_CLIENT_COMMAND(), ServerNetworkGameSocketHandler::Receive_CLIENT_IDENTIFY(), ServerNetworkGameSocketHandler::Receive_CLIENT_MOVE(), ClientNetworkGameSocketHandler::Receive_SERVER_CLIENT_INFO(), ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(), ClientNetworkGameSocketHandler::Receive_SERVER_MOVE(), SetDefaultRailGui(), and SetLocalCompany().

## ◆ INVALID_OWNER

constexpr Owner INVALID_OWNER = Owner::Invalid()
| staticconstexpr

An invalid owner.

Definition at line 30 of file company_type.h.

Referenced by AddSideToSignalBuffer(), AddTrackToSignalBuffer(), AfterLoadGame(), ChangeOwnershipOfCompanyItems(), ClearCargoMonitoring(), CmdCompanyCtrl(), CmdCustomNewsItem(), CmdIndustrySetExclusivity(), CmdRemoveSingleRail(), DeliverGoodsToIndustry(), DoCreateNewIndustry(), Window::InitializeData(), SIGNChunkHandler::Load(), ResetLandscapeConfirmationCallback(), and UpdateSignalsInBuffer().

## ◆ 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(), CompanyCanEditSign(), 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(), ChopLumberMillTrees(), CmdBuildBridge(), CmdBuildBuoy(), CmdBuildCanal(), CmdBuildObject(), CmdBuildRoad(), CmdBuildTunnel(), CmdIndustrySetExclusivity(), CmdInsertOrder(), CmdMoveStationName(), CmdMoveWaypointName(), CmdOpenCloseAirport(), CmdRenameWaypoint(), ConvertRoadTypeOwner(), CreateNewIndustry(), DisasterVehicle::DisasterVehicle(), DoCreateNewIndustry(), DrawRoadTypeCatenary(), LinkGraphOverlay::DrawStationDots(), SignListWindow::DrawWidget(), CompanyStationsWindow::DrawWidget(), OrderList::FreeChain(), 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(), AIScannerInfo::SelectRandomAI(), SetLocalCompany(), SetRoadOwner(), StateGameLoop(), VehicleListIdentifier::ToWindowNumber(), TownActionBuildStatue(), ViewportAddSignStrings(), ViewportAddStationStrings(), and Station::~Station().

## ◆ OWNER_TOWN

constexpr Owner OWNER_TOWN {0x0F}
| staticconstexpr

A town owns the tile, or a town is expanding.

Definition at line 25 of file company_type.h.

Referenced by AfterLoadGame(), CanConvertUnownedRoadType(), CanRemoveRoadWithStop(), CheckAllowRemoveRoad(), CheckAllowRemoveTunnelBridge(), CheckFlatLandRoadStop(), CheckIfCanLevelIndustryPlatform(), CheckIfIndustryTilesAreFree(), CheckOwnership(), CmdBuildBridge(), CmdBuildIndustry(), CmdBuildRoad(), CmdBuildTunnel(), CmdConvertRoad(), CreateRandomTown(), DoClearBridge(), DoClearTunnel(), DrawRoadTypeCatenary(), GetParamsForOwnedBy(), GetRoadOwner(), GetSmallMapOwnerPixels(), GrowTown(), GrowTownAtRoad(), HasRoadTypeAvail(), HasTownOwnedRoad(), MakeRoadBridgeRamp(), MakeRoadTunnel(), RemoveRoad(), SetRoadOwner(), TestTownOwnsBridge(), and TileLoop_Town().

## ◆ OWNER_WATER

constexpr Owner OWNER_WATER {0x11}
| staticconstexpr

The tile/execution is done by "water".

Definition at line 27 of file company_type.h.

Referenced by AfterLoadGame(), BuildObject(), CanRemoveRoadWithStop(), CheckAllowRemoveRoad(), CheckAllowRemoveTunnelBridge(), CmdBuildObject(), CmdRemoveSingleRail(), CmdRemoveSingleSignal(), DoDryUp(), DoFloodTile(), FloodHalftile(), GetSmallMapOwnerPixels(), MakeCanal(), MakeRiver(), MakeSea(), MakeShore(), LandInfoWindow::OnInit(), RemoveAirport(), RemoveFromRailBaseStation(), RemoveRailStation(), RemoveRailStation(), RemoveRailWaypoint(), RemoveRoad(), RemoveRoadStop(), and RemoveRoadWaypointStop().