OpenTTD Source: IndustrySpec Struct Reference

OpenTTD Source 15.3

Public Member Functions | Data Fields
IndustrySpec Struct Reference

Defines the data structure for constructing industry. More...

`#include <industrytype.h>`

## Public Member Functions
bool | IsRawIndustry () const
| Is an industry with the spec a raw industry?
bool | IsProcessingIndustry () const
| Is an industry with the spec a processing industry?
Money | GetConstructionCost () const
| Get the cost for constructing this industry.
Money | GetRemovalCost () const
| Get the cost for removing this industry Take note that the cost will always be zero for non-grf industries.
bool | UsesOriginalEconomy () const
| Determines whether this industrytype uses standard/newgrf production changes.

## Data Fields
std::vector< IndustryTileLayout > | layouts
| List of possible tile layouts for the industry.
uint8_t | cost_multiplier
| Base construction cost multiplier.
uint32_t | removal_cost_multiplier
| Base removal cost multiplier.
uint32_t | prospecting_chance
| Chance prospecting succeeds.
IndustryType | conflicting [3]
| Industries this industry cannot be close to.
uint8_t | check_proc
| Index to a procedure to check for conflicting circumstances.
std::array< CargoType, INDUSTRY_NUM_OUTPUTS > | produced_cargo
uint8_t | production_rate [INDUSTRY_NUM_OUTPUTS]
uint8_t | minimal_cargo
| minimum amount of cargo transported to the stations.
std::array< CargoType, INDUSTRY_NUM_INPUTS > | accepts_cargo
| 16 accepted cargoes.
uint16_t | input_cargo_multiplier [INDUSTRY_NUM_INPUTS][INDUSTRY_NUM_OUTPUTS]
| Input cargo multipliers (multiply amount of incoming cargo for the produced cargoes)
IndustryLifeTypes | life_type
| This is also known as Industry production flag, in newgrf specs.
LandscapeTypes | climate_availability
| Bitmask, giving landscape enums as bit position.
IndustryBehaviours | behaviour
| How this industry will behave, and how others entities can use it.
PixelColour | map_colour
| colour used for the small map
StringID | name
| Displayed name of the industry.
StringID | new_industry_text
| Message appearing when the industry is built.
StringID | closure_text
| Message appearing when the industry closes.
StringID | production_up_text
| Message appearing when the industry's production is increasing.
StringID | production_down_text
| Message appearing when the industry's production is decreasing.
StringID | station_name
| Default name for nearby station.
uint8_t | appear_ingame [NUM_LANDSCAPE]
| Probability of appearance in game.
uint8_t | appear_creation [NUM_LANDSCAPE]
| Probability of appearance during map creation.
IndustryCallbackMasks | callback_mask
| Bitmask of industry callbacks that have to be called.
bool | enabled
| entity still available (by default true).newgrf can disable it, though
SubstituteGRFFileProps | grf_prop
| properties related to the grf file
std::vector< uint8_t > | random_sounds
| Random sounds;.
std::vector< BadgeID > | badges
std::array< std::variant< CargoLabel, MixedCargoType >, INDUSTRY_ORIGINAL_NUM_OUTPUTS > | produced_cargo_label
| Cargo labels of produced cargo for default industries.
std::array< std::variant< CargoLabel, MixedCargoType >, INDUSTRY_ORIGINAL_NUM_INPUTS > | accepts_cargo_label
| Cargo labels of accepted cargo for default industries.

## Detailed Description

Defines the data structure for constructing industry.

Definition at line 103 of file industrytype.h.

## Member Function Documentation

## ◆ GetConstructionCost()

Money IndustrySpec::GetConstructionCost | ( |  | ) | const

Get the cost for constructing this industry.

Returns
  the cost (inflation corrected etc)

Definition at line 3203 of file industry_cmd.cpp.

References _settings_game, GameSettings::construction, cost_multiplier, and ConstructionSettings::raw_industry_construction.

Referenced by CmdBuildIndustry(), and BuildIndustryWindow::DrawWidget().

## ◆ GetRemovalCost()

