changeset 5722:c50a67e73d96 draft

(svn r8239) -Regression (r7278): Help window was empty for UNICODE builds
author Darkvater <Darkvater@openttd.org>
date Thu, 18 Jan 2007 14:06:30 +0000
parents 06a31b083e84
children 2fc1cb6d4885
files src/win32.cpp
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/win32.cpp
+++ b/src/win32.cpp
@@ -371,7 +371,7 @@
 		case WM_INITDIALOG: {
 #if defined(UNICODE)
 			/* We need to put the crash-log in a seperate buffer because the default
-			 * buffer in MB_TO_WIDE is not large enough (256 chars) */
+			 * buffer in MB_TO_WIDE is not large enough (512 chars) */
 			wchar_t crash_msgW[8096];
 #endif
 			SetDlgItemText(wnd, 10, _crash_desc);
@@ -841,12 +841,16 @@
 		fprintf(stderr, "%s\n", str);
 	} else {
 		bool old;
-
+#if defined(UNICODE)
+			/* We need to put the text in a seperate buffer because the default
+			 * buffer in MB_TO_WIDE might not be large enough (512 chars) */
+			wchar_t help_msgW[4096];
+#endif
 		ReleaseCapture();
 		_left_button_clicked =_left_button_down = false;
 
 		old = MyShowCursor(true);
-		if (MessageBox(GetActiveWindow(), MB_TO_WIDE(str), _T("OpenTTD"), MB_ICONINFORMATION | MB_OKCANCEL) == IDCANCEL) {
+		if (MessageBox(GetActiveWindow(), MB_TO_WIDE_BUFFER(str, help_msgW, lengthof(help_msgW)), _T("OpenTTD"), MB_ICONINFORMATION | MB_OKCANCEL) == IDCANCEL) {
 			CreateConsole();
 		}
 		MyShowCursor(old);