OpenTTD: IndustryBuildData Struct Reference

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

Public Member Functions | Data Fields
IndustryBuildData Struct Reference

Data for managing the number and type of industries in the game. More...

`#include <industry.h>`

## Public Member Functions
void | Reset ()
| Completely reset the industry build data.
void | SetupTargetCount ()
| Decide how many industries of each type are needed.
void | TryBuildNewIndustry ()
| Try to create a random industry, during gameplay.
void | MonthlyLoop ()
| Monthly update of industry build data.

## Data Fields
IndustryTypeBuildData | builddata [NUM_INDUSTRYTYPES]
| Industry build data for every industry type.
uint32 | wanted_inds
| Number of wanted industries (bits 31-16), and a fraction (bits 15-0).

## Detailed Description

Data for managing the number and type of industries in the game.

Definition at line 171 of file industry.h.

## Member Function Documentation

void IndustryBuildData::MonthlyLoop | ( |  | ) |

Monthly update of industry build data.

Definition at line 2093 of file industry_cmd.cpp.

References _settings_game, GameSettings::difficulty, GetCurrentTotalNumberOfIndustries(), ID_FUND_ONLY, DifficultySettings::industry_density, min(), ScaleByMapSize(), and wanted_inds.

void IndustryBuildData::Reset | ( |  | ) |

Completely reset the industry build data.

Definition at line 2083 of file industry_cmd.cpp.

References builddata, GetCurrentTotalNumberOfIndustries(), NUM_INDUSTRYTYPES, IndustryTypeBuildData::Reset(), and wanted_inds.

Referenced by AfterLoadGame(), GenerateIndustries(), and Load_ITBL().

void IndustryBuildData::SetupTargetCount | ( |  | ) |

Decide how many industries of each type are needed.

Definition at line 2212 of file industry_cmd.cpp.

References builddata, IndustryTypeBuildData::GetIndustryTypeData(), IndustryTypeBuildData::min_number, NUM_INDUSTRYTYPES, IndustryTypeBuildData::probability, RandomRange(), IndustryTypeBuildData::target_count, and wanted_inds.

Referenced by TryBuildNewIndustry().

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

- src/industry.h
- src/industry_cmd.cpp