# industry_map.h File Reference

Accessors for industries. More...

`#include "industry.h"`
`#include "tile_map.h"`

Go to the source code of this file.

## Enumerations
enum | { GFX_COAL_MINE_TOWER_NOT_ANIMATED = 0, GFX_COAL_MINE_TOWER_ANIMATED = 1, GFX_POWERPLANT_CHIMNEY = 8, GFX_POWERPLANT_SPARKS = 10, GFX_OILRIG_1 = 24, GFX_OILRIG_2 = 25, GFX_OILRIG_3 = 26, GFX_OILRIG_4 = 27, GFX_OILRIG_5 = 28, GFX_OILWELL_NOT_ANIMATED = 29, GFX_OILWELL_ANIMATED_1 = 30, GFX_OILWELL_ANIMATED_2 = 31, GFX_OILWELL_ANIMATED_3 = 32, GFX_COPPER_MINE_TOWER_NOT_ANIMATED = 47, GFX_COPPER_MINE_TOWER_ANIMATED = 48, GFX_COPPER_MINE_CHIMNEY = 49, GFX_GOLD_MINE_TOWER_NOT_ANIMATED = 79, GFX_GOLD_MINE_TOWER_ANIMATED = 88, GFX_TOY_FACTORY = 143, GFX_PLASTIC_FOUNTAIN_ANIMATED_1 = 148, GFX_PLASTIC_FOUNTAIN_ANIMATED_2 = 149, GFX_PLASTIC_FOUNTAIN_ANIMATED_3 = 150, GFX_PLASTIC_FOUNTAIN_ANIMATED_4 = 151, GFX_PLASTIC_FOUNTAIN_ANIMATED_5 = 152, GFX_PLASTIC_FOUNTAIN_ANIMATED_6 = 153, GFX_PLASTIC_FOUNTAIN_ANIMATED_7 = 154, GFX_PLASTIC_FOUNTAIN_ANIMATED_8 = 155, GFX_BUBBLE_GENERATOR = 161, GFX_BUBBLE_CATCHER = 162, GFX_TOFFEE_QUARY = 165, GFX_SUGAR_MINE_SIEVE = 174, GFX_WATERTILE_SPECIALCHECK = 255 }
| The following enums are indices used to know what to draw for this industry tile. More...
## Functions
static IndustryID | GetIndustryIndex (TileIndex t)
| Get the industry ID of the given tile.
static Industry * | GetIndustryByTile (TileIndex t)
| Get the industry of the given tile.
static bool | IsIndustryCompleted (TileIndex t)
| Is this industry tile fully built?
IndustryType | GetIndustryType (TileIndex tile)
| Retrieve the type for this industry.
static void | SetIndustryCompleted (TileIndex tile, bool isCompleted)
| Set if the industry that owns the tile as under construction or not.
static byte | GetIndustryConstructionStage (TileIndex tile)
| Returns the industry construction stage of the specified tile.
static void | SetIndustryConstructionStage (TileIndex tile, byte value)
| Sets the industry construction stage of the specified tile.
static IndustryGfx | GetCleanIndustryGfx (TileIndex t)
static IndustryGfx | GetIndustryGfx (TileIndex t)
| Get the industry graphics ID for the given industry tile.
static void | SetIndustryGfx (TileIndex t, IndustryGfx gfx)
| Set the industry graphics ID for the given industry tile.
static void | MakeIndustry (TileIndex t, IndustryID index, IndustryGfx gfx, uint8 random)
| Make the given tile an industry tile.
static byte | GetIndustryConstructionCounter (TileIndex tile)
| Returns this indutry tile's construction counter value.
static void | SetIndustryConstructionCounter (TileIndex tile, byte value)
| Sets this indutry tile's construction counter value.
static void | ResetIndustryConstructionStage (TileIndex tile)
| Reset the construction stage counter of the industry, as well as the completion bit.
static byte | GetIndustryAnimationLoop (TileIndex tile)
| Get the animation loop number.
static void | SetIndustryAnimationLoop (TileIndex tile, byte count)
| Set the animation loop number.
static byte | GetIndustryAnimationState (TileIndex tile)
| Get the animation state.
static void | SetIndustryAnimationState (TileIndex tile, byte state)
| Set the animation state.
static byte | GetIndustryRandomBits (TileIndex tile)
| Get the random bits for this tile.
static void | SetIndustryRandomBits (TileIndex tile, byte bits)
| Set the random bits for this tile.
static byte | GetIndustryTriggers (TileIndex tile)
| Get the activated triggers bits for this industry tile Used for grf callbacks.
static void | SetIndustryTriggers (TileIndex tile, byte triggers)
| Set the activated triggers bits for this industry tile Used for grf callbacks.

## Detailed Description

Accessors for industries.

Definition in file industry_map.h.

## Enumeration Type Documentation

anonymous enum

The following enums are indices used to know what to draw for this industry tile.

They all are pointing toward array _industry_draw_tile_data, in table/industry_land.h How to calculate the correct position ? GFXid << 2 | IndustryStage (0 to 3)

