OpenTTD Source 20250428-master-g68ba2735ea
|
Information about a single base set. More...
#include <base_media_base.h>
Public Types | |
typedef std::unordered_map< std::string, std::string, StringHash, std::equal_to<> > | TranslatedStrings |
Public Member Functions | |
~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 T &src) |
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 file. | |
static std::span< const std::string_view > | GetFilenames () |
Get the internal names of the files in this set. | |
Data Fields | |
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 = 0 |
Four letter short variant of the name. | |
uint32_t | version = 0 |
The version of this base set. | |
bool | fallback = false |
This set is a fallback set, i.e. it should be used only as last resort. | |
std::array< MD5File, BaseSet< T >::NUM_FILES > | files {} |
All files part of this set. | |
uint | found_files = 0 |
Number of the files that could be found. | |
uint | valid_files = 0 |
Number of the files that could be found and are valid. | |
T * | next = nullptr |
The next base set in this list. | |
Static Public Attributes | |
static constexpr size_t | NUM_FILES = BaseSetTraits<T>::num_files |
Number of files in this set. | |
static constexpr bool | SEARCH_IN_TARS = BaseSetTraits<T>::search_in_tars |
Whether to search in the tars or not. | |
static constexpr std::string_view | SET_TYPE = BaseSetTraits<T>::set_type |
BaseSet type name. | |
Information about a single base set.
T | the real class we're going to be |
Definition at line 49 of file base_media_base.h.
typedef std::unordered_map<std::string, std::string, StringHash, std::equal_to<> > BaseSet< T >::TranslatedStrings |
Definition at line 50 of file base_media_base.h.
Free everything we allocated.
Definition at line 75 of file base_media_base.h.
References BaseSet< T >::next.
|
inlinestatic |
Calculate and check the MD5 hash of the supplied file.
file | The file get the hash of. |
subdir | The sub directory to get the files from. |
Definition at line 134 of file base_media_base.h.
References MD5File::CheckMD5().
|
inline |
Definition at line 100 of file base_media_base.h.
bool BaseSet< T >::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.
ini | the ini to read from |
path | the path to this ini file (for filenames) |
full_filename | the full filename of the loaded file (for error reporting purposes) |
allow_empty_filename | empty filenames are valid |
Definition at line 41 of file base_media_func.h.
References Debug, fetch_metadata, MD5File::filename, BaseSet< T >::GetFilenames(), IniLoadFile::GetGroup(), IniGroup::GetItem(), IniGroup::items, and IniItem::value.
|
inline |
Get the description for the given ISO code.
It falls back to the first two characters of the ISO code in case no match could be made with the full ISO code. If even then the matching fails the default is returned.
isocode | the isocode to search for |
Definition at line 110 of file base_media_base.h.
|
static |
Get the internal names of the files in this set.
Referenced by BaseSet< T >::FillSetDetails().
|
inline |
Get the number of invalid files.
Definition at line 94 of file base_media_base.h.
References BaseSet< T >::valid_files.
Referenced by CheckExternalFiles().
|
inline |
Get the number of missing files.
Definition at line 84 of file base_media_base.h.
References BaseSet< T >::found_files.
|
inline |
Search a textfile file next to this base media.
type | The type of the textfile to search for. |
Definition at line 144 of file base_media_base.h.
References BASESET_DIR, BaseSet< T >::files, and BaseSet< T >::GetTextfile().
Referenced by BaseSet< T >::GetTextfile().
TranslatedStrings BaseSet< T >::description |
Description of the base set.
Definition at line 63 of file base_media_base.h.
bool BaseSet< T >::fallback = false |
This set is a fallback set, i.e. it should be used only as last resort.
Definition at line 66 of file base_media_base.h.
std::array<MD5File, BaseSet<T>::NUM_FILES> BaseSet< T >::files {} |
All files part of this set.
Definition at line 68 of file base_media_base.h.
Referenced by CheckExternalFiles(), BaseSet< T >::GetTextfile(), and LoadSpriteTables().
uint BaseSet< T >::found_files = 0 |
Number of the files that could be found.
Definition at line 69 of file base_media_base.h.
Referenced by BaseSet< T >::GetNumMissing().
std::string BaseSet< T >::name |
The name of the base set.
Definition at line 61 of file base_media_base.h.
Referenced by CheckExternalFiles(), and GraphicsSetSaveConfig().
T* BaseSet< T >::next = nullptr |
The next base set in this list.
Definition at line 72 of file base_media_base.h.
Referenced by BaseSet< T >::~BaseSet().
|
staticconstexpr |
Number of files in this set.
Definition at line 53 of file base_media_base.h.
|
staticconstexpr |
Whether to search in the tars or not.
Definition at line 56 of file base_media_base.h.
|
staticconstexpr |
BaseSet type name.
Definition at line 59 of file base_media_base.h.
uint32_t BaseSet< T >::shortname = 0 |
Four letter short variant of the name.
Definition at line 64 of file base_media_base.h.
Referenced by GraphicsSetSaveConfig().
std::string BaseSet< T >::url |
URL for information about the base set.
Definition at line 62 of file base_media_base.h.
uint BaseSet< T >::valid_files = 0 |
Number of the files that could be found and are valid.
Definition at line 70 of file base_media_base.h.
Referenced by BaseSet< T >::GetNumInvalid().
uint32_t BaseSet< T >::version = 0 |
The version of this base set.
Definition at line 65 of file base_media_base.h.