OpenTTD Source 20250502-master-ge0a9c7d818
base_media_base.h File Reference

Generic functions for replacing base data (graphics, sounds). More...

#include "fileio_func.h"
#include "textfile_type.h"
#include "textfile_gui.h"
#include "3rdparty/md5/md5.h"
#include <unordered_map>

Go to the source code of this file.

Data Structures

struct  MD5File
 Structure holding filename and MD5 information about a single file. More...
 
struct  BaseSet< T >
 Information about a single base set. More...
 
class  BaseMedia< Tbase_set >
 Base for all base media (graphics, sounds) More...
 

Functions

template<class Tbase_set >
std::optional< std::string_view > TryGetBaseSetFile (const ContentInfo &ci, bool md5sum, const Tbase_set *s)
 Check whether there's a base set matching some information.
 

Detailed Description

Generic functions for replacing base data (graphics, sounds).

Definition in file base_media_base.h.

Function Documentation

◆ TryGetBaseSetFile()

template<class Tbase_set >
std::optional< std::string_view > TryGetBaseSetFile ( const ContentInfo ci,
bool  md5sum,
const Tbase_set *  s 
)

Check whether there's a base set matching some information.

Parameters
ciThe content info to compare it to.
md5sumShould the MD5 checksum be tested as well?
sThe list with sets.
Returns
The filename of the first file of the base set, or std::nullopt if there is no match.

Definition at line 345 of file base_media_func.h.

References MD5File::hash, ContentInfo::md5sum, and ContentInfo::unique_id.

Referenced by ContentInfo::GetTextfile(), and BaseMedia< Tbase_set >::HasSet().