summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/base_media_base.h7
-rw-r--r--src/base_media_func.h13
-rw-r--r--src/gfxinit.cpp6
-rw-r--r--src/music.cpp6
4 files changed, 17 insertions, 15 deletions
diff --git a/src/base_media_base.h b/src/base_media_base.h
index 88b78374b..4cf5ed8ed 100644
--- 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<GraphicsSet, MAX_GFT, DATA_DIR> {
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<MusicSet, NUM_SONGS_AVAILABLE, GM_DIR> {
byte track_nr[NUM_SONGS_AVAILABLE];
byte num_available;
- 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 music */
diff --git a/src/base_media_func.h b/src/base_media_func.h
index aa339452c..a6071f4f0 100644
--- a/src/base_media_func.h
+++ b/src/base_media_func.h
@@ -25,12 +25,13 @@ template <class Tbase_set> /* static */ Tbase_set *BaseMedia<Tbase_set>::availab
#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 <class T, size_t Tnum_files, Subdirectory Tsubdir>
-bool BaseSet<T, Tnum_files, Tsubdir>::FillSetDetails(IniFile *ini, const char *path, bool allow_empty_filename)
+bool BaseSet<T, Tnum_files, Tsubdir>::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<T, Tnum_files, Tsubdir>::FillSetDetails(IniFile *ini, const char *p
/* Find the filename first. */
item = files->GetItem(BaseSet<T, Tnum_files, Tsubdir>::file_names[i], false);
if (item == NULL || (item->value == NULL && !allow_empty_filename)) {
- DEBUG(grf, 0, "No " SET_TYPE " file for: %s", BaseSet<T, Tnum_files, Tsubdir>::file_names[i]);
+ DEBUG(grf, 0, "No " SET_TYPE " file for: %s (in %s)", BaseSet<T, Tnum_files, Tsubdir>::file_names[i], full_filename);
return false;
}
@@ -88,7 +89,7 @@ bool BaseSet<T, Tnum_files, Tsubdir>::FillSetDetails(IniFile *ini, const char *p
/* 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<T, Tnum_files, Tsubdir>::FillSetDetails(IniFile *ini, const char *p
} 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<Tbase_set>::AddFile(const char *filename, size_t basepath_length)
*path = '\0';
}
- if (set->FillSetDetails(ini, path)) {
+ if (set->FillSetDetails(ini, path, filename)) {
Tbase_set *duplicate = NULL;
for (Tbase_set *c = BaseMedia<Tbase_set>::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
index 6ba87eee1..42043299f 100644
--- 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<GraphicsSet, MAX_GFT, DATA_DIR>::FillSetDetails(ini, path, false);
+ bool ret = this->BaseSet<GraphicsSet, MAX_GFT, DATA_DIR>::FillSetDetails(ini, path, full_filename, false);
if (ret) {
IniGroup *metadata = ini->GetGroup("metadata");
IniItem *item;
@@ -212,7 +212,7 @@ bool GraphicsSet::FillSetDetails(IniFile *ini, const char *path)
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
index c4f15cc39..a6c8ea78f 100644
--- a/src/music.cpp
+++ b/src/music.cpp
@@ -57,9 +57,9 @@ template <class Tbase_set>
return BaseMedia<Tbase_set>::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<MusicSet, NUM_SONGS_AVAILABLE, GM_DIR>::FillSetDetails(ini, path);
+ bool ret = this->BaseSet<MusicSet, NUM_SONGS_AVAILABLE, GM_DIR>::FillSetDetails(ini, path, full_filename);
if (ret) {
this->num_available = 0;
IniGroup *names = ini->GetGroup("names");
@@ -93,5 +93,5 @@ bool MusicSet::FillSetDetails(IniFile *ini, const char *path)
this->num_available++;
}
}
- return true;
+ return ret;
}