OpenTTD Source
20241121-master-g67a0fccfad
|
NewGRF handling of industry tiles. More...
#include "stdafx.h"
#include "debug.h"
#include "landscape.h"
#include "newgrf_industrytiles.h"
#include "newgrf_sound.h"
#include "industry.h"
#include "town.h"
#include "command_func.h"
#include "water.h"
#include "newgrf_animation_base.h"
#include "table/strings.h"
#include "safeguards.h"
Go to the source code of this file.
Data Structures | |
struct | IndustryAnimationBase |
Helper class for animation control. More... | |
Functions | |
uint32_t | GetNearbyIndustryTileInformation (uint8_t parameter, TileIndex tile, IndustryID index, bool signed_offsets, bool grf_version8) |
Based on newhouses equivalent, but adapted for newindustries. More... | |
uint32_t | GetRelativePosition (TileIndex tile, TileIndex ind_tile) |
This is the position of the tile relative to the northernmost tile of the industry. More... | |
static const GRFFile * | GetIndTileGrffile (IndustryGfx gfx) |
Get the associated NewGRF file from the industry graphics. More... | |
static void | IndustryDrawTileLayout (const TileInfo *ti, const TileLayoutSpriteGroup *group, uint8_t rnd_colour, uint8_t stage) |
uint16_t | GetIndustryTileCallback (CallbackID callback, uint32_t param1, uint32_t param2, IndustryGfx gfx_id, Industry *industry, TileIndex tile) |
bool | DrawNewIndustryTile (TileInfo *ti, Industry *i, IndustryGfx gfx, const IndustryTileSpec *inds) |
bool | IsSlopeRefused (Slope current, Slope refused) |
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. More... | |
uint16_t | GetSimpleIndustryCallback (CallbackID callback, uint32_t param1, uint32_t param2, const IndustryTileSpec *spec, Industry *ind, TileIndex tile, int) |
void | AnimateNewIndustryTile (TileIndex tile) |
bool | StartStopIndustryTileAnimation (TileIndex tile, IndustryAnimationTrigger iat, uint32_t random) |
bool | StartStopIndustryTileAnimation (const Industry *ind, IndustryAnimationTrigger iat) |
static void | DoTriggerIndustryTile (TileIndex tile, IndustryTileTrigger trigger, Industry *ind, uint32_t &reseed_industry) |
Trigger random triggers for an industry tile and reseed its random bits. More... | |
static void | DoReseedIndustry (Industry *ind, uint32_t reseed) |
Reseeds the random bits of an industry. More... | |
void | TriggerIndustryTile (TileIndex tile, IndustryTileTrigger trigger) |
Trigger a random trigger for a single industry tile. More... | |
void | TriggerIndustry (Industry *ind, IndustryTileTrigger trigger) |
Trigger a random trigger for all industry tiles. More... | |
NewGRF handling of industry tiles.
Definition in file newgrf_industrytiles.cpp.
|
static |
Reseeds the random bits of an industry.
ind | Industry. |
reseed | Bits to reseed. |
Definition at line 345 of file newgrf_industrytiles.cpp.
Referenced by TriggerIndustry(), and TriggerIndustryTile().
|
static |
Trigger random triggers for an industry tile and reseed its random bits.
tile | Industry tile to trigger. | |
trigger | Trigger to trigger. | |
ind | Industry of the tile. | |
[in,out] | reseed_industry | Collects bits to reseed for the industry. |
Definition at line 310 of file newgrf_industrytiles.cpp.
References CBID_RANDOM_TRIGGER, GetIndustryGfx(), GetIndustryTileSpec(), GetIndustryTriggers(), IndustryTileSpec::grf_prop, IsTileType(), IsValidTile(), MP_INDUSTRY, SpriteGroup::Resolve(), SetIndustryTriggers(), and GRFFilePropsBase< Tcnt >::spritegroup.
Referenced by TriggerIndustry(), and TriggerIndustryTile().
|
static |
Get the associated NewGRF file from the industry graphics.
gfx | Graphics to query. |
Definition at line 123 of file newgrf_industrytiles.cpp.
References GetIndustryTileSpec(), IndustryTileSpec::grf_prop, and GRFFilePropsBase< Tcnt >::grffile.
uint32_t GetNearbyIndustryTileInformation | ( | uint8_t | parameter, |
TileIndex | tile, | ||
IndustryID | index, | ||
bool | signed_offsets, | ||
bool | grf_version8 | ||
) |
Based on newhouses equivalent, but adapted for newindustries.
parameter | from callback. It's in fact a pair of coordinates |
tile | TileIndex from which the callback was initiated |
index | of the industry been queried for |
signed_offsets | Are the x and y offset encoded in parameter signed? |
grf_version8 | True, if we are dealing with a new NewGRF which uses GRF version >= 8. |
Definition at line 34 of file newgrf_industrytiles.cpp.
References GetIndustryIndex(), GetNearbyTile(), GetNearbyTileInformation(), IsTileType(), and MP_INDUSTRY.
Referenced by IndustryTileScopeResolver::GetVariable().
This is the position of the tile relative to the northernmost tile of the industry.
Format: 00yxYYXX Variable Content x the x offset from the northernmost tile XX same, but stored in a byte instead of a nibble y the y offset from the northernmost tile YY same, but stored in a byte instead of a nibble
tile | TileIndex of the tile to evaluate |
ind_tile | northernmost tile of the industry |
Definition at line 53 of file newgrf_industrytiles.cpp.
Referenced by AirportTileScopeResolver::GetVariable(), and IndustryTileScopeResolver::GetVariable().
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.
ind_base_tile | Base tile of the industry. |
ind_tile | Tile to check. |
its | Tile specification. |
type | Industry type. |
gfx | Gfx of the tile. |
layout_index | Layout. |
initial_random_bits | Random bits of industry after construction |
founder | Industry founder |
creation_type | The circumstances the industry is created under. |
Definition at line 230 of file newgrf_industrytiles.cpp.
void TriggerIndustry | ( | Industry * | ind, |
IndustryTileTrigger | trigger | ||
) |
Trigger a random trigger for all industry tiles.
ind | Industry to trigger. |
trigger | Trigger to trigger. |
Definition at line 372 of file newgrf_industrytiles.cpp.
References DoReseedIndustry(), DoTriggerIndustryTile(), Industry::location, and Industry::TileBelongsToIndustry().
void TriggerIndustryTile | ( | TileIndex | tile, |
IndustryTileTrigger | trigger | ||
) |
Trigger a random trigger for a single industry tile.
tile | Industry tile to trigger. |
trigger | Trigger to trigger. |
Definition at line 359 of file newgrf_industrytiles.cpp.
References DoReseedIndustry(), DoTriggerIndustryTile(), and Industry::GetByTile().