|
OpenTTD Source 20251117-master-g7398d2e290
|
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 | EconomyMonthlyLoop () |
| Monthly update of industry build data. | |
Data Fields | |
| IndustryTypeBuildData | builddata [NUM_INDUSTRYTYPES] |
| Industry build data for every industry type. | |
| uint32_t | wanted_inds |
| Number of wanted industries (bits 31-16), and a fraction (bits 15-0). | |
Data for managing the number and type of industries in the game.
Definition at line 306 of file industry.h.
| void IndustryBuildData::EconomyMonthlyLoop | ( | ) |
Monthly update of industry build data.
Definition at line 2439 of file industry_cmd.cpp.
References _settings_game, GameSettings::difficulty, GetCurrentTotalNumberOfIndustries(), ID_FUND_ONLY, DifficultySettings::industry_density, Map::ScaleBySize(), and wanted_inds.
| void IndustryBuildData::Reset | ( | ) |
Completely reset the industry build data.
Definition at line 2429 of file industry_cmd.cpp.
References builddata, GetCurrentTotalNumberOfIndustries(), NUM_INDUSTRYTYPES, IndustryTypeBuildData::Reset(), and wanted_inds.
Referenced by AfterLoadGame(), and GenerateIndustries().
| void IndustryBuildData::SetupTargetCount | ( | ) |
Decide how many industries of each type are needed.
Definition at line 2624 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().
| void IndustryBuildData::TryBuildNewIndustry | ( | ) |
Try to create a random industry, during gameplay.
Definition at line 2669 of file industry_cmd.cpp.
References AdvertiseIndustryOpening(), builddata, EconomyIsInRecession(), Industry::GetIndustryTypeCount(), IACT_RANDOMCREATION, IndustryTypeBuildData::max_wait, NUM_INDUSTRYTYPES, PlaceIndustry(), RandomRange(), SetupTargetCount(), IndustryTypeBuildData::target_count, and IndustryTypeBuildData::wait_count.
| IndustryTypeBuildData IndustryBuildData::builddata[NUM_INDUSTRYTYPES] |
Industry build data for every industry type.
Definition at line 307 of file industry.h.
Referenced by ITBLChunkHandler::Load(), Reset(), ITBLChunkHandler::Save(), SetupTargetCount(), and TryBuildNewIndustry().
| uint32_t IndustryBuildData::wanted_inds |
Number of wanted industries (bits 31-16), and a fraction (bits 15-0).
Definition at line 308 of file industry.h.
Referenced by EconomyMonthlyLoop(), Reset(), and SetupTargetCount().