(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.

pull/155/head
frosch 12 years ago
parent 248ba5eddb
commit 7ae3b0d332

@ -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();

@ -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);
}

@ -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}

@ -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);

Loading…
Cancel
Save