# Industry Struct Reference

Defines the internal data of a functionnal industry. More...

`#include <industry.h>`

Inheritance diagram for Industry:

## Public Types

typedef PersistentStorageArray < uint32, 16 > | PersistentStorage

## Public Member Functions

| Industry (TileIndex tile=INVALID_TILE)

## Static Public Member Functions

static FORCEINLINE Industry * | GetByTile (TileIndex tile)
| Get the industry of the given tile.
static Industry * | GetRandom ()
| Return a random valid industry.
static void | PostDestructor (size_t index)
| Invalidating some stuff after removing item from the pool.

## Data Fields

TileArea | location
| Location of the industry.
const Town * | town
| Nearest town.
CargoID | produced_cargo [2]
| 2 production cargo slots
uint16 | produced_cargo_waiting [2]
| amount of cargo produced per cargo
uint16 | incoming_cargo_waiting [3]
| incoming cargo waiting to be processed
byte | production_rate [2]
| production rate for each cargo
byte | prod_level
| general production level
CargoID | accepts_cargo [3]
| 3 input cargo slots
uint16 | this_month_production [2]
| stats of this month's production per cargo
uint16 | this_month_transported [2]
| stats of this month's transport per cargo
byte | last_month_pct_transported [2]
| percentage transported per cargo in the last full month
uint16 | last_month_production [2]
| total units produced per cargo in the last full month
uint16 | last_month_transported [2]
| total units transported per cargo in the last full month
uint16 | counter
| used for animation and/or production (if available cargo)
IndustryType | type
| type of industry.
OwnerByte | owner
| owner of the industry. Which SHOULD always be (imho) OWNER_NONE
byte | random_colour
| randomized colour of the industry, for display purpose
Year | last_prod_year
| last year of production
byte | was_cargo_delivered
| flag that indicate this has been the closest industry chosen for cargo delivery by a station. see DeliverGoodsToIndustry
PartOfSubsidyByte | part_of_subsidy
| NOSAVE: is this industry a source/destination of a subsidy?
OwnerByte | founder
| Founder of the industry.
Date | construction_date
| Date of the construction of the industry.
uint8 | construction_type
| Way the industry was constructed (.
Date | last_cargo_accepted_at
| Last day cargo was accepted by this industry.
byte | selected_layout
| Which tile layout was used when creating the industry.
byte | random_triggers
| Triggers for the random.
uint16 | random
| Random value used for randomisation of all kinds of things.
PersistentStorage | psa
| Persistent storage for NewGRF industries.

## Detailed Description

Defines the internal data of a functionnal industry.

Definition at line 28 of file industry.h.

## Member Function Documentation

static FORCEINLINE Industry* Industry::GetByTile | ( | TileIndex | tile | ) | `[inline, static]`

Get the industry of the given tile.

Parameters:

  | tile | the tile to get the industry from

Precondition:
  IsTileType(t, MP_INDUSTRY)

Returns:
  the industry

Definition at line 74 of file industry.h.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_industry_pool >::Get(), and GetIndustryIndex().

Referenced by CMSAForest(), CMSAMine(), GetIndustryType(), GetSmallMapIndustriesPixels(), GetSmallMapVegetationPixels(), and IndustryGetVariable().

Industry * Industry::GetRandom | ( |  | ) | `[static]`

Return a random valid industry.

Returns:
  random industry, NULL if there are no industries

Definition at line 195 of file industry_cmd.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_industry_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_industry_pool >::GetNumItems(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_industry_pool >::GetPoolSize(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_industry_pool >::index, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_industry_pool >::IsValidID(), and MAX_UVALUE.

Referenced by IndustryDailyLoop().

void Industry::PostDestructor | ( | size_t | index | ) | `[static]`

Invalidating some stuff after removing item from the pool.

Parameters:

  | index | index of deleted item

Reimplemented from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_industry_pool >.

Definition at line 184 of file industry_cmd.cpp.

References InvalidateWindowData(), and Station::RecomputeIndustriesNearForAll().

## Field Documentation

uint8 Industry::construction_type

Way the industry was constructed (.

See also:
  IndustryConstructionType)

Definition at line 56 of file industry.h.

Referenced by IndustryGetVariable().

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

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