This file simplyfies and embeds a common mechanism of loading/saving and mapping of grf entities. More...
#include "tile_type.h"
#include "sprite.h"
#include "core/alloc_type.hpp"
#include "core/smallvec_type.hpp"
Go to the source code of this file.
Data Structures | |
struct | TileLayoutRegisters |
Additional modifiers for items in sprite layouts. More... | |
struct | NewGRFSpriteLayout |
NewGRF supplied spritelayout. More... | |
struct | EntityIDMapping |
Maps an entity id stored on the map to a GRF file. More... | |
class | OverrideManagerBase |
class | HouseOverrideManager |
class | IndustryOverrideManager |
class | IndustryTileOverrideManager |
class | AirportOverrideManager |
class | AirportTileOverrideManager |
class | ObjectOverrideManager |
struct | GRFFilePropsBase< Tcnt > |
Data related to the handling of grf files. More... | |
struct | GRFFileProps |
Data related to the handling of grf files. More... | |
Enumerations | |
enum | TileContext { TCX_NORMAL, TCX_UPPER_HALFTILE, TCX_ON_BRIDGE } |
Context for tile accesses. More... | |
enum | TileLayoutFlags { TLF_NOTHING = 0x00, TLF_DODRAW = 0x01, TLF_SPRITE = 0x02, TLF_PALETTE = 0x04, TLF_CUSTOM_PALETTE = 0x08, TLF_BB_XY_OFFSET = 0x10, TLF_BB_Z_OFFSET = 0x20, TLF_CHILD_X_OFFSET = 0x10, TLF_CHILD_Y_OFFSET = 0x20, TLF_SPRITE_VAR10 = 0x40, TLF_PALETTE_VAR10 = 0x80, TLF_KNOWN_FLAGS = 0x7F, TLF_DRAWING_FLAGS = ~TLF_CUSTOM_PALETTE, TLF_NON_GROUND_FLAGS = TLF_BB_XY_OFFSET | TLF_BB_Z_OFFSET | TLF_CHILD_X_OFFSET | TLF_CHILD_Y_OFFSET, TLF_VAR10_FLAGS = TLF_SPRITE_VAR10 | TLF_PALETTE_VAR10, TLF_SPRITE_REG_FLAGS = TLF_DODRAW | TLF_SPRITE | TLF_BB_XY_OFFSET | TLF_BB_Z_OFFSET | TLF_CHILD_X_OFFSET | TLF_CHILD_Y_OFFSET, TLF_PALETTE_REG_FLAGS = TLF_PALETTE } |
Flags to enable register usage in sprite layouts. More... | |
Functions | |
uint32 | GetTerrainType (TileIndex tile, TileContext context=TCX_NORMAL) |
Function used by houses (and soon industries) to get information on type of "terrain" the tile it is queries sits on. | |
TileIndex | GetNearbyTile (byte parameter, TileIndex tile, bool signed_offsets=true) |
Get the tile at the given offset. | |
uint32 | GetNearbyTileInformation (TileIndex tile) |
Common part of station var 0x67, house var 0x62, indtile var 0x60, industry var 0x62. | |
Variables | |
static const uint | TLR_MAX_VAR10 = 7 |
Maximum value for var 10. | |
HouseOverrideManager | _house_mngr |
IndustryOverrideManager | _industry_mngr |
IndustryTileOverrideManager | _industile_mngr |
AirportOverrideManager | _airport_mngr |
AirportTileOverrideManager | _airporttile_mngr |
ObjectOverrideManager | _object_mngr |
The override manager for our objects. |
This file simplyfies and embeds a common mechanism of loading/saving and mapping of grf entities.
Definition in file newgrf_commons.h.
enum TileContext |
Context for tile accesses.
Definition at line 24 of file newgrf_commons.h.
enum TileLayoutFlags |
Flags to enable register usage in sprite layouts.
TLF_DODRAW |
Only draw sprite if value of register TileLayoutRegisters::dodraw is non-zero. |
TLF_SPRITE |
Add signed offset to sprite from register TileLayoutRegisters::sprite. |
TLF_PALETTE |
Add signed offset to palette from register TileLayoutRegisters::palette. |
TLF_CUSTOM_PALETTE |
Palette is from Action 1 (moved to SPRITE_MODIFIER_CUSTOM_SPRITE in palette during loading). |
TLF_BB_XY_OFFSET |
Add signed offset to bounding box X and Y positions from register TileLayoutRegisters::delta.parent[0..1]. |
TLF_BB_Z_OFFSET |
Add signed offset to bounding box Z positions from register TileLayoutRegisters::delta.parent[2]. |
TLF_CHILD_X_OFFSET |
Add signed offset to child sprite X positions from register TileLayoutRegisters::delta.child[0]. |
TLF_CHILD_Y_OFFSET |
Add signed offset to child sprite Y positions from register TileLayoutRegisters::delta.child[1]. |
TLF_SPRITE_VAR10 |
Resolve sprite with a specific value in variable 10. |
TLF_PALETTE_VAR10 |
Resolve palette with a specific value in variable 10. |
TLF_KNOWN_FLAGS |
Known flags. Any unknown set flag will disable the GRF. |
TLF_DRAWING_FLAGS |
Flags which are still required after loading the GRF. |
TLF_NON_GROUND_FLAGS |
Flags which do not work for the (first) ground sprite. |
TLF_VAR10_FLAGS |
Flags which refer to using multiple action-1-2-3 chains. |
TLF_SPRITE_REG_FLAGS |
Flags which require resolving the action-1-2-3 chain for the sprite, even if it is no action-1 sprite. |
TLF_PALETTE_REG_FLAGS |
Flags which require resolving the action-1-2-3 chain for the palette, even if it is no action-1 palette. |
Definition at line 33 of file newgrf_commons.h.
Get the tile at the given offset.
parameter | The NewGRF "encoded" offset. | |
tile | The tile to base the offset from. | |
signed_offsets | Whether the offsets are to be interpreted as signed or not. |
Definition at line 405 of file newgrf_commons.cpp.
References AXIS_Y, GB(), GetRailStationAxis(), HasStationTileRail(), Swap(), TILE_MASK, and TileDiffXY().
Referenced by GetNearbyAirportTileInformation(), GetNearbyIndustryTileInformation(), GetNearbyObjectTileInformation(), HouseGetVariable(), IndustryGetVariable(), and ObjectGetVariable().
uint32 GetNearbyTileInformation | ( | TileIndex | tile | ) |
Common part of station var 0x67, house var 0x62, indtile var 0x60, industry var 0x62.
tile | the tile of interest. |
Definition at line 426 of file newgrf_commons.cpp.
References GetTerrainType(), GetTileSlope(), GetTileType(), GetTreeGround(), IsTileType(), MP_TREES, MP_WATER, and TREE_GROUND_SHORE.
Referenced by GetNearbyAirportTileInformation(), GetNearbyIndustryTileInformation(), GetNearbyObjectTileInformation(), and HouseGetVariable().
uint32 GetTerrainType | ( | TileIndex | tile, | |
TileContext | context | |||
) |
Function used by houses (and soon industries) to get information on type of "terrain" the tile it is queries sits on.
tile | TileIndex of the tile been queried | |
context | The context of the tile. |
Definition at line 331 of file newgrf_commons.cpp.
References _generating_world, _settings_game, GameSettings::game_creation, GetBridgeHeight(), GetClearDensity(), GetSnowLine(), GetTileMaxZ(), GetTileType(), GetTileZ(), GetTreeDensity(), GetTreeGround(), GetTropicZone(), HasTunnelBridgeSnowOrDesert(), IsOnSnow(), IsSnowTile(), GameCreationSettings::landscape, MP_CLEAR, MP_HOUSE, MP_INDUSTRY, MP_OBJECT, MP_RAILWAY, MP_ROAD, MP_STATION, MP_TREES, MP_TUNNELBRIDGE, MP_VOID, MP_WATER, RAIL_GROUND_HALF_SNOW, RAIL_GROUND_ICE_DESERT, TCX_ON_BRIDGE, TCX_UPPER_HALFTILE, TREE_GROUND_ROUGH_SNOW, and TREE_GROUND_SNOW_DESERT.
Referenced by GetNearbyTileInformation(), HouseGetVariable(), and ObjectGetVariable().
The override manager for our objects.
Referenced by FinaliseObjectsArray(), and GetCountAndDistanceOfClosestInstance().