OpenTTD Source 20260218-master-g2123fca5ea
company_type.h File Reference

Types related to companies. More...

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 class  CompanyRemoveReason : uint8_t {
  Manual , Autoclean , Bankrupt , End ,
  None = Manual
}
 The reason why the company was removed. More...
enum class  CompanyCtrlAction : uint8_t { New , NewAI , Delete }
 The action to do with Commands::CompanyControl. More...
enum class  CompanyAllowListCtrlAction : uint8_t { AddKey , RemoveKey , AllowAny , AllowListed }
 The action to do with Commands::CompanyAllowListControl. 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 = PoolID<uint8_t, struct CompanyIDTag, 0xF, 0xFF>

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 class CompanyAllowListCtrlAction : uint8_t
strong

The action to do with Commands::CompanyAllowListControl.

Enumerator
AddKey 

Create a public key.

RemoveKey 

Remove a public key.

AllowAny 

Allow joining the company without a key.

AllowListed 

Allow only listed keys to join the company.

Definition at line 78 of file company_type.h.

◆ CompanyCtrlAction

enum class CompanyCtrlAction : uint8_t
strong

The action to do with Commands::CompanyControl.

Enumerator
New 

Create a new company.

NewAI 

Create a new AI company.

Delete 

Delete a company.

Definition at line 71 of file company_type.h.

◆ CompanyRemoveReason

enum class CompanyRemoveReason : uint8_t
strong

The reason why the company was removed.

Enumerator
Manual 

The company is manually removed.

Autoclean 

The company is removed due to autoclean.

Bankrupt 

The company went belly-up.

End 

Sentinel for end.

None 

Dummy reason for actions that don't need one.

Definition at line 60 of file company_type.h.

Variable Documentation

◆ COMPANY_INACTIVE_CLIENT

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

Owner OWNER_BEGIN = Owner::Begin()
staticconstexpr

First owner.

Definition at line 24 of file company_type.h.

Referenced by SRNDChunkHandler::Save().

◆ OWNER_DEITY

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(), ScriptDebugWindow::GetWidgetString(), ScriptListWindow::GetWidgetString(), ScriptSettingsWindow::GetWidgetString(), ScriptTextfileWindow::GetWidgetString(), HandleClickOnSign(), HasRoadTypeAvail(), GameInstance::Initialize(), CommandHelperBase::InternalExecutePrepTest(), ScriptDebugWindow::IsDead(), IsEngineBuildable(), ScriptDebugWindow::IsValidDebugCompany(), SIGNChunkHandler::Load(), Game::NewEvent(), GSConfigWindow::OnClick(), ScriptDebugWindow::OnClick(), ScriptSettingsWindow::OnClick(), GSConfigWindow::OnInvalidateData(), ScriptDebugWindow::OnInvalidateData(), ScriptTextfileWindow::OnInvalidateData(), SignList::OwnerDeityFilter(), SignList::OwnerVisibilityFilter(), Game::Save(), ScriptListWindow::ScriptListWindow(), ScriptDebugWindow::SelectValidDebugCompany(), ShowScriptDebugWindowIfScriptError(), Game::StartNew(), ScriptDebugWindow::UpdateGSButtonState(), and ViewportAddSignStrings().

◆ OWNER_END

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

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(), AircraftEventHandler_Flying(), 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(), CompanyStationsWindow::DrawWidget(), SignListWindow::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

◆ OWNER_WATER