OpenTTD
Enumerations | Functions
industry_map.h File Reference

Accessors for industries. More...

#include "industrytype.h"
#include "water_map.h"

Go to the source code of this file.

Enumerations

enum  IndustryGraphics {
  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. More...
 
static bool IsIndustryCompleted (TileIndex t)
 Is this industry tile fully built? More...
 
IndustryType GetIndustryType (TileIndex tile)
 Retrieve the type for this industry. More...
 
static void SetIndustryCompleted (TileIndex tile)
 Set if the industry that owns the tile as under construction or not. More...
 
static byte GetIndustryConstructionStage (TileIndex tile)
 Returns the industry construction stage of the specified tile. More...
 
static void SetIndustryConstructionStage (TileIndex tile, byte value)
 Sets the industry construction stage of the specified tile. More...
 
static IndustryGfx GetCleanIndustryGfx (TileIndex t)
 Get the industry graphics ID for the given industry tile as stored in the without translation. More...
 
static IndustryGfx GetIndustryGfx (TileIndex t)
 Get the industry graphics ID for the given industry tile. More...
 
static void SetIndustryGfx (TileIndex t, IndustryGfx gfx)
 Set the industry graphics ID for the given industry tile. More...
 
static byte GetIndustryConstructionCounter (TileIndex tile)
 Returns this industry tile's construction counter value. More...
 
static void SetIndustryConstructionCounter (TileIndex tile, byte value)
 Sets this industry tile's construction counter value. More...
 
static void ResetIndustryConstructionStage (TileIndex tile)
 Reset the construction stage counter of the industry, as well as the completion bit. More...
 
static byte GetIndustryAnimationLoop (TileIndex tile)
 Get the animation loop number. More...
 
static void SetIndustryAnimationLoop (TileIndex tile, byte count)
 Set the animation loop number. More...
 
static byte GetIndustryRandomBits (TileIndex tile)
 Get the random bits for this tile. More...
 
static void SetIndustryRandomBits (TileIndex tile, byte bits)
 Set the random bits for this tile. More...
 
static byte GetIndustryTriggers (TileIndex tile)
 Get the activated triggers bits for this industry tile Used for grf callbacks. More...
 
static void SetIndustryTriggers (TileIndex tile, byte triggers)
 Set the activated triggers bits for this industry tile Used for grf callbacks. More...
 
static void MakeIndustry (TileIndex t, IndustryID index, IndustryGfx gfx, uint8 random, WaterClass wc)
 Make the given tile an industry tile. More...
 

Detailed Description

Accessors for industries.

Definition in file industry_map.h.

Enumeration Type Documentation

◆ IndustryGraphics

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 24 of file industry_map.h.

Function Documentation

◆ GetCleanIndustryGfx()

static IndustryGfx GetCleanIndustryGfx ( TileIndex  t)
inlinestatic

Get the industry graphics ID for the given industry tile as stored in the without translation.

Parameters
tthe tile to get the gfx for
Precondition
IsTileType(t, MP_INDUSTRY)
Returns
the gfx ID

Definition at line 127 of file industry_map.h.

Referenced by GetIndustryIDAtOffset().

◆ GetIndustryAnimationLoop()

static byte GetIndustryAnimationLoop ( TileIndex  tile)
inlinestatic

Get the animation loop number.

Parameters
tilethe tile to get the animation loop number of
Precondition
IsTileType(tile, MP_INDUSTRY)

Definition at line 201 of file industry_map.h.

◆ GetIndustryConstructionCounter()

static byte GetIndustryConstructionCounter ( TileIndex  tile)
inlinestatic

Returns this industry tile's construction counter value.

Parameters
tilethe tile to query
Precondition
IsTileType(tile, MP_INDUSTRY)
Returns
the construction counter

Definition at line 164 of file industry_map.h.

◆ GetIndustryConstructionStage()

static byte GetIndustryConstructionStage ( TileIndex  tile)
inlinestatic

Returns the industry construction stage of the specified tile.

Parameters
tilethe tile to query
Precondition
IsTileType(tile, MP_INDUSTRY)
Returns
the construction stage

Definition at line 102 of file industry_map.h.

Referenced by IndustryTileScopeResolver::GetVariable().

◆ GetIndustryGfx()

static IndustryGfx GetIndustryGfx ( TileIndex  t)
inlinestatic

Get the industry graphics ID for the given industry tile.

Parameters
tthe tile to get the gfx for
Precondition
IsTileType(t, MP_INDUSTRY)
Returns
the gfx ID

Definition at line 139 of file industry_map.h.

Referenced by NIHIndustryTile::GetGRFID(), NIHIndustryTile::GetSpec(), NIHIndustryTile::IsInspectable(), and NIHIndustryTile::Resolve().

◆ GetIndustryIndex()

static IndustryID GetIndustryIndex ( TileIndex  t)
inlinestatic

Get the industry ID of the given tile.

Parameters
tthe tile to get the industry ID from
Precondition
IsTileType(t, MP_INDUSTRY)
Returns
the industry ID

Definition at line 65 of file industry_map.h.

Referenced by Industry::GetByTile(), GetNearbyIndustryTileInformation(), NIHIndustryTile::SetStringParameters(), and Industry::TileBelongsToIndustry().

◆ GetIndustryRandomBits()

static byte GetIndustryRandomBits ( TileIndex  tile)
inlinestatic

Get the random bits for this tile.

Used for grf callbacks

Parameters
tileTileIndex of the tile to query
Precondition
IsTileType(tile, MP_INDUSTRY)
Returns
requested bits

Definition at line 226 of file industry_map.h.

◆ GetIndustryTriggers()

static byte GetIndustryTriggers ( TileIndex  tile)
inlinestatic

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

Parameters
tileTileIndex of the tile to query
Precondition
IsTileType(tile, MP_INDUSTRY)
Returns
requested triggers

Definition at line 252 of file industry_map.h.

◆ GetIndustryType()

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
tilethat is queried
Precondition
IsTileType(tile, MP_INDUSTRY)
Returns
general type for this industry, as defined in industry.h

Definition at line 99 of file industry_cmd.cpp.

Referenced by FindNearIndustryName().

◆ IsIndustryCompleted()

static bool IsIndustryCompleted ( TileIndex  t)
inlinestatic

Is this industry tile fully built?

Parameters
tthe tile to analyze
Precondition
IsTileType(t, MP_INDUSTRY)
Returns
true if and only if the industry tile is fully built

Definition at line 77 of file industry_map.h.

Referenced by ChopLumberMillTrees().

◆ MakeIndustry()

static void MakeIndustry ( TileIndex  t,
IndustryID  index,
IndustryGfx  gfx,
uint8  random,
WaterClass  wc 
)
inlinestatic

Make the given tile an industry tile.

Parameters
tthe tile to make an industry tile
indexthe industry this tile belongs to
gfxthe graphics to use for the tile
randomthe random value
wcthe water class for this industry; only useful when build on water

Definition at line 280 of file industry_map.h.

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

◆ ResetIndustryConstructionStage()

static void ResetIndustryConstructionStage ( TileIndex  tile)
inlinestatic

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
tilethe tile to query
Precondition
IsTileType(tile, MP_INDUSTRY)

Definition at line 189 of file industry_map.h.

◆ SetIndustryAnimationLoop()

static void SetIndustryAnimationLoop ( TileIndex  tile,
byte  count 
)
inlinestatic

Set the animation loop number.

Parameters
tilethe tile to set the animation loop number of
countthe new animation frame number
Precondition
IsTileType(tile, MP_INDUSTRY)

Definition at line 213 of file industry_map.h.

◆ SetIndustryCompleted()

static void SetIndustryCompleted ( TileIndex  tile)
inlinestatic

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

Parameters
tilethe tile to query
Precondition
IsTileType(tile, MP_INDUSTRY)

Definition at line 90 of file industry_map.h.

◆ SetIndustryConstructionCounter()

static void SetIndustryConstructionCounter ( TileIndex  tile,
byte  value 
)
inlinestatic

Sets this industry tile's construction counter value.

Parameters
tilethe tile to query
valuethe new value for the construction counter
Precondition
IsTileType(tile, MP_INDUSTRY)

Definition at line 176 of file industry_map.h.

◆ SetIndustryConstructionStage()

static void SetIndustryConstructionStage ( TileIndex  tile,
byte  value 
)
inlinestatic

Sets the industry construction stage of the specified tile.

Parameters
tilethe tile to query
valuethe new construction stage
Precondition
IsTileType(tile, MP_INDUSTRY)

Definition at line 114 of file industry_map.h.

◆ SetIndustryGfx()

static void SetIndustryGfx ( TileIndex  t,
IndustryGfx  gfx 
)
inlinestatic

Set the industry graphics ID for the given industry tile.

Parameters
tthe tile to set the gfx for
Precondition
IsTileType(t, MP_INDUSTRY)
Parameters
gfxthe graphics ID

Definition at line 151 of file industry_map.h.

Referenced by MakeIndustry().

◆ SetIndustryRandomBits()

static void SetIndustryRandomBits ( TileIndex  tile,
byte  bits 
)
inlinestatic

Set the random bits for this tile.

Used for grf callbacks

Parameters
tileTileIndex of the tile to query
bitsthe random bits
Precondition
IsTileType(tile, MP_INDUSTRY)

Definition at line 239 of file industry_map.h.

Referenced by MakeIndustry().

◆ SetIndustryTriggers()

static void SetIndustryTriggers ( TileIndex  tile,
byte  triggers 
)
inlinestatic

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

Parameters
tileTileIndex of the tile to query
triggersthe triggers to set
Precondition
IsTileType(tile, MP_INDUSTRY)

Definition at line 266 of file industry_map.h.

Referenced by MakeIndustry().