src/win32.cpp
changeset 5973 1a4cc06c6c64
parent 5925 f8e678955ef1
child 6009 cf31b0e5c696
equal deleted inserted replaced
5972:564f98b055d1 5973:1a4cc06c6c64
   369 {
   369 {
   370 	switch (msg) {
   370 	switch (msg) {
   371 		case WM_INITDIALOG: {
   371 		case WM_INITDIALOG: {
   372 #if defined(UNICODE)
   372 #if defined(UNICODE)
   373 			/* We need to put the crash-log in a seperate buffer because the default
   373 			/* We need to put the crash-log in a seperate buffer because the default
   374 			 * buffer in MB_TO_WIDE is not large enough (256 chars) */
   374 			 * buffer in MB_TO_WIDE is not large enough (512 chars) */
   375 			wchar_t crash_msgW[8096];
   375 			wchar_t crash_msgW[8096];
   376 #endif
   376 #endif
   377 			SetDlgItemText(wnd, 10, _crash_desc);
   377 			SetDlgItemText(wnd, 10, _crash_desc);
   378 			SetDlgItemText(wnd, 11, MB_TO_WIDE_BUFFER(_crash_msg, crash_msgW, lengthof(crash_msgW)));
   378 			SetDlgItemText(wnd, 11, MB_TO_WIDE_BUFFER(_crash_msg, crash_msgW, lengthof(crash_msgW)));
   379 			SendDlgItemMessage(wnd, 11, WM_SETFONT, (WPARAM)GetStockObject(ANSI_FIXED_FONT), FALSE);
   379 			SendDlgItemMessage(wnd, 11, WM_SETFONT, (WPARAM)GetStockObject(ANSI_FIXED_FONT), FALSE);
   839 {
   839 {
   840 	if (_has_console) {
   840 	if (_has_console) {
   841 		fprintf(stderr, "%s\n", str);
   841 		fprintf(stderr, "%s\n", str);
   842 	} else {
   842 	} else {
   843 		bool old;
   843 		bool old;
   844 
   844 #if defined(UNICODE)
       
   845 			/* We need to put the text in a seperate buffer because the default
       
   846 			 * buffer in MB_TO_WIDE might not be large enough (512 chars) */
       
   847 			wchar_t help_msgW[4096];
       
   848 #endif
   845 		ReleaseCapture();
   849 		ReleaseCapture();
   846 		_left_button_clicked =_left_button_down = false;
   850 		_left_button_clicked =_left_button_down = false;
   847 
   851 
   848 		old = MyShowCursor(true);
   852 		old = MyShowCursor(true);
   849 		if (MessageBox(GetActiveWindow(), MB_TO_WIDE(str), _T("OpenTTD"), MB_ICONINFORMATION | MB_OKCANCEL) == IDCANCEL) {
   853 		if (MessageBox(GetActiveWindow(), MB_TO_WIDE_BUFFER(str, help_msgW, lengthof(help_msgW)), _T("OpenTTD"), MB_ICONINFORMATION | MB_OKCANCEL) == IDCANCEL) {
   850 			CreateConsole();
   854 			CreateConsole();
   851 		}
   855 		}
   852 		MyShowCursor(old);
   856 		MyShowCursor(old);
   853 	}
   857 	}
   854 }
   858 }