90 inline int GetCargoProducedIndex(
CargoID cargo)
const 93 const CargoID *pos = std::find(this->produced_cargo,
endof(this->produced_cargo), cargo);
94 if (pos ==
endof(this->produced_cargo))
return -1;
98 inline int GetCargoAcceptedIndex(
CargoID cargo)
const 101 const CargoID *pos = std::find(this->accepts_cargo,
endof(this->accepts_cargo), cargo);
102 if (pos ==
endof(this->accepts_cargo))
return -1;
163 void PlantRandomFarmField(
const Industry *i);
169 #define FOR_ALL_INDUSTRIES_FROM(var, start) FOR_ALL_ITEMS_FROM(Industry, industry_index, var, start) 170 #define FOR_ALL_INDUSTRIES(var) FOR_ALL_INDUSTRIES_FROM(var, 0) 182 bool GetIndustryTypeData(IndustryType it);
194 void SetupTargetCount();
195 void TryBuildNewIndustry();
static void ResetIndustryCounts()
Resets industry counts.
void ReleaseDisastersTargetingIndustry(IndustryID)
Marks all disasters targeting this industry in such a way they won't call Industry::Get(v->dest_tile)...
byte production_rate[INDUSTRY_NUM_OUTPUTS]
production rate for each cargo
ProductionLevels
Production level maximum, minimum and default values.
uint16 max_wait
Starting number of turns to wait (copied to wait_count).
basic types related to subsidies
static const int INDUSTRY_NUM_INPUTS
Number of cargo types an industry can accept.
IndustryBuildData _industry_builder
In-game manager of industries.
uint16 counter
used for animation and/or production (if available cargo)
below this level, the industry is set to be closing
static Titem * Get(size_t index)
Returns Titem with given index.
OwnerByte founder
Founder of the industry.
Functionality related to the temporary and persistent storage arrays for NewGRFs. ...
byte selected_layout
Which tile layout was used when creating the industry.
uint8 construction_type
Way the industry was constructed (.
default level set when the industry is created
signal set to actually close the industry
Defines the internal data of a functional industry.
Tindex index
Index of this pool item.
Date last_cargo_accepted_at[INDUSTRY_NUM_INPUTS]
Last day each cargo type was accepted by this industry.
byte was_cargo_delivered
flag that indicate this has been the closest industry chosen for cargo delivery by a station...
uint16 random
Random value used for randomisation of all kinds of things.
static Industry * GetRandom()
Return a random valid industry.
int32 Year
Type for the year, note: 0 based, i.e. starts at the year 0.
Accessors for industries.
the industry is running at full speed
static const int INDUSTRY_NUM_OUTPUTS
Number of cargo types an industry can produce.
byte random_colour
randomized colour of the industry, for display purpose
Date construction_date
Date of the construction of the industry.
Data for managing the number and type of industries in the game.
uint16 this_month_production[INDUSTRY_NUM_OUTPUTS]
stats of this month's production per cargo
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
PersistentStorage * psa
Persistent storage for NewGRF industries.
PartOfSubsidyByte part_of_subsidy
NOSAVE: is this industry a source/destination of a subsidy?
bool IsTileForestIndustry(TileIndex tile)
Check whether the tile is a forest.
uint16 this_month_transported[INDUSTRY_NUM_OUTPUTS]
stats of this month's transport per cargo
Year last_prod_year
last year of production
IndustryType type
type of industry.
TileArea location
Location of the industry.
uint16 last_month_production[INDUSTRY_NUM_OUTPUTS]
total units produced per cargo in the last full month
Represents the covered area of e.g.
CargoID produced_cargo[INDUSTRY_NUM_OUTPUTS]
16 production cargo slots
Class for pooled persistent storage of data.
static uint16 GetIndustryTypeCount(IndustryType type)
Get the count of industries for this type.
CargoID accepts_cargo[INDUSTRY_NUM_INPUTS]
16 input cargo slots
uint16 incoming_cargo_waiting[INDUSTRY_NUM_INPUTS]
incoming cargo waiting to be processed
byte prod_level
general production level
Data for managing the number of industries of a single industry type.
Base class for all PoolItems.
uint16 wait_count
Number of turns to wait before trying to build again.
static void IncIndustryTypeCount(IndustryType type)
Increment the count of industries for this type.
Base class for all pools.
static void PostDestructor(size_t index)
Invalidating some stuff after removing item from the pool.
uint16 produced_cargo_waiting[INDUSTRY_NUM_OUTPUTS]
amount of cargo produced per cargo
uint32 TileIndex
The index/ID of a Tile.
void RecomputeProductionMultipliers()
Recompute production_rate for current prod_level.
static const IndustryType NUM_INDUSTRYTYPES
total number of industry types, new and old; limited to 240 because we need some special ids like INV...
static IndustryID GetIndustryIndex(TileIndex t)
Get the industry ID of the given tile.
#define endof(x)
Get the end element of an fixed size array.
static void DecIndustryTypeCount(IndustryType type)
Decrement the count of industries for this type.
Type for storing the 'area' of something uses on the map.
uint32 probability
Relative probability of building this industry.
static uint16 counts[NUM_INDUSTRYTYPES]
Number of industries per type ingame.
uint32 wanted_inds
Number of wanted industries (bits 31-16), and a fraction (bits 15-0).
uint16 last_month_transported[INDUSTRY_NUM_OUTPUTS]
total units transported per cargo in the last full month
int32 Date
The type to store our dates in.
byte min_number
Smallest number of industries that should exist (either 0 or 1).
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
bool TileBelongsToIndustry(TileIndex tile) const
Check if a given tile belongs to this industry.
byte CargoID
Cargo slots to indicate a cargo type within a game.
static Industry * GetByTile(TileIndex tile)
Get the industry of the given tile.
uint16 target_count
Desired number of industries of this type.
byte last_month_pct_transported[INDUSTRY_NUM_OUTPUTS]
percentage transported per cargo in the last full month
OwnerByte owner
owner of the industry. Which SHOULD always be (imho) OWNER_NONE