OpenTTD Source: src/base_media_base.h File Reference

OpenTTD Source 15.0-RC2

Data Structures | Functions
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, std::span< const std::unique_ptr< Tbase_set > > sets)
| 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,
|  | std::span< const std::unique_ptr< Tbase_set > > | sets
| ) |  |

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

Parameters

  ci | The content info to compare it to.
  md5sum | Should the MD5 checksum be tested as well?
  s | The 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 328 of file base_media_func.h.

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

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