Money IndustrySpec::GetRemovalCost | ( |  | ) | const

Get the cost for removing this industry Take note that the cost will always be zero for non-grf industries.

Only if the grf author did specified a cost will it be applicable.

Returns
  the cost (inflation corrected etc)

Definition at line 3216 of file industry_cmd.cpp.

References removal_cost_multiplier.

## ◆ IsProcessingIndustry()

bool IndustrySpec::IsProcessingIndustry | ( |  | ) | const

Is an industry with the spec a processing industry?

Returns
  true if it should be handled as a processing industry

Definition at line 3192 of file industry_cmd.cpp.

References behaviour, CutTrees, life_type, Processing, and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().

## ◆ IsRawIndustry()

bool IndustrySpec::IsRawIndustry | ( |  | ) | const

Is an industry with the spec a raw industry?

Returns
  true if it should be handled as a raw industry

Definition at line 3183 of file industry_cmd.cpp.

References BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Any(), Extractive, life_type, and Organic.

Referenced by CmdBuildIndustry(), BuildIndustryWindow::GetWidgetString(), and BuildIndustryWindow::OnClick().

## ◆ UsesOriginalEconomy()

bool IndustrySpec::UsesOriginalEconomy | ( |  | ) | const

Determines whether this industrytype uses standard/newgrf production changes.

Returns
  true if original economy is used.

Definition at line 3225 of file industry_cmd.cpp.

References _settings_game, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Any(), callback_mask, GameSettings::economy, MonthlyProdChange, ProdChangeBuild, Production256Ticks, ProductionCargoArrival, ProductionChange, and EconomySettings::type.

Referenced by ChangeIndustryProduction(), DoCreateNewIndustry(), IndustryViewWindow::OnInvalidateData(), and Industry::RecomputeProductionMultipliers().

## Field Documentation

## ◆ accepts_cargo

std::array<CargoType, INDUSTRY_NUM_INPUTS> IndustrySpec::accepts_cargo

16 accepted cargoes.

Definition at line 117 of file industrytype.h.

Referenced by AfterLoadGame(), IndustryCargoesWindow::ComputeCargoDisplay(), IndustryCargoesWindow::ComputeIndustryDisplay(), CargoesRow::ConnectIndustryAccepted(), IndustryCargoesWindow::CountMatchingAcceptingIndustries(), DoCreateNewIndustry(), BuildIndustryWindow::DrawWidget(), IndustryCargoesWindow::OnInit(), and BuildIndustryWindow::UpdateWidgetSize().

## ◆ accepts_cargo_label

std::array<std::variant<CargoLabel, MixedCargoType>, INDUSTRY_ORIGINAL_NUM_INPUTS> IndustrySpec::accepts_cargo_label

Cargo labels of accepted cargo for default industries.

Definition at line 139 of file industrytype.h.

## ◆ appear_creation

uint8_t IndustrySpec::appear_creation[NUM_LANDSCAPE]

Probability of appearance during map creation.

Definition at line 130 of file industrytype.h.

Referenced by GetScaledIndustryGenerationProbability().

## ◆ appear_ingame

uint8_t IndustrySpec::appear_ingame[NUM_LANDSCAPE]

Probability of appearance in game.

Definition at line 129 of file industrytype.h.

Referenced by GetIndustryGamePlayProbability().

## ◆ badges

std::vector<BadgeID> IndustrySpec::badges

Definition at line 136 of file industrytype.h.

## ◆ behaviour

IndustryBehaviours IndustrySpec::behaviour

How this industry will behave, and how others entities can use it.

Definition at line 121 of file industrytype.h.

Referenced by AfterLoadGame(), ChangeIndustryProduction(), CheckIfIndustryTilesAreFree(), CheckIndustryCloseDownProtection(), Disaster_CoalMine_Init(), Disaster_Helicopter_Init(), DoCreateNewIndustry(), GetAllCargoSuffixes(), GetCargoSuffix(), GetIndustryGamePlayProbability(), GetScaledIndustryGenerationProbability(), IndustriesScopeResolver::GetVariable(), IndustryProductionCallback(), and IsProcessingIndustry().

