OpenTTD GameScript API 20250111-master-g8b664a42b0
Public Types | Static Public Member Functions
GSInfrastructure Class Reference

Class that handles all company infrastructure related functions. More...

#include <script_infrastructure.hpp>

Inheritance diagram for GSInfrastructure:

Public Types

enum  Infrastructure {
  INFRASTRUCTURE_RAIL ,
  INFRASTRUCTURE_SIGNALS ,
  INFRASTRUCTURE_ROAD ,
  INFRASTRUCTURE_CANAL ,
  INFRASTRUCTURE_STATION ,
  INFRASTRUCTURE_AIRPORT
}
 Infrastructure categories. More...
 

Static Public Member Functions

static int GetRailPieceCount (GSCompany::CompanyID company, GSRail::RailType railtype)
 Return the number of rail pieces of a specific rail type for a company.
 
static int GetRoadPieceCount (GSCompany::CompanyID company, GSRoad::RoadType roadtype)
 Return the number of road pieces of a specific road type for a company.
 
static int GetInfrastructurePieceCount (GSCompany::CompanyID company, Infrastructure infra_type)
 Return the number of pieces of an infrastructure category for a company.
 
static Money GetMonthlyRailCosts (GSCompany::CompanyID company, GSRail::RailType railtype)
 Return the monthly maintenance costs of a specific rail type for a company.
 
static Money GetMonthlyRoadCosts (GSCompany::CompanyID company, GSRoad::RoadType roadtype)
 Return the monthly maintenance costs of a specific road type for a company.
 
static Money GetMonthlyInfrastructureCosts (GSCompany::CompanyID company, Infrastructure infra_type)
 Return the monthly maintenance costs of an infrastructure category for a company.
 

Detailed Description

Class that handles all company infrastructure related functions.

Member Enumeration Documentation

◆ Infrastructure

Infrastructure categories.

Enumerator
INFRASTRUCTURE_RAIL 

Rail infrastructure.

INFRASTRUCTURE_SIGNALS 

Signal infrastructure.

INFRASTRUCTURE_ROAD 

Road infrastructure.

INFRASTRUCTURE_CANAL 

Canal infrastructure.

INFRASTRUCTURE_STATION 

Station infrastructure.

INFRASTRUCTURE_AIRPORT 

Airport infrastructure.

Member Function Documentation

◆ GetInfrastructurePieceCount()

static int GSInfrastructure::GetInfrastructurePieceCount ( GSCompany::CompanyID  company,
Infrastructure  infra_type 
)
static

Return the number of pieces of an infrastructure category for a company.

Parameters
companyThe company to get the count for.
infra_typeInfrastructure category to get the cost of.
Returns
Count for the wanted category.
Note
INFRASTRUCTURE_RAIL and INFRASTRUCTURE_ROAD return the total count for all rail/road types.

◆ GetMonthlyInfrastructureCosts()

static Money GSInfrastructure::GetMonthlyInfrastructureCosts ( GSCompany::CompanyID  company,
Infrastructure  infra_type 
)
static

Return the monthly maintenance costs of an infrastructure category for a company.

Parameters
companyThe company to get the monthly cost for.
infra_typeInfrastructure category to get the cost of.
Returns
Maintenance cost for the wanted category per economy-month.
Note
INFRASTRUCTURE_RAIL and INFRASTRUCTURE_ROAD return the total cost for all rail/road types.
See also
GSEconomyTime

◆ GetMonthlyRailCosts()

static Money GSInfrastructure::GetMonthlyRailCosts ( GSCompany::CompanyID  company,
GSRail::RailType  railtype 
)
static

Return the monthly maintenance costs of a specific rail type for a company.

Parameters
companyThe company to get the monthly cost for.
railtypeRail type to get the cost of.
Returns
Maintenance cost for the rail type per economy-month.
See also
GSEconomyTime

◆ GetMonthlyRoadCosts()

static Money GSInfrastructure::GetMonthlyRoadCosts ( GSCompany::CompanyID  company,
GSRoad::RoadType  roadtype 
)
static

Return the monthly maintenance costs of a specific road type for a company.

Parameters
companyThe company to get the monthly cost for.
roadtypeRoad type to get the cost of.
Returns
Maintenance cost for the road type per economy-month.
See also
GSEconomyTime

◆ GetRailPieceCount()

static int GSInfrastructure::GetRailPieceCount ( GSCompany::CompanyID  company,
GSRail::RailType  railtype 
)
static

Return the number of rail pieces of a specific rail type for a company.

Parameters
companyThe company to get the count for.
railtypeRail type to get the count of.
Returns
Count for the rail type.

◆ GetRoadPieceCount()

static int GSInfrastructure::GetRoadPieceCount ( GSCompany::CompanyID  company,
GSRoad::RoadType  roadtype 
)
static

Return the number of road pieces of a specific road type for a company.

Parameters
companyThe company to get the count for.
roadtypeRoad type to get the count of.
Returns
Count for the road type.