Enumerator:

  GFX_WATERTILE_SPECIALCHECK | not really a tile, but rather a very special check

Definition at line 18 of file industry_map.h.

## Function Documentation

static byte GetIndustryAnimationLoop | ( | TileIndex | tile | ) | `[inline, static]`

Get the animation loop number.

Parameters:

  | tile | the tile to get the animation loop number of

Precondition:
  IsTileType(tile, MP_INDUSTRY)

Definition at line 218 of file industry_map.h.

References _m, IsTileType(), Tile::m4, and MP_INDUSTRY.

static byte GetIndustryAnimationState | ( | TileIndex | tile | ) | `[inline, static]`

Get the animation state.

Parameters:

  | tile | the tile to get the animation state of

Precondition:
  IsTileType(tile, MP_INDUSTRY)

Definition at line 241 of file industry_map.h.

References _m, IsTileType(), Tile::m3, and MP_INDUSTRY.

Referenced by IndustryGetVariable().

static Industry* GetIndustryByTile | ( | TileIndex | t | ) | `[inline, static]`

Get the industry of the given tile.

Parameters:

  | t | the tile to get the industry from

Precondition:
  IsTileType(t, MP_INDUSTRY)

Returns:
  the industry

Definition at line 71 of file industry_map.h.

References GetIndustryIndex().

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

static byte GetIndustryConstructionCounter | ( | TileIndex | tile | ) | `[inline, static]`

Returns this indutry tile's construction counter value.

Parameters:

  | tile | the tile to query

Precondition:
  IsTileType(tile, MP_INDUSTRY)

Returns:
  the construction counter

Definition at line 181 of file industry_map.h.

References _m, GB(), IsTileType(), and MP_INDUSTRY.

static byte GetIndustryConstructionStage | ( | TileIndex | tile | ) | `[inline, static]`

Returns the industry construction stage of the specified tile.

Parameters:

  | tile | the tile to query

Precondition:
  IsTileType(tile, MP_INDUSTRY)

Returns:
  the construction stage

Definition at line 108 of file industry_map.h.

References _m, GB(), INDUSTRY_COMPLETED, IsIndustryCompleted(), IsTileType(), and MP_INDUSTRY.

static IndustryGfx GetIndustryGfx | ( | TileIndex | t | ) | `[inline, static]`

Get the industry graphics ID for the given industry tile.

Parameters:

  | t | the tile to get the gfx for

Precondition:
  IsTileType(t, MP_INDUSTRY)

Returns:
  the gfx ID

Definition at line 138 of file industry_map.h.

References IsTileType(), and MP_INDUSTRY.

static IndustryID GetIndustryIndex | ( | TileIndex | t | ) | `[inline, static]`

Get the industry ID of the given tile.

Parameters:

  | t | the tile to get the industry ID from

Precondition:
  IsTileType(t, MP_INDUSTRY)

Returns:
  the industry ID

Definition at line 59 of file industry_map.h.

References _m, IsTileType(), Tile::m2, and MP_INDUSTRY.

Referenced by DisasterTick_Airplane(), DisasterTick_Helicopter(), GetIndustryByTile(), GetIndustryIDAtOffset(), and GetNearbyIndustryTileInformation().

static byte GetIndustryRandomBits | ( | TileIndex | tile | ) | `[inline, static]`

Get the random bits for this tile.

Used for grf callbacks

Parameters:

  | tile | TileIndex of the tile to query

Precondition:
  IsTileType(tile, MP_INDUSTRY)

Returns:
  requested bits

Definition at line 266 of file industry_map.h.

References _me, IsTileType(), TileExtended::m7, and MP_INDUSTRY.

Referenced by IndustryGetVariable().

static byte GetIndustryTriggers | ( | TileIndex | tile | ) | `[inline, static]`

Get the activated triggers bits for this industry tile Used for grf callbacks.

Parameters:

  | tile | TileIndex of the tile to query

Precondition:
  IsTileType(tile, MP_INDUSTRY)

Returns:
  requested triggers

Definition at line 292 of file industry_map.h.

References _m, GB(), IsTileType(), and MP_INDUSTRY.

IndustryType GetIndustryType | ( | TileIndex | tile | ) |

Retrieve the type for this industry.

Although it is accessed by a tile, it will return the general type of industry, and not the sprite index as would do GetIndustryGfx.

Parameters:

  | tile | that is queried

Precondition:
  IsTileType(tile, MP_INDUSTRY)

Returns:
  general type for this industry, as defined in industry.h

Definition at line 98 of file industry_cmd.cpp.

References GetIndustryByTile(), IsTileType(), Industry::IsValid(), MP_INDUSTRY, and Industry::type.

Referenced by GetFloodingBehaviour(), and IsWateredTile().

static bool IsIndustryCompleted | ( | TileIndex | t | ) | `[inline, static]`

Is this industry tile fully built?

Parameters:

  | t | the tile to analyze

Precondition:
  IsTileType(t, MP_INDUSTRY)