## ◆ callback_mask

IndustryCallbackMasks IndustrySpec::callback_mask

Bitmask of industry callbacks that have to be called.

Definition at line 132 of file industrytype.h.

Referenced by ChangeIndustryProduction(), DoCreateNewIndustry(), IndustryViewWindow::DrawInfo(), BuildIndustryWindow::DrawWidget(), GetCargoSuffix(), GetIndustryProbabilityCallback(), IndustriesScopeResolver::GetVariable(), IndustryTemporarilyRefusesCargo(), TriggerIndustryProduction(), and UsesOriginalEconomy().

## ◆ check_proc

uint8_t IndustrySpec::check_proc

Index to a procedure to check for conflicting circumstances.

Definition at line 109 of file industrytype.h.

Referenced by CreateNewIndustryHelper(), and GetScaledIndustryGenerationProbability().

## ◆ climate_availability

LandscapeTypes IndustrySpec::climate_availability

Bitmask, giving landscape enums as bit position.

Definition at line 120 of file industrytype.h.

## ◆ closure_text

StringID IndustrySpec::closure_text

Message appearing when the industry closes.

Definition at line 125 of file industrytype.h.

Referenced by ChangeIndustryProduction().

## ◆ conflicting

IndustryType IndustrySpec::conflicting[3]

Industries this industry cannot be close to.

Definition at line 108 of file industrytype.h.

Referenced by CheckIfFarEnoughFromConflictingIndustry().

## ◆ cost_multiplier

uint8_t IndustrySpec::cost_multiplier

Base construction cost multiplier.

Definition at line 105 of file industrytype.h.

Referenced by GetConstructionCost().

## ◆ enabled

bool IndustrySpec::enabled

entity still available (by default true).newgrf can disable it, though

Definition at line 133 of file industrytype.h.

Referenced by IndustryOverrideManager::AddEntityID(), BuildIndustriesLegend(), CmdBuildIndustry(), IndustryCargoesWindow::ComputeCargoDisplay(), IndustryCargoesWindow::ComputeIndustryDisplay(), IndustryCargoesWindow::CountMatchingAcceptingIndustries(), IndustryCargoesWindow::CountMatchingProducingIndustries(), GenerateStationName(), GetIndustryGamePlayProbability(), GetScaledIndustryGenerationProbability(), IndustriesChangeInfo(), IndustryCargoesWindow::OnClick(), IndustryCargoesWindow::OnInit(), IndustryOverrideManager::SetEntitySpec(), and ShowIndustryCargoesWindow().

## ◆ grf_prop

SubstituteGRFFileProps IndustrySpec::grf_prop

properties related to the grf file

Definition at line 134 of file industrytype.h.

Referenced by IndustryOverrideManager::AddEntityID(), ChangeIndustryProduction(), CheckIfCallBackAllowsCreation(), DoCreateNewIndustry(), IndustryViewWindow::DrawInfo(), BuildIndustryWindow::DrawWidget(), GetAiPurchaseCallbackResult(), GetAllCargoSuffixes(), GetCargoSuffix(), GetCargoSuffix(), GetCountAndDistanceOfClosestInstance(), IndustriesResolverObject::GetDebugID(), GetGrffile(), NIHIndustry::GetGRFID(), GetIndustryProbabilityCallback(), IndustriesScopeResolver::GetVariable(), IndustriesResolverObject::IndustriesResolverObject(), IndustryProductionCallback(), IndustryTemporarilyRefusesCargo(), NIHIndustry::IsInspectable(), IndustriesScopeResolver::StorePSA(), and BuildIndustryWindow::UpdateWidgetSize().

## ◆ input_cargo_multiplier

uint16_t IndustrySpec::input_cargo_multiplier[INDUSTRY_NUM_INPUTS][INDUSTRY_NUM_OUTPUTS]

Input cargo multipliers (multiply amount of incoming cargo for the produced cargoes)

Definition at line 118 of file industrytype.h.

Referenced by TriggerIndustryProduction().

## ◆ layouts

std::vector<IndustryTileLayout> IndustrySpec::layouts

