OpenTTD Source 20241224-master-gf74b0cf984
GraphicsSet Struct Reference

All data of a graphics set. More...

#include <base_media_base.h>

Inheritance diagram for GraphicsSet:
BaseSet< GraphicsSet, MAX_GFT, true >

Public Member Functions

bool FillSetDetails (const IniFile &ini, const std::string &path, const std::string &full_filename)
 
GRFConfigGetExtraConfig () const
 
GRFConfigGetOrCreateExtraConfig () const
 Return configuration for the extra GRF, or lazily create it.
 
bool IsConfigurable () const
 
void CopyCompatibleConfig (const GraphicsSet &src)
 
- Public Member Functions inherited from BaseSet< GraphicsSet, MAX_GFT, true >
 ~BaseSet ()
 Free everything we allocated.
 
int GetNumMissing () const
 Get the number of missing files.
 
int GetNumInvalid () const
 Get the number of invalid files.
 
bool FillSetDetails (const IniFile &ini, const std::string &path, const std::string &full_filename, bool allow_empty_filename=true)
 Read the set information from a loaded ini.
 
void CopyCompatibleConfig (const GraphicsSet &src)
 
const std::string & GetDescription (const std::string &isocode) const
 Get the description for the given ISO code.
 
std::string GetListLabel () const
 Get string to use when listing this set in the settings window.
 
std::optional< std::string > GetTextfile (TextfileType type) const
 Search a textfile file next to this base media.
 

Static Public Member Functions

static MD5File::ChecksumResult CheckMD5 (const MD5File *file, Subdirectory subdir)
 Calculate and check the MD5 hash of the supplied GRF.
 
- Static Public Member Functions inherited from BaseSet< GraphicsSet, MAX_GFT, true >
static MD5File::ChecksumResult CheckMD5 (const MD5File *file, Subdirectory subdir)
 Calculate and check the MD5 hash of the supplied file.
 

Data Fields

PaletteType palette
 Palette of this graphics set.
 
BlitterType blitter
 Blitter of this graphics set.
 
- Data Fields inherited from BaseSet< GraphicsSet, MAX_GFT, true >
std::string name
 The name of the base set.
 
std::string url
 URL for information about the base set.
 
TranslatedStrings description
 Description of the base set.
 
uint32_t shortname
 Four letter short variant of the name.
 
uint32_t version
 The version of this base set.
 
bool fallback
 This set is a fallback set, i.e. it should be used only as last resort.
 
MD5File files [NUM_FILES]
 All files part of this set.
 
uint found_files
 Number of the files that could be found.
 
uint valid_files
 Number of the files that could be found and are valid.
 
GraphicsSetnext
 The next base set in this list.
 

Private Attributes

std::unique_ptr< GRFConfigextra_cfg
 Parameters for extra GRF.
 

Additional Inherited Members

- Public Types inherited from BaseSet< GraphicsSet, MAX_GFT, true >
typedef std::unordered_map< std::string, std::string > TranslatedStrings
 
- Static Public Attributes inherited from BaseSet< GraphicsSet, MAX_GFT, true >
static const size_t NUM_FILES
 Number of files in this set.
 
static const bool SEARCH_IN_TARS
 Whether to search in the tars or not.
 
static const char *const * file_names
 Internal names of the files in this set.
 

Detailed Description

All data of a graphics set.

Definition at line 260 of file base_media_base.h.

Constructor & Destructor Documentation

◆ GraphicsSet()

GraphicsSet::GraphicsSet ( )

Definition at line 337 of file gfxinit.cpp.

◆ ~GraphicsSet()

GraphicsSet::~GraphicsSet ( )

Definition at line 343 of file gfxinit.cpp.

Member Function Documentation

◆ CheckMD5()

MD5File::ChecksumResult GraphicsSet::CheckMD5 ( const MD5File file,
Subdirectory  subdir 
)
static

Calculate and check the MD5 hash of the supplied GRF.

Parameters
fileThe file get the hash of.
subdirThe sub directory to get the files from.
Returns
  • #CR_MATCH if the MD5 hash matches
  • #CR_MISMATCH if the MD5 does not match
  • #CR_NO_FILE if the file misses

Definition at line 415 of file gfxinit.cpp.

References MD5File::CheckMD5(), MD5File::CR_NO_FILE, MD5File::filename, FioFOpenFile(), and GRFGetSizeOfDataSection().

Referenced by CheckExternalFiles().

◆ CopyCompatibleConfig()

void GraphicsSet::CopyCompatibleConfig ( const GraphicsSet src)

Definition at line 397 of file gfxinit.cpp.

◆ FillSetDetails()

bool GraphicsSet::FillSetDetails ( const IniFile ini,
const std::string &  path,
const std::string &  full_filename 
)

Definition at line 348 of file gfxinit.cpp.

◆ GetExtraConfig()

GRFConfig * GraphicsSet::GetExtraConfig ( ) const
inline

Definition at line 271 of file base_media_base.h.

◆ GetOrCreateExtraConfig()

GRFConfig & GraphicsSet::GetOrCreateExtraConfig ( ) const

Return configuration for the extra GRF, or lazily create it.

Returns
NewGRF configuration

Definition at line 370 of file gfxinit.cpp.

References BASESET_DIR, extra_cfg, BaseSet< GraphicsSet, MAX_GFT, true >::files, FillGRFDetails(), GFT_EXTRA, GRFP_GRF_DOS, GRFP_GRF_WINDOWS, PAL_DOS, PAL_WINDOWS, and palette.

Referenced by openttd_main().

◆ IsConfigurable()

bool GraphicsSet::IsConfigurable ( ) const

Definition at line 389 of file gfxinit.cpp.

Field Documentation

◆ blitter

BlitterType GraphicsSet::blitter

Blitter of this graphics set.

Definition at line 265 of file base_media_base.h.

Referenced by SwitchNewGRFBlitter().

◆ extra_cfg

std::unique_ptr<GRFConfig> GraphicsSet::extra_cfg
mutableprivate

Parameters for extra GRF.

Definition at line 262 of file base_media_base.h.

Referenced by GetOrCreateExtraConfig().

◆ palette

PaletteType GraphicsSet::palette

Palette of this graphics set.

Definition at line 264 of file base_media_base.h.

Referenced by GetOrCreateExtraConfig(), and LoadSpriteTables().


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