Mercurial > hg > openttd
changeset 19485:6f302a2e8bef draft
(svn r24388) -Fix [FS#5233]: Do not consider not finding a particular base set critical; just load a different one and display an in-game error later on.
author | frosch <frosch@openttd.org> |
---|---|
date | Sun, 08 Jul 2012 18:41:50 +0000 |
parents | 25c66c9fe1a5 |
children | 2155236d658f |
files | src/error.h src/error_gui.cpp src/lang/english.txt src/openttd.cpp |
diffstat | 4 files changed, 37 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/error.h +++ b/src/error.h @@ -48,6 +48,8 @@ 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();
--- a/src/error_gui.cpp +++ b/src/error_gui.cpp @@ -417,3 +417,13 @@ { _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); +}
--- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1543,6 +1543,9 @@ 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}
--- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -725,8 +725,14 @@ 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 @@ 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);