List of possible tile layouts for the industry.

Definition at line 104 of file industrytype.h.

Referenced by CmdBuildIndustry(), CreateNewIndustry(), CreateNewIndustryHelper(), GetIndustryGamePlayProbability(), GetScaledIndustryGenerationProbability(), and BuildIndustryWindow::OnPlaceObject().

## ◆ life_type

IndustryLifeTypes IndustrySpec::life_type

This is also known as Industry production flag, in newgrf specs.

Definition at line 119 of file industrytype.h.

Referenced by ChangeIndustryProduction(), CMSAMine(), IsProcessingIndustry(), IsRawIndustry(), and IsTileForestIndustry().

## ◆ map_colour

PixelColour IndustrySpec::map_colour

colour used for the small map

Definition at line 122 of file industrytype.h.

Referenced by BuildIndustriesLegend(), CargoesField::Draw(), BuildIndustryWindow::DrawWidget(), and SmallMapWindow::GetTileColours().

## ◆ minimal_cargo

uint8_t IndustrySpec::minimal_cargo

minimum amount of cargo transported to the stations.

If the waiting cargo is less than this number, no cargo is moved to it.

Definition at line 116 of file industrytype.h.

Referenced by TransportIndustryGoods().

## ◆ name

StringID IndustrySpec::name

Displayed name of the industry.

Definition at line 123 of file industrytype.h.

Referenced by AdvertiseIndustryOpening(), BuildIndustriesLegend(), ChangeIndustryProduction(), CheckIndustries(), CmdIndustrySetProduction(), CargoesField::Draw(), BuildIndustryWindow::DrawWidget(), FormatString(), IndustryCargoesWindow::GetWidgetString(), IndustryProductionCallback(), IndustryCargoesWindow::OnClick(), IndustryCargoesWindow::OnInit(), and BuildIndustryWindow::OnPlaceObject().

## ◆ new_industry_text

StringID IndustrySpec::new_industry_text

Message appearing when the industry is built.

Definition at line 124 of file industrytype.h.

Referenced by AdvertiseIndustryOpening().

## ◆ produced_cargo

std::array<CargoType, INDUSTRY_NUM_OUTPUTS> IndustrySpec::produced_cargo

Definition at line 110 of file industrytype.h.

## ◆ produced_cargo_label

std::array<std::variant<CargoLabel, MixedCargoType>, INDUSTRY_ORIGINAL_NUM_OUTPUTS> IndustrySpec::produced_cargo_label

Cargo labels of produced cargo for default industries.

Definition at line 138 of file industrytype.h.

## ◆ production_down_text

StringID IndustrySpec::production_down_text

Message appearing when the industry's production is decreasing.

Definition at line 127 of file industrytype.h.

Referenced by ChangeIndustryProduction(), and CmdIndustrySetProduction().

## ◆ production_rate

uint8_t IndustrySpec::production_rate[INDUSTRY_NUM_OUTPUTS]

Definition at line 111 of file industrytype.h.

## ◆ production_up_text

StringID IndustrySpec::production_up_text

Message appearing when the industry's production is increasing.

Definition at line 126 of file industrytype.h.

Referenced by ChangeIndustryProduction(), and CmdIndustrySetProduction().

## ◆ prospecting_chance

uint32_t IndustrySpec::prospecting_chance

Chance prospecting succeeds.

Definition at line 107 of file industrytype.h.

Referenced by CmdBuildIndustry().

## ◆ random_sounds

std::vector<uint8_t> IndustrySpec::random_sounds

Random sounds;.

Definition at line 135 of file industrytype.h.

## ◆ removal_cost_multiplier

uint32_t IndustrySpec::removal_cost_multiplier

Base removal cost multiplier.

Definition at line 106 of file industrytype.h.

Referenced by GetRemovalCost().

## ◆ station_name

StringID IndustrySpec::station_name

Default name for nearby station.

Definition at line 128 of file industrytype.h.

Referenced by FormatString(), and GenerateStationName().

The documentation for this struct was generated from the following files:

- src/industrytype.h
- src/industry_cmd.cpp