OpenTTD Source: NewGRFSpriteLayout Struct Reference

OpenTTD Source 15.0-RC2

Public Member Functions | Data Fields
NewGRFSpriteLayout Struct Reference

NewGRF supplied spritelayout. More...

`#include <newgrf_commons.h>`

Inheritance diagram for NewGRFSpriteLayout:

## 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 DrawTileSeqStruct > | GetSequence () const override
Public Member Functions inherited from DrawTileSprites
| DrawTileSprites (PalSpriteID ground)

## Data Fields
std::vector< DrawTileSeqStruct > | seq {}
std::vector< TileLayoutRegisters > | registers {}
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 113 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_sprites | Number of building sprites to allocate memory for. (not counting the terminator)

Definition at line 576 of file newgrf_commons.cpp.

Referenced by ReadSpriteLayout().

## ◆ AllocateRegisters()

void NewGRFSpriteLayout::AllocateRegisters | ( |  | ) |

Allocate memory for register modifiers.

Definition at line 586 of file newgrf_commons.cpp.

Referenced by ReadSpriteLayout(), and ReadSpriteLayoutRegisters().

## ◆ GetSequence()

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

Implements DrawTileSprites.

Definition at line 136 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 131 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 121 of file newgrf_commons.h.

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

## ◆ registers

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

Definition at line 115 of file newgrf_commons.h.

## ◆ seq

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

Definition at line 114 of file newgrf_commons.h.

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

- src/newgrf_commons.h
- src/newgrf_commons.cpp