(svn r18506) -Fix [FS#3368]: no error message was created for the first fatal NewGRF error.

This commit is contained in:
rubidium
2009-12-15 00:00:51 +00:00
parent 5450167efc
commit 3e6c530e1e
5 changed files with 29 additions and 0 deletions

View File

@@ -26,6 +26,29 @@
#include "table/strings.h"
#include "table/sprites.h"
/**
* Show the first NewGRF error we can find.
*/
void ShowNewGRFError()
{
for (const GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
/* We only want to show fatal errors */
if (c->error == NULL || c->error->severity != STR_NEWGRF_ERROR_MSG_FATAL) continue;
SetDParam (0, c->error->custom_message == NULL ? c->error->message : STR_JUST_RAW_STRING);
SetDParamStr(1, c->error->custom_message);
SetDParam (2, STR_JUST_RAW_STRING);
SetDParamStr(3, c->filename);
SetDParam (4, STR_JUST_RAW_STRING);
SetDParamStr(5, c->error->data);
for (uint i = 0; i < c->error->num_params; i++) {
SetDParam(6 + i, c->error->param_value[i]);
}
ShowErrorMessage(STR_NEWGRF_ERROR_FATAL_POPUP, INVALID_STRING_ID, 0, 0, true);
break;
}
}
/** Parse an integerlist string and set each found value
* @param p the string to be parsed. Each element in the list is seperated by a
* comma or a space character