Returns:
  true if and only if the industry tile is fully built

Definition at line 82 of file industry_map.h.

References _m, HasBit(), IsTileType(), and MP_INDUSTRY.

Referenced by ChopLumberMillTrees(), and GetIndustryConstructionStage().

static void MakeIndustry | ( | TileIndex | t,
|  | IndustryID | index,
|  | IndustryGfx | gfx,
|  | uint8 | random |
| ) |  |  | `[inline, static]`

Make the given tile an industry tile.

Parameters:

  | t | the tile to make an industry tile
  | index | the industry this tile belongs to
  | gfx | the graphics to use for the tile
  | random | the random value

Definition at line 164 of file industry_map.h.

References _m, _me, Tile::m1, Tile::m2, Tile::m3, Tile::m4, TileExtended::m7, MP_INDUSTRY, SetIndustryGfx(), and SetTileType().

static void ResetIndustryConstructionStage | ( | TileIndex | tile | ) | `[inline, static]`

Reset the construction stage counter of the industry, as well as the completion bit.

In fact, it is the same as restarting construction frmo ground up

Parameters:

  | tile | the tile to query

Precondition:
  IsTileType(tile, MP_INDUSTRY)

Definition at line 206 of file industry_map.h.

References _m, IsTileType(), MP_INDUSTRY, and SB().

static void SetIndustryAnimationLoop | ( | TileIndex | tile,
|  | byte | count |
| ) |  |  | `[inline, static]`

Set the animation loop number.

Parameters:

  | tile | the tile to set the animation loop number of
  | count | the new animation frame number

Precondition:
  IsTileType(tile, MP_INDUSTRY)

Definition at line 230 of file industry_map.h.

References _m, IsTileType(), Tile::m4, and MP_INDUSTRY.

static void SetIndustryAnimationState | ( | TileIndex | tile,
|  | byte | state |
| ) |  |  | `[inline, static]`

Set the animation state.

Parameters:

  | tile | the tile to set the animation state of
  | state | the new animation state

Precondition:
  IsTileType(tile, MP_INDUSTRY)

Definition at line 253 of file industry_map.h.

References _m, IsTileType(), Tile::m3, and MP_INDUSTRY.

static void SetIndustryCompleted | ( | TileIndex | tile,
|  | bool | isCompleted |
| ) |  |  | `[inline, static]`

Set if the industry that owns the tile as under construction or not.

Parameters:

  | tile | the tile to query
  | isCompleted | whether it is completed or not

Precondition:
  IsTileType(tile, MP_INDUSTRY)

Definition at line 96 of file industry_map.h.

References _m, IsTileType(), MP_INDUSTRY, and SB().

static void SetIndustryConstructionCounter | ( | TileIndex | tile,
|  | byte | value |
| ) |  |  | `[inline, static]`

Sets this indutry tile's construction counter value.

Parameters:

  | tile | the tile to query
  | value | the new value for the construction counter

Precondition:
  IsTileType(tile, MP_INDUSTRY)

Definition at line 193 of file industry_map.h.

References _m, IsTileType(), MP_INDUSTRY, and SB().

static void SetIndustryConstructionStage | ( | TileIndex | tile,
|  | byte | value |
| ) |  |  | `[inline, static]`

Sets the industry construction stage of the specified tile.

Parameters:

  | tile | the tile to query
  | value | the new construction stage

Precondition:
  IsTileType(tile, MP_INDUSTRY)

Definition at line 120 of file industry_map.h.

References _m, IsTileType(), MP_INDUSTRY, and SB().

static void SetIndustryGfx | ( | TileIndex | t,
|  | IndustryGfx | gfx |
| ) |  |  | `[inline, static]`

Set the industry graphics ID for the given industry tile.

Parameters:

  | t | the tile to set the gfx for

Precondition:
  IsTileType(t, MP_INDUSTRY)

Parameters:

  | gfx | the graphics ID

Definition at line 150 of file industry_map.h.

References _m, GB(), IsTileType(), Tile::m5, MP_INDUSTRY, and SB().

Referenced by MakeIndustry().

static void SetIndustryRandomBits | ( | TileIndex | tile,
|  | byte | bits |
| ) |  |  | `[inline, static]`

Set the random bits for this tile.

Used for grf callbacks

Parameters:

  | tile | TileIndex of the tile to query
  | bits | the random bits

Precondition:
  IsTileType(tile, MP_INDUSTRY)

Definition at line 279 of file industry_map.h.

References _me, IsTileType(), TileExtended::m7, and MP_INDUSTRY.

static void SetIndustryTriggers | ( | TileIndex | tile,
|  | byte | triggers |
| ) |  |  | `[inline, static]`

Set the activated triggers bits for this industry tile Used for grf callbacks.

Parameters:

  | tile | TileIndex of the tile to query
  | triggers | the triggers to set

Precondition:
  IsTileType(tile, MP_INDUSTRY)

Definition at line 306 of file industry_map.h.

References _m, IsTileType(), MP_INDUSTRY, and SB().