OpenTTD Source 20250509-master-gb1cdf5024f
NewGRFSpriteLayout Struct Reference

NewGRF supplied spritelayout. More...

#include <newgrf_commons.h>

Inheritance diagram for NewGRFSpriteLayout:
DrawTileSprites

Public Member Functions

void Allocate (uint num_sprites)
 Allocate a spritelayout for num_sprites building sprites.
 
void AllocateRegisters ()
 Allocate memory for register modifiers.
 
bool NeedsPreprocessing () const
 Tests whether this spritelayout needs preprocessing by SpriteLayoutProcessor, or whether it can be used directly.
 
std::span< const DrawTileSeqStructGetSequence () const override
 
- Public Member Functions inherited from DrawTileSprites
 DrawTileSprites (PalSpriteID ground)
 

Data Fields

std::vector< DrawTileSeqStructseq {}
 
std::vector< TileLayoutRegistersregisters {}
 
uint consistent_max_offset = 0
 Number of sprites in all referenced spritesets.
 
- Data Fields inherited from DrawTileSprites
PalSpriteID ground {}
 Palette and sprite for the ground.
 

Detailed Description

NewGRF supplied spritelayout.

In contrast to DrawTileSprites this struct is for allocated layouts on the heap. It allocates data and frees them on destruction.

Definition at line 114 of file newgrf_commons.h.

Member Function Documentation

◆ Allocate()

void NewGRFSpriteLayout::Allocate ( uint  num_sprites)

Allocate a spritelayout for num_sprites building sprites.

Parameters
num_spritesNumber of building sprites to allocate memory for. (not counting the terminator)

Definition at line 570 of file newgrf_commons.cpp.

Referenced by ReadSpriteLayout().

◆ AllocateRegisters()

void NewGRFSpriteLayout::AllocateRegisters ( )

Allocate memory for register modifiers.

Definition at line 580 of file newgrf_commons.cpp.

Referenced by ReadSpriteLayout(), and ReadSpriteLayoutRegisters().

◆ GetSequence()

std::span< const DrawTileSeqStruct > NewGRFSpriteLayout::GetSequence ( ) const
inlineoverridevirtual

Implements DrawTileSprites.

Definition at line 137 of file newgrf_commons.h.

◆ NeedsPreprocessing()

bool NewGRFSpriteLayout::NeedsPreprocessing ( ) const
inline

Tests whether this spritelayout needs preprocessing by SpriteLayoutProcessor, or whether it can be used directly.

Returns
true if preprocessing is needed

Definition at line 132 of file newgrf_commons.h.

Referenced by DrawStationTile(), and TileLayoutSpriteGroup::ProcessRegisters().

Field Documentation

◆ consistent_max_offset

uint NewGRFSpriteLayout::consistent_max_offset = 0

Number of sprites in all referenced spritesets.

If these numbers are inconsistent, then this is 0 and the real values are in registers.

Definition at line 122 of file newgrf_commons.h.

Referenced by TileLayoutSpriteGroup::ProcessRegisters(), ReadSpriteLayout(), and StationChangeInfo().

◆ registers

std::vector<TileLayoutRegisters> NewGRFSpriteLayout::registers {}

Definition at line 116 of file newgrf_commons.h.

◆ seq

std::vector<DrawTileSeqStruct> NewGRFSpriteLayout::seq {}

Definition at line 115 of file newgrf_commons.h.


The documentation for this struct was generated from the following files: