OpenTTD Source: FixedGRFFileProps< Tkey, Tcount > Struct Template Reference

OpenTTD Source 15.0-RC2

Public Member Functions | Data Fields
FixedGRFFileProps< Tkey, Tcount > Struct Template Reference

Fixed-length list of sprite groups for an entity. More...

`#include <newgrf_commons.h>`

Inheritance diagram for FixedGRFFileProps< Tkey, Tcount >:

## Public Member Functions
const struct SpriteGroup * | GetSpriteGroup (Tkey index) const
| Get the SpriteGroup at the specified index.
const struct SpriteGroup * | GetFirstSpriteGroupOf (std::initializer_list< Tkey > indices) const
| Get the first existing SpriteGroup from a list of options.
void | SetSpriteGroup (Tkey index, const struct SpriteGroup *spritegroup)
| Set the SpriteGroup at the specified index.
Public Member Functions inherited from GRFFilePropsBase
void | SetGRFFile (const struct GRFFile *grffile)
| Set the NewGRF file, and its grfid, associated with grf props.
bool | HasGrfFile () const
| Test if this entity was introduced by NewGRF.

## Data Fields
std::array< const struct SpriteGroup *, Tcount > | spritegroups {}
| pointers to the different sprite groups of the entity
Data Fields inherited from GRFFilePropsBase
uint16_t | local_id = 0
| id defined by the grf file for this entity
uint32_t | grfid = 0
| grfid that introduced this entity.
const struct GRFFile * | grffile = nullptr
| grf file that introduced this entity

## Detailed Description

template<class Tkey, size_t Tcount>
struct FixedGRFFileProps< Tkey, Tcount >

Fixed-length list of sprite groups for an entity.

Template Parameters

  Tkey | Key for indexing spritegroups
  Tcount | Number of spritegroups

Definition at line 335 of file newgrf_commons.h.

## Member Function Documentation

## ◆ GetFirstSpriteGroupOf()

template<class Tkey , size_t Tcount>

const struct SpriteGroup * FixedGRFFileProps< Tkey, Tcount >::GetFirstSpriteGroupOf | ( | std::initializer_list< Tkey > | indices | ) | const
| inline

Get the first existing SpriteGroup from a list of options.

Parameters

  indices | Valid options.

Returns
  First existing, or nullptr if none exists.

Definition at line 350 of file newgrf_commons.h.

References FixedGRFFileProps< Tkey, Tcount >::GetSpriteGroup().

## ◆ GetSpriteGroup()

template<class Tkey , size_t Tcount>

const struct SpriteGroup * FixedGRFFileProps< Tkey, Tcount >::GetSpriteGroup | ( | Tkey | index | ) | const
| inline

Get the SpriteGroup at the specified index.

Parameters

  index | Index to get.

Returns
  SpriteGroup at index, or nullptr if not present.

Definition at line 343 of file newgrf_commons.h.

References FixedGRFFileProps< Tkey, Tcount >::spritegroups.

Referenced by FixedGRFFileProps< Tkey, Tcount >::GetFirstSpriteGroupOf().

## ◆ SetSpriteGroup()

template<class Tkey , size_t Tcount>

void FixedGRFFileProps< Tkey, Tcount >::SetSpriteGroup | ( | Tkey | index,
|  | const struct SpriteGroup * | spritegroup
| ) |  |
| inline

Set the SpriteGroup at the specified index.

Parameters

  index | Index to set.
  spritegroup | SpriteGroup to set.

Definition at line 364 of file newgrf_commons.h.

References FixedGRFFileProps< Tkey, Tcount >::spritegroups.

## Field Documentation

## ◆ spritegroups

template<class Tkey , size_t Tcount>

std::array<const struct SpriteGroup *, Tcount> FixedGRFFileProps< Tkey, Tcount >::spritegroups {}

pointers to the different sprite groups of the entity

Definition at line 336 of file newgrf_commons.h.

Referenced by FixedGRFFileProps< Tkey, Tcount >::GetSpriteGroup(), and FixedGRFFileProps< Tkey, Tcount >::SetSpriteGroup().

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

- src/newgrf_commons.h