OpenTTD Source
12.0-beta2
|
Go to the documentation of this file.
122 inline int GetCargoProducedIndex(
CargoID cargo)
const
125 const CargoID *pos = std::find(this->produced_cargo,
endof(this->produced_cargo), cargo);
126 if (pos ==
endof(this->produced_cargo))
return -1;
130 inline int GetCargoAcceptedIndex(
CargoID cargo)
const
133 const CargoID *pos = std::find(this->accepts_cargo,
endof(this->accepts_cargo), cargo);
134 if (pos ==
endof(this->accepts_cargo))
return -1;
191 inline const char *GetCachedName()
const
193 if (this->cached_name.empty()) this->FillCachedName();
194 return this->cached_name.c_str();
198 void FillCachedName()
const;
204 void ClearAllIndustryCachedNames();
206 void PlantRandomFarmField(
const Industry *i);
246 IDIWD_PRODUCTION_CHANGE,
@ PRODLEVEL_MINIMUM
below this level, the industry is set to be closing
uint32 TileIndex
The index/ID of a Tile.
Owner owner
owner of the industry. Which SHOULD always be (imho) OWNER_NONE
static const IndustryType NUM_INDUSTRYTYPES
total number of industry types, new and old; limited to 240 because we need some special ids like INV...
uint16 this_month_production[INDUSTRY_NUM_OUTPUTS]
stats of this month's production per cargo
static const int INDUSTRY_NUM_OUTPUTS
Number of cargo types an industry can produce.
static Titem * Get(size_t index)
Returns Titem with given index.
PartOfSubsidy part_of_subsidy
NOSAVE: is this industry a source/destination of a subsidy?
@ INDCTL_NONE
No flags in effect.
@ INDCTL_NO_CLOSURE
Industry can not close regardless of production level or time since last delivery.
IndustryTypeBuildData builddata[NUM_INDUSTRYTYPES]
Industry build data for every industry type.
uint16 this_month_transported[INDUSTRY_NUM_OUTPUTS]
stats of this month's transport per cargo
static const int INDUSTRY_NUM_INPUTS
Number of cargo types an industry can accept.
@ PRODLEVEL_CLOSURE
signal set to actually close the industry
uint16 last_month_transported[INDUSTRY_NUM_OUTPUTS]
total units transported per cargo in the last full month
@ SetText
Set additional text.
Tindex index
Index of this pool item.
byte was_cargo_delivered
flag that indicate this has been the closest industry chosen for cargo delivery by a station....
uint16 produced_cargo_waiting[INDUSTRY_NUM_OUTPUTS]
amount of cargo produced per cargo
uint16 last_month_production[INDUSTRY_NUM_OUTPUTS]
total units produced per cargo in the last full month
int32 Year
Type for the year, note: 0 based, i.e. starts at the year 0.
@ SetExclusiveConsumer
Set exclusive consumer.
void RecomputeProductionMultipliers()
Recompute production_rate for current prod_level.
uint8 construction_type
Way the industry was constructed (.
@ MP_INDUSTRY
Part of an industry.
Date construction_date
Date of the construction of the industry.
Owner exclusive_consumer
Which company has exclusive rights to take cargo (INVALID_OWNER = anyone)
@ PRODLEVEL_DEFAULT
default level set when the industry is created
Defines the internal data of a functional industry.
Owner
Enum for all companies/owners.
IndustryControlFlags ctlflags
flags overriding standard behaviours
Station * neutral_station
Associated neutral station.
static Industry * GetRandom()
Return a random valid industry.
@ SetExclusiveSupplier
Set exclusive supplier.
static void PostDestructor(size_t index)
Invalidating some stuff after removing item from the pool.
uint16 wait_count
Number of turns to wait before trying to build again.
StationList stations_near
NOSAVE: List of nearby stations.
uint16 random
Random value used for randomisation of all kinds of things.
TileArea location
Location of the industry.
@ SetControlFlags
Set IndustryControlFlags.
void Reset()
Reset the entry.
std::string cached_name
NOSAVE: Cache of the resolved name of the industry.
static Industry * GetByTile(TileIndex tile)
Get the industry of the given tile.
Owner exclusive_supplier
Which company has exclusive rights to deliver cargo (INVALID_OWNER = anyone)
IndustryType type
type of industry.
uint16 max_wait
Starting number of turns to wait (copied to wait_count).
Data for managing the number and type of industries in the game.
Class for pooled persistent storage of data.
CargoID produced_cargo[INDUSTRY_NUM_OUTPUTS]
16 production cargo slots
uint16 incoming_cargo_waiting[INDUSTRY_NUM_INPUTS]
incoming cargo waiting to be processed
int32 Date
The type to store our dates in.
Represents the covered area of e.g.
static void DecIndustryTypeCount(IndustryType type)
Decrement the count of industries for this type.
void MonthlyLoop()
Monthly update of industry build data.
@ PRODLEVEL_MAXIMUM
the industry is running at full speed
static void ResetIndustryCounts()
Resets industry counts.
void SetupTargetCount()
Decide how many industries of each type are needed.
IndustryDirectoryInvalidateWindowData
Special values for the industry list window for the data parameter of InvalidateWindowData.
void TryBuildNewIndustry()
Try to create a random industry, during gameplay.
std::string text
General text with additional information.
std::set< Station *, StationCompare > StationList
List of stations.
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
bool IsTileForestIndustry(TileIndex tile)
Check whether the tile is a forest.
byte last_month_pct_transported[INDUSTRY_NUM_OUTPUTS]
percentage transported per cargo in the last full month
void Reset()
Completely reset the industry build data.
uint32 wanted_inds
Number of wanted industries (bits 31-16), and a fraction (bits 15-0).
byte selected_layout
Which tile layout was used when creating the industry.
Base class for all pools.
static uint16 GetIndustryTypeCount(IndustryType type)
Get the count of industries for this type.
Owner founder
Founder of the industry.
static void IncIndustryTypeCount(IndustryType type)
Increment the count of industries for this type.
#define endof(x)
Get the end element of an fixed size array.
static IndustryID GetIndustryIndex(TileIndex t)
Get the industry ID of the given tile.
Date last_cargo_accepted_at[INDUSTRY_NUM_INPUTS]
Last day each cargo type was accepted by this industry.
Year last_prod_year
last year of production
byte min_number
Smallest number of industries that should exist (either 0 or 1).
Data for managing the number of industries of a single industry type.
ProductionLevels
Production level maximum, minimum and default values.
PartOfSubsidy
What part of a subsidy is something?
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
byte random_colour
randomized colour of the industry, for display purpose
byte CargoID
Cargo slots to indicate a cargo type within a game.
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
@ INDCTL_NO_PRODUCTION_DECREASE
When industry production change is evaluated, rolls to decrease are ignored.
uint32 probability
Relative probability of building this industry.
IndustryBuildData _industry_builder
In-game manager of industries.
CargoID accepts_cargo[INDUSTRY_NUM_INPUTS]
16 input cargo slots
@ INDCTL_MASK
Mask of all flags set.
byte prod_level
general production level
void ReleaseDisastersTargetingIndustry(IndustryID)
Marks all disasters targeting this industry in such a way they won't call Industry::Get(v->dest_tile)...
static uint16 counts[NUM_INDUSTRYTYPES]
Number of industries per type ingame.
PersistentStorage * psa
Persistent storage for NewGRF industries.
@ INDCTL_NO_PRODUCTION_INCREASE
When industry production change is evaluated, rolls to increase are ignored.
IndustryControlFlags
Flags to control/override the behaviour of an industry.
@ CT_INVALID
Invalid cargo type.
Base class for all PoolItems.
byte production_rate[INDUSTRY_NUM_OUTPUTS]
production rate for each cargo
uint16 target_count
Desired number of industries of this type.
bool GetIndustryTypeData(IndustryType it)
Set the probability and min_number fields for the industry type it for a running game.
uint16 counter
used for animation and/or production (if available cargo)
bool TileBelongsToIndustry(TileIndex tile) const
Check if a given tile belongs to this industry.