OpenTTD AI API: AIInfrastructure Class Reference

OpenTTD AI API 14.0-beta2

Public Types | Static Public Member Functions
AIInfrastructure Class Reference

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

Inheritance diagram for AIInfrastructure:

## Public Types
enum | Infrastructure { INFRASTRUCTURE_RAIL, INFRASTRUCTURE_SIGNALS, INFRASTRUCTURE_ROAD, INFRASTRUCTURE_CANAL, INFRASTRUCTURE_STATION, INFRASTRUCTURE_AIRPORT }
| Infrastructure categories. More...

## Static Public Member Functions
static SQInteger | GetRailPieceCount (AICompany::CompanyID company, AIRail::RailType railtype)
| Return the number of rail pieces of a specific rail type for a company. More...
static SQInteger | GetRoadPieceCount (AICompany::CompanyID company, AIRoad::RoadType roadtype)
| Return the number of road pieces of a specific road type for a company. More...
static SQInteger | GetInfrastructurePieceCount (AICompany::CompanyID company, Infrastructure infra_type)
| Return the number of pieces of an infrastructure category for a company. More...
static Money | GetMonthlyRailCosts (AICompany::CompanyID company, AIRail::RailType railtype)
| Return the monthly maintenance costs of a specific rail type for a company. More...
static Money | GetMonthlyRoadCosts (AICompany::CompanyID company, AIRoad::RoadType roadtype)
| Return the monthly maintenance costs of a specific road type for a company. More...
static Money | GetMonthlyInfrastructureCosts (AICompany::CompanyID company, Infrastructure infra_type)
| Return the monthly maintenance costs of an infrastructure category for a company. More...

## Detailed Description

Class that handles all company infrastructure related functions.

## Member Enumeration Documentation

## ◆ Infrastructure

enum AIInfrastructure::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 SQInteger AIInfrastructure::GetInfrastructurePieceCount | ( | AICompany::CompanyID | company,
|  | Infrastructure | infra_type
| ) |  |
| static

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

Parameters

  company | The company to get the count for.
  infra_type | Infrastructure 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 AIInfrastructure::GetMonthlyInfrastructureCosts | ( | AICompany::CompanyID | company,
|  | Infrastructure | infra_type
| ) |  |
| static

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

Parameters

  company | The company to get the monthly cost for.
  infra_type | Infrastructure category to get the cost of.

Returns
  Monthly maintenance cost for the wanted category.

Note
  INFRASTRUCTURE_RAIL and INFRASTRUCTURE_ROAD return the total cost for all rail/road types.

## ◆ GetMonthlyRailCosts()

static Money AIInfrastructure::GetMonthlyRailCosts | ( | AICompany::CompanyID | company,
|  | AIRail::RailType | railtype
| ) |  |
| static

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

Parameters

  company | The company to get the monthly cost for.
  railtype | Rail type to get the cost of.

Returns
  Monthly maintenance cost for the rail type.

## ◆ GetMonthlyRoadCosts()

static Money AIInfrastructure::GetMonthlyRoadCosts | ( | AICompany::CompanyID | company,
|  | AIRoad::RoadType | roadtype
| ) |  |
| static

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

Parameters

  company | The company to get the monthly cost for.
  roadtype | Road type to get the cost of.

Returns
  Monthly maintenance cost for the road type.

## ◆ GetRailPieceCount()

static SQInteger AIInfrastructure::GetRailPieceCount | ( | AICompany::CompanyID | company,
|  | AIRail::RailType | railtype
| ) |  |
| static

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

Parameters

  company | The company to get the count for.
  railtype | Rail type to get the count of.

Returns
  Count for the rail type.

## ◆ GetRoadPieceCount()

static SQInteger AIInfrastructure::GetRoadPieceCount | ( | AICompany::CompanyID | company,
|  | AIRoad::RoadType | roadtype
| ) |  |
| static

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

Parameters

  company | The company to get the count for.
  roadtype | Road type to get the count of.

Returns
  Count for the road type.