OpenTTD Source 20241224-master-gf74b0cf984
newgrf_industrytiles.h File Reference

NewGRF handling of industry tiles. More...

Go to the source code of this file.

Data Structures

struct  IndustryTileScopeResolver
 Resolver for the industry tiles scope. More...
 
struct  IndustryTileResolverObject
 Resolver for industry tiles. More...
 

Enumerations

enum  IndustryTileTrigger { INDTILE_TRIGGER_TILE_LOOP = 0x01 , INDUSTRY_TRIGGER_INDUSTRY_TICK = 0x02 , INDUSTRY_TRIGGER_RECEIVED_CARGO = 0x04 }
 Available industry tile triggers. More...
 

Functions

bool DrawNewIndustryTile (TileInfo *ti, Industry *i, IndustryGfx gfx, const IndustryTileSpec *inds)
 
uint16_t GetIndustryTileCallback (CallbackID callback, uint32_t param1, uint32_t param2, IndustryGfx gfx_id, Industry *industry, TileIndex tile)
 
CommandCost PerformIndustryTileSlopeCheck (TileIndex ind_base_tile, TileIndex ind_tile, const IndustryTileSpec *its, IndustryType type, IndustryGfx gfx, size_t layout_index, uint16_t initial_random_bits, Owner founder, IndustryAvailabilityCallType creation_type)
 Check the slope of a tile of a new industry.
 
void AnimateNewIndustryTile (TileIndex tile)
 
bool StartStopIndustryTileAnimation (TileIndex tile, IndustryAnimationTrigger iat, uint32_t random=Random())
 
bool StartStopIndustryTileAnimation (const Industry *ind, IndustryAnimationTrigger iat)
 
void TriggerIndustryTile (TileIndex t, IndustryTileTrigger trigger)
 Trigger a random trigger for a single industry tile.
 
void TriggerIndustry (Industry *ind, IndustryTileTrigger trigger)
 Trigger a random trigger for all industry tiles.
 

Detailed Description

NewGRF handling of industry tiles.

Definition in file newgrf_industrytiles.h.

Enumeration Type Documentation

◆ IndustryTileTrigger

Available industry tile triggers.

Enumerator
INDTILE_TRIGGER_TILE_LOOP 

The tile of the industry has been triggered during the tileloop.

INDUSTRY_TRIGGER_INDUSTRY_TICK 

The industry has been triggered via its tick.

INDUSTRY_TRIGGER_RECEIVED_CARGO 

Cargo has been delivered.

Definition at line 70 of file newgrf_industrytiles.h.

Function Documentation

◆ AnimateNewIndustryTile()

void AnimateNewIndustryTile ( TileIndex  tile)

Definition at line 268 of file newgrf_industrytiles.cpp.

◆ DrawNewIndustryTile()

bool DrawNewIndustryTile ( TileInfo ti,
Industry i,
IndustryGfx  gfx,
const IndustryTileSpec inds 
)

Definition at line 190 of file newgrf_industrytiles.cpp.

◆ GetIndustryTileCallback()

uint16_t GetIndustryTileCallback ( CallbackID  callback,
uint32_t  param1,
uint32_t  param2,
IndustryGfx  gfx_id,
Industry industry,
TileIndex  tile 
)

Definition at line 181 of file newgrf_industrytiles.cpp.

◆ PerformIndustryTileSlopeCheck()

CommandCost PerformIndustryTileSlopeCheck ( TileIndex  ind_base_tile,
TileIndex  ind_tile,
const IndustryTileSpec its,
IndustryType  type,
IndustryGfx  gfx,
size_t  layout_index,
uint16_t  initial_random_bits,
Owner  founder,
IndustryAvailabilityCallType  creation_type 
)

Check the slope of a tile of a new industry.

Parameters
ind_base_tileBase tile of the industry.
ind_tileTile to check.
itsTile specification.
typeIndustry type.
gfxGfx of the tile.
layout_indexLayout.
initial_random_bitsRandom bits of industry after construction
founderIndustry founder
creation_typeThe circumstances the industry is created under.
Returns
Succeeded or failed command.

Definition at line 230 of file newgrf_industrytiles.cpp.

References CALLBACK_FAILED, CBID_INDTILE_SHAPE_CHECK, Industry::founder, GetErrorMessageFromLocationCallbackResult(), GetTileSlope(), IndustryTileSpec::grf_prop, GRFFilePropsBase< Tcnt >::grffile, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Industry::location, Industry::random, IndustryTileSpec::slopes_refused, OrthogonalTileArea::tile, Industry::type, and OrthogonalTileArea::w.

Referenced by CheckIfIndustryTileSlopes().

◆ StartStopIndustryTileAnimation() [1/2]

bool StartStopIndustryTileAnimation ( const Industry ind,
IndustryAnimationTrigger  iat 
)

Definition at line 286 of file newgrf_industrytiles.cpp.

◆ StartStopIndustryTileAnimation() [2/2]

bool StartStopIndustryTileAnimation ( TileIndex  tile,
IndustryAnimationTrigger  iat,
uint32_t  random = Random() 
)

Definition at line 276 of file newgrf_industrytiles.cpp.

◆ TriggerIndustry()

void TriggerIndustry ( Industry ind,
IndustryTileTrigger  trigger 
)

Trigger a random trigger for all industry tiles.

Parameters
indIndustry to trigger.
triggerTrigger to trigger.

Definition at line 372 of file newgrf_industrytiles.cpp.

References DoReseedIndustry(), DoTriggerIndustryTile(), Industry::location, and Industry::TileBelongsToIndustry().

Referenced by TriggerIndustryProduction().

◆ TriggerIndustryTile()

void TriggerIndustryTile ( TileIndex  tile,
IndustryTileTrigger  trigger 
)

Trigger a random trigger for a single industry tile.

Parameters
tileIndustry tile to trigger.
triggerTrigger to trigger.

Definition at line 359 of file newgrf_industrytiles.cpp.

References DoReseedIndustry(), DoTriggerIndustryTile(), and Industry::GetByTile().