diff --git a/src/base_media_base.h b/src/base_media_base.h --- a/src/base_media_base.h +++ b/src/base_media_base.h @@ -108,10 +108,11 @@ struct BaseSet { * Read the set information from a loaded ini. * @param ini the ini to read from * @param path the path to this ini file (for filenames) + * @param full_filename the full filename of the loaded file (for error reporting purposes) * @param allow_empty_filename empty filenames are valid * @return true if loading was successful. */ - bool FillSetDetails(IniFile *ini, const char *path, bool allow_empty_filename = true); + bool FillSetDetails(IniFile *ini, const char *path, const char *full_filename, bool allow_empty_filename = true); /** * Get the description for the given ISO code. @@ -238,7 +239,7 @@ enum GraphicsFileType { struct GraphicsSet : BaseSet { PaletteType palette; ///< Palette of this graphics set - bool FillSetDetails(struct IniFile *ini, const char *path); + bool FillSetDetails(struct IniFile *ini, const char *path, const char *full_filename); }; /** All data/functions related with replacing the base graphics. */ @@ -276,7 +277,7 @@ struct MusicSet : BaseSet /* static */ #define fetch_metadata(name) \ item = metadata->GetItem(name, false); \ if (item == NULL || StrEmpty(item->value)) { \ - DEBUG(grf, 0, "Base " SET_TYPE "set detail loading: %s field missing", name); \ + DEBUG(grf, 0, "Base " SET_TYPE "set detail loading: %s field missing.", name); \ + DEBUG(grf, 0, " Is %s readable for the user running OpenTTD?", full_filename); \ return false; \ } template -bool BaseSet::FillSetDetails(IniFile *ini, const char *path, bool allow_empty_filename) +bool BaseSet::FillSetDetails(IniFile *ini, const char *path, const char *full_filename, bool allow_empty_filename) { memset(this, 0, sizeof(*this)); @@ -70,7 +71,7 @@ bool BaseSet::Fi /* Find the filename first. */ item = files->GetItem(BaseSet::file_names[i], false); if (item == NULL || (item->value == NULL && !allow_empty_filename)) { - DEBUG(grf, 0, "No " SET_TYPE " file for: %s", BaseSet::file_names[i]); + DEBUG(grf, 0, "No " SET_TYPE " file for: %s (in %s)", BaseSet::file_names[i], full_filename); return false; } @@ -88,7 +89,7 @@ bool BaseSet::Fi /* Then find the MD5 checksum */ item = md5s->GetItem(filename, false); if (item == NULL) { - DEBUG(grf, 0, "No MD5 checksum specified for: %s", filename); + DEBUG(grf, 0, "No MD5 checksum specified for: %s (in %s)", filename, full_filename); return false; } char *c = item->value; @@ -101,7 +102,7 @@ bool BaseSet::Fi } else if ('A' <= *c && *c <= 'F') { j = *c - 'A' + 10; } else { - DEBUG(grf, 0, "Malformed MD5 checksum specified for: %s", filename); + DEBUG(grf, 0, "Malformed MD5 checksum specified for: %s (in %s)", filename, full_filename); return false; } if (i % 2 == 0) { @@ -155,7 +156,7 @@ bool BaseMedia::AddFile(const *path = '\0'; } - if (set->FillSetDetails(ini, path)) { + if (set->FillSetDetails(ini, path, filename)) { Tbase_set *duplicate = NULL; for (Tbase_set *c = BaseMedia::available_sets; c != NULL; c = c->next) { if (strcmp(c->name, set->name) == 0 || c->shortname == set->shortname) { diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp --- a/src/gfxinit.cpp +++ b/src/gfxinit.cpp @@ -202,9 +202,9 @@ void GfxLoadSprites() GfxInitPalettes(); } -bool GraphicsSet::FillSetDetails(IniFile *ini, const char *path) +bool GraphicsSet::FillSetDetails(IniFile *ini, const char *path, const char *full_filename) { - bool ret = this->BaseSet::FillSetDetails(ini, path, false); + bool ret = this->BaseSet::FillSetDetails(ini, path, full_filename, false); if (ret) { IniGroup *metadata = ini->GetGroup("metadata"); IniItem *item; @@ -212,7 +212,7 @@ bool GraphicsSet::FillSetDetails(IniFile fetch_metadata("palette"); this->palette = (*item->value == 'D' || *item->value == 'd') ? PAL_DOS : PAL_WINDOWS; } - return true; + return ret; } diff --git a/src/music.cpp b/src/music.cpp --- a/src/music.cpp +++ b/src/music.cpp @@ -57,9 +57,9 @@ template return BaseMedia::used_set != NULL; } -bool MusicSet::FillSetDetails(IniFile *ini, const char *path) +bool MusicSet::FillSetDetails(IniFile *ini, const char *path, const char *full_filename) { - bool ret = this->BaseSet::FillSetDetails(ini, path); + bool ret = this->BaseSet::FillSetDetails(ini, path, full_filename); if (ret) { this->num_available = 0; IniGroup *names = ini->GetGroup("names"); @@ -93,5 +93,5 @@ bool MusicSet::FillSetDetails(IniFile *i this->num_available++; } } - return true; + return ret; }