OpenTTD Source 20250506-master-g22fedca77e
VariableGRFFileProps< Tkey > Struct Template Reference

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

#include <newgrf_commons.h>

Inheritance diagram for VariableGRFFileProps< Tkey >:
GRFFilePropsBase

Public Types

using ValueType = std::pair< Tkey, const struct SpriteGroup * >
 

Public Member Functions

const SpriteGroupGetSpriteGroup (Tkey index) const
 Get the SpriteGroup at the specified index.
 
const struct SpriteGroupGetFirstSpriteGroupOf (std::initializer_list< Tkey > indices) const
 Get the first existing SpriteGroup from a list of options.
 
void SetSpriteGroup (Tkey index, const 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::vector< ValueType > 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 GRFFilegrffile = nullptr
 grf file that introduced this entity
 

Detailed Description

template<class Tkey>
struct VariableGRFFileProps< Tkey >

Variable-length list of sprite groups for an entity.

Template Parameters
TkeyKey for indexing spritegroups

Definition at line 407 of file newgrf_commons.h.

Member Typedef Documentation

◆ ValueType

template<class Tkey >
using VariableGRFFileProps< Tkey >::ValueType = std::pair<Tkey, const struct SpriteGroup *>

Definition at line 408 of file newgrf_commons.h.

Member Function Documentation

◆ GetFirstSpriteGroupOf()

template<class Tkey >
const struct SpriteGroup * VariableGRFFileProps< Tkey >::GetFirstSpriteGroupOf ( std::initializer_list< Tkey >  indices) const
inline

Get the first existing SpriteGroup from a list of options.

Parameters
indicesValid options.
Returns
First existing, or nullptr if none exists.

Definition at line 428 of file newgrf_commons.h.

References VariableGRFFileProps< Tkey >::GetSpriteGroup().

Referenced by BadgeResolverObject::BadgeResolverObject(), and VehicleResolverObject::VehicleResolverObject().

◆ GetSpriteGroup()

template<class Tkey >
const SpriteGroup * VariableGRFFileProps< Tkey >::GetSpriteGroup ( Tkey  index) const
inline

Get the SpriteGroup at the specified index.

Parameters
indexIndex to get.
Returns
SpriteGroup at index, or nullptr if not present.

Definition at line 416 of file newgrf_commons.h.

Referenced by VariableGRFFileProps< Tkey >::GetFirstSpriteGroupOf(), and StationResolverObject::StationResolverObject().

◆ SetSpriteGroup()

template<class Tkey >
void VariableGRFFileProps< Tkey >::SetSpriteGroup ( Tkey  index,
const SpriteGroup spritegroup 
)
inline

Set the SpriteGroup at the specified index.

Parameters
indexIndex to set.
spritegroupSpriteGroup to set.

Definition at line 442 of file newgrf_commons.h.

Field Documentation

◆ spritegroups

template<class Tkey >
std::vector<ValueType> VariableGRFFileProps< Tkey >::spritegroups

pointers to the different sprite groups of the entity

Definition at line 409 of file newgrf_commons.h.

Referenced by StationResolverObject::StationResolverObject().


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