12 #ifndef BASE_MEDIA_BASE_H 13 #define BASE_MEDIA_BASE_H 47 template <
class T,
size_t Tnum_files,
bool Tsearch_in_tars>
52 static const size_t NUM_FILES = Tnum_files;
55 static const bool SEARCH_IN_TARS = Tsearch_in_tars;
82 for (uint i = 0; i < NUM_FILES; i++) {
96 return Tnum_files - this->found_files;
106 return Tnum_files - this->valid_files;
109 bool FillSetDetails(
IniFile *ini,
const char *path,
const char *full_filename,
bool allow_empty_filename =
true);
121 if (isocode != NULL) {
124 if (strcmp(iter->first, isocode) == 0)
return iter->second;
128 if (strncmp(iter->first, isocode, 2) == 0)
return iter->second;
132 return this->description.
Begin()->second;
146 return file->
CheckMD5(subdir, SIZE_MAX);
156 for (uint i = 0; i < NUM_FILES; i++) {
158 if (textfile != NULL) {
170 template <
class Tbase_set>
177 bool AddFile(
const char *
filename,
size_t basepath_length,
const char *tar_filename);
183 static const char *GetExtension();
193 static bool DetermineBestSet();
201 return num + fs.
Scan(GetExtension(),
BASESET_DIR, Tbase_set::SEARCH_IN_TARS);
204 static Tbase_set *GetAvailableSets();
206 static bool SetSet(
const char *name);
207 static char *GetSetsList(
char *p,
const char *last);
208 static int GetNumSets();
209 static int GetIndexOfUsedSet();
210 static const Tbase_set *GetSet(
int index);
211 static const Tbase_set *GetUsedSet();
219 static bool HasSet(
const ContentInfo *ci,
bool md5sum);
229 template <
class Tbase_set>
254 bool FillSetDetails(
struct IniFile *ini,
const char *path,
const char *full_filename);
290 bool FillSetDetails(
struct IniFile *ini,
const char *path,
const char *full_filename);
Old subdirectory for the music.
uint32 shortname
Four letter short variant of the name.
Subdirectory
The different kinds of subdirectories OpenTTD uses.
static const char *const * file_names
Internal names of the files in this set.
Structure holding filename and MD5 information about a single file.
int GetNumInvalid() const
Get the number of invalid files.
uint Scan(const char *extension, Subdirectory sd, bool tars=true, bool recursive=true)
Scan for files with the given extension in the given search path.
const T * Begin() const
Get the pointer to the first item (const)
PaletteType palette
Palette of this graphics set.
Functions for Standard In/Out file operations.
TranslatedStrings description
Description of the base set.
All data/functions related with replacing the base sounds.
Subdirectory for all base data (base sets, intro game)
int GetNumMissing() const
Get the number of missing files.
const T * End() const
Get the pointer behind the last valid item (const)
The file did exist, just the md5 checksum did not match.
~BaseSet()
Free everything we allocated.
const char * missing_warning
warning when this file is missing
Helper for scanning for files with a given name.
Simple mapping class targeted for small sets of data.
const char * filename
filename
const char * GetDescription(const char *isocode=NULL) const
Get the description for the given ISO code.
const char * name
The name of the base set.
All data/functions related with replacing the base graphics.
TextfileType
Additional text files accompanying Tar archives.
BlitterType blitter
Blitter of this graphics set.
All data/functions related with replacing the base music.
uint32 version
The version of this base set.
ChecksumResult CheckMD5(Subdirectory subdir, size_t max_size) const
Calculate and check the MD5 hash of the supplied filename.
bool fallback
This set is a fallback set, i.e. it should be used only as last resort.
uint found_files
Number of the files that could be found.
Ini file that supports both loading and saving.
const char * GetTextfile(TextfileType type) const
Search a textfile file next to this base media.
uint valid_files
Number of the files that could be found and are valid.
The file did exist and the md5 checksum did match.
All data of a sounds set.
All data of a graphics set.
ChecksumResult
The result of a checksum check.
PaletteType
Palettes OpenTTD supports.
Information about a single base set.
static void free(const void *ptr)
Version of the standard free that accepts const pointers.
static MD5File::ChecksumResult CheckMD5(const MD5File *file, Subdirectory subdir)
Calculate and check the MD5 hash of the supplied file.
const char * GetTextfile(TextfileType type, Subdirectory dir, const char *filename)
Search a textfile file next to the given content.
Types related to textfiles.
Container for all important information about a piece of content.
Types related to the graphics and/or input devices.
uint8 hash[16]
md5 sum of the file
Old subdirectory for the data.
GUI functions related to textfiles.