OpenTTD Source 20241224-master-gf74b0cf984
GrfProcessingState Struct Reference

Temporary data during loading of GRFs. More...

Data Structures

struct  SpriteSet
 Definition of a single Action1 spriteset. More...
 

Public Member Functions

void ClearDataForNextFile ()
 Clear temporary data before processing the next file in the current loading stage.
 
void AddSpriteSets (uint8_t feature, SpriteID first_sprite, uint first_set, uint numsets, uint numents)
 Records new spritesets.
 
bool HasValidSpriteSets (uint8_t feature) const
 Check whether there are any valid spritesets for a feature.
 
bool IsValidSpriteSet (uint8_t feature, uint set) const
 Check whether a specific set is defined.
 
SpriteID GetSprite (uint8_t feature, uint set) const
 Returns the first sprite of a spriteset.
 
uint GetNumEnts (uint8_t feature, uint set) const
 Returns the number of sprites in a spriteset.
 

Data Fields

GrfLoadingStage stage
 Current loading stage.
 
SpriteID spriteid
 First available SpriteID for loading realsprites.
 
SpriteFilefile
 File of currently processed GRF file.
 
GRFFilegrffile
 Currently processed GRF file.
 
GRFConfiggrfconfig
 Config of the currently processed GRF file.
 
uint32_t nfo_line
 Currently processed pseudo sprite number in the GRF.
 
int skip_sprites
 Number of pseudo sprites to skip before processing the next one. (-1 to skip to end of file)
 
const SpriteGroupspritegroups [MAX_SPRITEGROUP+1]
 

Private Attributes

std::map< uint, SpriteSetspritesets [GSF_END]
 Currently referenceable spritesets.
 

Detailed Description

Temporary data during loading of GRFs.

Definition at line 89 of file newgrf.cpp.

Member Function Documentation

◆ AddSpriteSets()

void GrfProcessingState::AddSpriteSets ( uint8_t  feature,
SpriteID  first_sprite,
uint  first_set,
uint  numsets,
uint  numents 
)
inline

Records new spritesets.

Parameters
featureGrfSpecFeature the set is defined for.
first_spriteSpriteID of the first sprite in the set.
first_setFirst spriteset to define.
numsetsNumber of sets to define.
numentsNumber of sprites per set to define.

Definition at line 138 of file newgrf.cpp.

References GrfProcessingState::SpriteSet::num_sprites, and GrfProcessingState::SpriteSet::sprite.

◆ ClearDataForNextFile()

void GrfProcessingState::ClearDataForNextFile ( )
inline

Clear temporary data before processing the next file in the current loading stage.

Definition at line 118 of file newgrf.cpp.

Referenced by LoadNewGRF(), and LoadNewGRFFileFromFile().

◆ GetNumEnts()

uint GrfProcessingState::GetNumEnts ( uint8_t  feature,
uint  set 
) const
inline

Returns the number of sprites in a spriteset.

Parameters
featureGrfSpecFeature to query.
setSet to query.
Returns
Number of sprites in the set.

Definition at line 191 of file newgrf.cpp.

References IsValidSpriteSet().

Referenced by CreateGroupFromGroupID(), and ReadSpriteLayoutSprite().

◆ GetSprite()

SpriteID GrfProcessingState::GetSprite ( uint8_t  feature,
uint  set 
) const
inline

Returns the first sprite of a spriteset.

Parameters
featureGrfSpecFeature to query.
setSet to query.
Returns
First sprite of the set.

Definition at line 179 of file newgrf.cpp.

References IsValidSpriteSet().

Referenced by CreateGroupFromGroupID(), and ReadSpriteLayoutSprite().

◆ HasValidSpriteSets()

bool GrfProcessingState::HasValidSpriteSets ( uint8_t  feature) const
inline

Check whether there are any valid spritesets for a feature.

Parameters
featureGrfSpecFeature to check.
Returns
true if there are any valid sets.
Note
Spritesets with zero sprites are valid to allow callback-failures.

Definition at line 154 of file newgrf.cpp.

◆ IsValidSpriteSet()

bool GrfProcessingState::IsValidSpriteSet ( uint8_t  feature,
uint  set 
) const
inline

Check whether a specific set is defined.

Parameters
featureGrfSpecFeature to check.
setSet to check.
Returns
true if the set is valid.
Note
Spritesets with zero sprites are valid to allow callback-failures.

Definition at line 167 of file newgrf.cpp.

Referenced by CreateGroupFromGroupID(), GetNumEnts(), GetSprite(), and ReadSpriteLayoutSprite().

Field Documentation

◆ file

SpriteFile* GrfProcessingState::file

File of currently processed GRF file.

Definition at line 106 of file newgrf.cpp.

Referenced by DefineGotoLabel(), ImportGRFSound(), LoadFontGlyph(), LoadGRFSound(), and LoadNewGRFFileFromFile().

◆ grfconfig

◆ grffile

◆ nfo_line

uint32_t GrfProcessingState::nfo_line

Currently processed pseudo sprite number in the GRF.

Definition at line 109 of file newgrf.cpp.

Referenced by DefineGotoLabel(), DisableGrf(), GrfMsgI(), LoadFontGlyph(), LoadNewGRFFileFromFile(), and ParamSet().

◆ skip_sprites

int GrfProcessingState::skip_sprites

Number of pseudo sprites to skip before processing the next one. (-1 to skip to end of file)

Definition at line 112 of file newgrf.cpp.

Referenced by DisableGrf(), GRFUnsafe(), LoadNewGRFFileFromFile(), ParamSet(), ReadSpriteLayout(), SkipAct12(), and StationChangeInfo().

◆ spritegroups

const SpriteGroup* GrfProcessingState::spritegroups[MAX_SPRITEGROUP+1]

Definition at line 115 of file newgrf.cpp.

◆ spriteid

SpriteID GrfProcessingState::spriteid

First available SpriteID for loading realsprites.

Definition at line 103 of file newgrf.cpp.

Referenced by CreateGroupFromGroupID(), LoadFontGlyph(), LoadNewGRF(), and ParamSet().

◆ spritesets

std::map<uint, SpriteSet> GrfProcessingState::spritesets[GSF_END]
private

Currently referenceable spritesets.

Definition at line 98 of file newgrf.cpp.

◆ stage

GrfLoadingStage GrfProcessingState::stage

Current loading stage.

Definition at line 102 of file newgrf.cpp.

Referenced by LoadNewGRF(), and ParamSet().


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