Codechange: use std::string for base media filename/warning storage
This commit is contained in:
@@ -31,9 +31,9 @@ struct MD5File {
|
||||
CR_NO_FILE, ///< The file did not exist
|
||||
};
|
||||
|
||||
const char *filename; ///< filename
|
||||
std::string filename; ///< filename
|
||||
uint8 hash[16]; ///< md5 sum of the file
|
||||
const char *missing_warning; ///< warning when this file is missing
|
||||
std::string missing_warning; ///< warning when this file is missing
|
||||
ChecksumResult check_result; ///< cached result of md5 check
|
||||
|
||||
ChecksumResult CheckMD5(Subdirectory subdir, size_t max_size) const;
|
||||
@@ -73,11 +73,6 @@ struct BaseSet {
|
||||
/** Free everything we allocated */
|
||||
~BaseSet()
|
||||
{
|
||||
for (uint i = 0; i < NUM_FILES; i++) {
|
||||
free(this->files[i].filename);
|
||||
free(this->files[i].missing_warning);
|
||||
}
|
||||
|
||||
delete this->next;
|
||||
}
|
||||
|
||||
@@ -100,7 +95,7 @@ struct BaseSet {
|
||||
return Tnum_files - this->valid_files;
|
||||
}
|
||||
|
||||
bool FillSetDetails(IniFile *ini, const char *path, const char *full_filename, bool allow_empty_filename = true);
|
||||
bool FillSetDetails(IniFile *ini, const std::string &path, const std::string &full_filename, bool allow_empty_filename = true);
|
||||
|
||||
/**
|
||||
* Get the description for the given ISO code.
|
||||
@@ -147,7 +142,7 @@ struct BaseSet {
|
||||
const char *GetTextfile(TextfileType type) const
|
||||
{
|
||||
for (uint i = 0; i < NUM_FILES; i++) {
|
||||
const char *textfile = ::GetTextfile(type, BASESET_DIR, this->files[i].filename);
|
||||
const char *textfile = ::GetTextfile(type, BASESET_DIR, this->files[i].filename.c_str());
|
||||
if (textfile != nullptr) {
|
||||
return textfile;
|
||||
}
|
||||
@@ -249,7 +244,7 @@ struct GraphicsSet : BaseSet<GraphicsSet, MAX_GFT, true> {
|
||||
PaletteType palette; ///< Palette of this graphics set
|
||||
BlitterType blitter; ///< Blitter of this graphics set
|
||||
|
||||
bool FillSetDetails(struct IniFile *ini, const char *path, const char *full_filename);
|
||||
bool FillSetDetails(struct IniFile *ini, const std::string &path, const std::string &full_filename);
|
||||
|
||||
static MD5File::ChecksumResult CheckMD5(const MD5File *file, Subdirectory subdir);
|
||||
};
|
||||
@@ -279,8 +274,8 @@ static const uint NUM_SONGS_AVAILABLE = 1 + NUM_SONG_CLASSES * NUM_SONGS_CLASS;
|
||||
static const uint NUM_SONGS_PLAYLIST = 32;
|
||||
|
||||
/* Functions to read DOS music CAT files, similar to but not quite the same as sound effect CAT files */
|
||||
char *GetMusicCatEntryName(const char *filename, size_t entrynum);
|
||||
byte *GetMusicCatEntryData(const char *filename, size_t entrynum, size_t &entrylen);
|
||||
char *GetMusicCatEntryName(const std::string &filename, size_t entrynum);
|
||||
byte *GetMusicCatEntryData(const std::string &filename, size_t entrynum, size_t &entrylen);
|
||||
|
||||
enum MusicTrackType {
|
||||
MTT_STANDARDMIDI, ///< Standard MIDI file
|
||||
@@ -291,7 +286,7 @@ enum MusicTrackType {
|
||||
struct MusicSongInfo {
|
||||
std::string songname; ///< name of song displayed in UI
|
||||
byte tracknr; ///< track number of song displayed in UI
|
||||
const char *filename; ///< file on disk containing song (when used in MusicSet class, this pointer is owned by MD5File object for the file)
|
||||
std::string filename; ///< file on disk containing song (when used in MusicSet class)
|
||||
MusicTrackType filetype; ///< decoder required for song file
|
||||
int cat_index; ///< entry index in CAT file, for filetype==MTT_MPSMIDI
|
||||
bool loop; ///< song should play in a tight loop if possible, never ending
|
||||
@@ -306,7 +301,7 @@ struct MusicSet : BaseSet<MusicSet, NUM_SONGS_AVAILABLE, false> {
|
||||
/** Number of valid songs in set. */
|
||||
byte num_available;
|
||||
|
||||
bool FillSetDetails(struct IniFile *ini, const char *path, const char *full_filename);
|
||||
bool FillSetDetails(struct IniFile *ini, const std::string &path, const std::string &full_filename);
|
||||
};
|
||||
|
||||
/** All data/functions related with replacing the base music */
|
||||
|
Reference in New Issue
Block a user