(svn r19225) -Feature: show warnings and errors in console as well, not only in a message box

This commit is contained in:
smatz 2010-02-24 14:50:04 +00:00
parent f051066bc4
commit e26f96fee6
1 changed files with 16 additions and 2 deletions

View File

@ -697,13 +697,27 @@ public:
*/
void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x, int y)
{
DeleteWindowById(WC_ERRMSG, 0);
if (summary_msg == STR_NULL) summary_msg = STR_EMPTY;
if (wl != WL_INFO) {
/* Print message to console */
char buf[DRAW_STRING_BUFFER];
char *b = GetString(buf, summary_msg, lastof(buf));
if (detailed_msg != INVALID_STRING_ID) {
b += seprintf(b, lastof(buf), " ");
GetString(b, detailed_msg, lastof(buf));
}
switch (wl) {
case WL_WARNING: IConsolePrint(CC_WARNING, buf); break;
default: IConsoleError(buf); break;
};
}
bool no_timeout = wl == WL_CRITICAL;
if (_settings_client.gui.errmsg_duration == 0 && !no_timeout) return;
if (summary_msg == STR_NULL) summary_msg = STR_EMPTY;
DeleteWindowById(WC_ERRMSG, 0);
Point pt = {x, y};
const WindowDesc *desc = (detailed_msg != STR_ERROR_OWNED_BY || GetDParam(2) >= MAX_COMPANIES) ? &_errmsg_desc : &_errmsg_face_desc;