diff options
author | smatz <smatz@openttd.org> | 2010-02-24 14:50:04 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2010-02-24 14:50:04 +0000 |
commit | e26f96fee6898cee551aafd7e7ce456d2b1475c4 (patch) | |
tree | c44cf9551960b9351477258a9df9773c2d25791f /src | |
parent | f051066bc451479a0c2ff44e2554941628a62f6a (diff) | |
download | openttd-e26f96fee6898cee551aafd7e7ce456d2b1475c4.tar.xz |
(svn r19225) -Feature: show warnings and errors in console as well, not only in a message box
Diffstat (limited to 'src')
-rw-r--r-- | src/misc_gui.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 0e9a75162..d5d4d5490 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -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; |