OpenTTD Source 20260421-master-gc2fbc6fdeb
GraphicsSet Struct Reference

All data of a graphics set. More...

#include <base_media_graphics.h>

Inheritance diagram for GraphicsSet:
BaseSet< GraphicsSet >

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
 Checks whether this set has configuration options.
void CopyCompatibleConfig (const GraphicsSet &src)
Public Member Functions inherited from BaseSet< GraphicsSet >
std::span< const std::string_view > GetFilenames ()
 Get the internal names of the files in this set.
std::span< const std::string_view > GetFilenames ()
 Make sure we aren't messing things up.
std::span< const std::string_view > GetFilenames ()
 Get the internal names of the files in this set.
virtual ~BaseSet ()=default
 Ensure the destructor of the sub classes are called as well.
int GetNumMissing () const
 Get the number of missing files.
int GetNumInvalid () const
 Get the number of invalid files.
void LogError (std::string_view full_filename, std::string_view detail, int level=0) const
 Log error from reading basesets.
const IniItemGetMandatoryItem (std::string_view full_filename, const IniGroup &group, std::string_view name) const
 Try to read a single piece of metadata and return nullptr if it doesn't exist.
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)
 Copy settings from the given set into this set when they are compatible.
const std::string & GetDescription (std::string_view isocode) const
 Get the description for the given ISO code.
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 >
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 >
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.
std::vector< 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.
std::array< MD5File, BaseSet< GraphicsSet >::NUM_FILESfiles
 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.

Private Attributes

std::unique_ptr< GRFConfigextra_cfg
 Parameters for extra GRF.

Additional Inherited Members

Public Types inherited from BaseSet< GraphicsSet >
using TranslatedStrings
 Mapping of translations: language -> string.
Static Public Attributes inherited from BaseSet< GraphicsSet >
static constexpr size_t NUM_FILES
 Number of files in this set.
static constexpr bool SEARCH_IN_TARS
 Whether to search in the tars or not.
static constexpr std::string_view SET_TYPE
 BaseSet type name.

Detailed Description

All data of a graphics set.

Definition at line 42 of file base_media_graphics.h.

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

Definition at line 426 of file gfxinit.cpp.

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

Referenced by CheckExternalFiles().

◆ CopyCompatibleConfig()

void GraphicsSet::CopyCompatibleConfig ( const GraphicsSet & src)

Definition at line 408 of file gfxinit.cpp.

◆ FillSetDetails()

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

Definition at line 354 of file gfxinit.cpp.

◆ GetExtraConfig()

GRFConfig * GraphicsSet::GetExtraConfig ( ) const
inline

Definition at line 53 of file base_media_graphics.h.

◆ GetOrCreateExtraConfig()

GRFConfig & GraphicsSet::GetOrCreateExtraConfig ( ) const

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

Returns
NewGRF configuration

Definition at line 377 of file gfxinit.cpp.

References Baseset, DOS, extra_cfg, BaseSet< GraphicsSet >::files, FillGRFDetails(), GFT_EXTRA, GRFP_GRF_DOS, GRFP_GRF_WINDOWS, palette, and Windows.

Referenced by IsConfigurable(), and openttd_main().

◆ IsConfigurable()

bool GraphicsSet::IsConfigurable ( ) const

Checks whether this set has configuration options.

Returns
true iff there are parameters for this graphics set.

Definition at line 400 of file gfxinit.cpp.

References GetOrCreateExtraConfig(), and GRFConfig::param_info.

Field Documentation

◆ blitter

BlitterType GraphicsSet::blitter {}

Blitter of this graphics set.

Definition at line 47 of file base_media_graphics.h.

Referenced by SwitchNewGRFBlitter().

◆ extra_cfg

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

Parameters for extra GRF.

Definition at line 44 of file base_media_graphics.h.

Referenced by GetOrCreateExtraConfig().

◆ palette

PaletteType GraphicsSet::palette {}

Palette of this graphics set.

Definition at line 46 of file base_media_graphics.h.

Referenced by BaseMedia< GraphicsSet >::DetermineBestSet(), GetOrCreateExtraConfig(), and LoadSpriteTables().


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