summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/error.h2
-rw-r--r--src/error_gui.cpp10
-rw-r--r--src/lang/english.txt3
-rw-r--r--src/openttd.cpp30
4 files changed, 37 insertions, 8 deletions
diff --git a/src/error.h b/src/error.h
index eeb90557d..34fb3fb2c 100644
--- a/src/error.h
+++ b/src/error.h
@@ -48,6 +48,8 @@ public:
void CopyOutDParams();
};
+void ScheduleErrorMessage(const ErrorMessageData &data);
+
void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x = 0, int y = 0, uint textref_stack_size = 0, const uint32 *textref_stack = NULL);
void ClearErrorMessages();
void ShowFirstError();
diff --git a/src/error_gui.cpp b/src/error_gui.cpp
index b054f8834..6c4c2e9c6 100644
--- a/src/error_gui.cpp
+++ b/src/error_gui.cpp
@@ -417,3 +417,13 @@ void ScheduleErrorMessage(ErrorList &datas)
{
_error_list.splice(_error_list.end(), datas);
}
+
+/**
+ * Schedule an error.
+ * Note: This does not try to display the error now. This is useful if the window system is not yet running.
+ * @param data Error message data; cleared afterwards
+ */
+void ScheduleErrorMessage(const ErrorMessageData &data)
+{
+ _error_list.push_back(data);
+}
diff --git a/src/lang/english.txt b/src/lang/english.txt
index d4302e4ac..0c3d8de5e 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -1543,6 +1543,9 @@ STR_CONFIG_ERROR_INVALID_GRF_INCOMPATIBLE :incompatible to
STR_CONFIG_ERROR_INVALID_GRF_UNKNOWN :unknown
STR_CONFIG_ERROR_INVALID_SAVEGAME_COMPRESSION_LEVEL :{WHITE}... compression level '{RAW_STRING}' is not valid
STR_CONFIG_ERROR_INVALID_SAVEGAME_COMPRESSION_ALGORITHM :{WHITE}... savegame format '{RAW_STRING}' is not available. Reverting to '{RAW_STRING}'
+STR_CONFIG_ERROR_INVALID_BASE_GRAPHICS_NOT_FOUND :{WHITE}... ignoring Base Graphics set '{RAW_STRING}': not found
+STR_CONFIG_ERROR_INVALID_BASE_SOUNDS_NOT_FOUND :{WHITE}... ignoring Base Sounds set '{RAW_STRING}': not found
+STR_CONFIG_ERROR_INVALID_BASE_MUSIC_NOT_FOUND :{WHITE}... ignoring Base Music set '{RAW_STRING}': not found
# Intro window
STR_INTRO_CAPTION :{WHITE}OpenTTD {REV}
diff --git a/src/openttd.cpp b/src/openttd.cpp
index c11dfcf9a..602f314c9 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -725,8 +725,14 @@ int ttd_main(int argc, char *argv[])
BaseGraphics::FindSets();
if (graphics_set == NULL && BaseGraphics::ini_set != NULL) graphics_set = strdup(BaseGraphics::ini_set);
- if (!BaseGraphics::SetSet(graphics_set) && !StrEmpty(graphics_set)) {
- usererror("Failed to select requested graphics set '%s'", graphics_set);
+ if (!BaseGraphics::SetSet(graphics_set)) {
+ if (!StrEmpty(graphics_set)) {
+ BaseGraphics::SetSet(NULL);
+
+ ErrorMessageData msg(STR_CONFIG_ERROR, STR_CONFIG_ERROR_INVALID_BASE_GRAPHICS_NOT_FOUND);
+ msg.SetDParamStr(0, graphics_set);
+ ScheduleErrorMessage(msg);
+ }
}
free(graphics_set);
@@ -785,18 +791,26 @@ int ttd_main(int argc, char *argv[])
BaseSounds::FindSets();
if (sounds_set == NULL && BaseSounds::ini_set != NULL) sounds_set = strdup(BaseSounds::ini_set);
if (!BaseSounds::SetSet(sounds_set)) {
- StrEmpty(sounds_set) ?
- usererror("Failed to find a sounds set. Please acquire a sounds set for OpenTTD. See section 4.1 of readme.txt.") :
- usererror("Failed to select requested sounds set '%s'", sounds_set);
+ if (StrEmpty(sounds_set) || !BaseSounds::SetSet(NULL)) {
+ usererror("Failed to find a sounds set. Please acquire a sounds set for OpenTTD. See section 4.1 of readme.txt.");
+ } else {
+ ErrorMessageData msg(STR_CONFIG_ERROR, STR_CONFIG_ERROR_INVALID_BASE_SOUNDS_NOT_FOUND);
+ msg.SetDParamStr(0, sounds_set);
+ ScheduleErrorMessage(msg);
+ }
}
free(sounds_set);
BaseMusic::FindSets();
if (music_set == NULL && BaseMusic::ini_set != NULL) music_set = strdup(BaseMusic::ini_set);
if (!BaseMusic::SetSet(music_set)) {
- StrEmpty(music_set) ?
- usererror("Failed to find a music set. Please acquire a music set for OpenTTD. See section 4.1 of readme.txt.") :
- usererror("Failed to select requested music set '%s'", music_set);
+ if (StrEmpty(music_set) || !BaseMusic::SetSet(NULL)) {
+ usererror("Failed to find a music set. Please acquire a music set for OpenTTD. See section 4.1 of readme.txt.");
+ } else {
+ ErrorMessageData msg(STR_CONFIG_ERROR, STR_CONFIG_ERROR_INVALID_BASE_MUSIC_NOT_FOUND);
+ msg.SetDParamStr(0, music_set);
+ ScheduleErrorMessage(msg);
+ }
}
free(music_set);