From aa00038c9cbb1ee24dc0be5623d546547de55203 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Mon, 23 Nov 2015 18:34:57 +0000 Subject: [PATCH] Do not write desync messages to the console on Windows. Windows seems unable to handle direction change characters in consoles. --- src/debug.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/debug.cpp b/src/debug.cpp index 140f14129f..b9a4baf510 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -141,13 +141,18 @@ static void debug_print(const char *dbg, const char *buf) char buffer[512]; seprintf(buffer, lastof(buffer), "%sdbg: [%s] %s\n", GetLogPrefix(), dbg, buf); + + /* do not write desync messages to the console on Windows platforms, as they do + * not seem able to handle text direction change characters in a console without + * crashing, and NetworkTextMessage includes these */ #if defined(WINCE) - NKDbgPrintfW(OTTD2FS(buffer)); + if (strcmp(dbg, "desync") != 0) NKDbgPrintfW(OTTD2FS(buffer)); #elif defined(WIN32) || defined(WIN64) - _fputts(OTTD2FS(buffer, true), stderr); + if (strcmp(dbg, "desync") != 0) _fputts(OTTD2FS(buffer, true), stderr); #else fputs(buffer, stderr); #endif + #ifdef ENABLE_NETWORK NetworkAdminConsole(dbg, buf); #endif /* ENABLE_NETWORK */