diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index 23482c5ea4..5dcb15ccf7 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -837,7 +837,7 @@ void start_silent_record() safe_strcpy(gSilentRecordingName, info.FilePath.c_str(), MAX_PATH); const char* logFmt = "Silent replay recording started: (%s) %s\n"; - printf(logFmt, info.Name.c_str(), info.FilePath.c_str()); + Console::WriteLine(logFmt, info.Name.c_str(), info.FilePath.c_str()); } } @@ -859,7 +859,7 @@ bool stop_silent_record() " Commands: %u\n" " Checksums: %u"; - printf(logFmt, info.Name.c_str(), info.FilePath.c_str(), info.Ticks, info.NumCommands, info.NumChecksums); + Console::WriteLine(logFmt, info.Name.c_str(), info.FilePath.c_str(), info.Ticks, info.NumCommands, info.NumChecksums); return true; } diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index 634ef1d91f..367ef647b4 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -22,6 +22,7 @@ #include "../actions/SetCheatAction.h" #include "../actions/StaffSetCostumeAction.h" #include "../config/Config.h" +#include "../core/Console.hpp" #include "../core/Guard.hpp" #include "../core/Path.hpp" #include "../core/String.hpp" @@ -1434,7 +1435,7 @@ static int32_t cc_replay_startrecord(InteractiveConsole& console, const argument const char* logFmt = "Replay recording started: (%s) %s"; console.WriteFormatLine(logFmt, info.Name.c_str(), info.FilePath.c_str()); - log_info(logFmt, info.Name.c_str(), info.FilePath.c_str()); + Console::WriteLine(logFmt, info.Name.c_str(), info.FilePath.c_str()); return 1; } @@ -1469,7 +1470,7 @@ static int32_t cc_replay_stoprecord(InteractiveConsole& console, const arguments console.WriteFormatLine( logFmt, info.Name.c_str(), info.FilePath.c_str(), info.Ticks, info.NumCommands, info.NumChecksums); - log_info(logFmt, info.Name.c_str(), info.FilePath.c_str(), info.Ticks, info.NumCommands, info.NumChecksums); + Console::WriteLine(logFmt, info.Name.c_str(), info.FilePath.c_str(), info.Ticks, info.NumCommands, info.NumChecksums); return 1; } @@ -1511,7 +1512,7 @@ static int32_t cc_replay_start(InteractiveConsole& console, const arguments_t& a " Checksums: %u"; console.WriteFormatLine(logFmt, info.FilePath.c_str(), recordingDate, info.Ticks, info.NumCommands, info.NumChecksums); - log_info(logFmt, info.FilePath.c_str(), recordingDate, info.Ticks, info.NumCommands, info.NumChecksums); + Console::WriteLine(logFmt, info.FilePath.c_str(), recordingDate, info.Ticks, info.NumCommands, info.NumChecksums); return 1; } @@ -1661,7 +1662,6 @@ static int32_t cc_assert([[maybe_unused]] InteractiveConsole& console, [[maybe_u static int32_t cc_add_news_item([[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv) { - printf("argv.size() = %zu\n", argv.size()); if (argv.size() < 2) { console.WriteLineWarning("Too few arguments"); diff --git a/src/openrct2/interface/StdInOutConsole.cpp b/src/openrct2/interface/StdInOutConsole.cpp index 3ea2e4c3af..42217dfed2 100644 --- a/src/openrct2/interface/StdInOutConsole.cpp +++ b/src/openrct2/interface/StdInOutConsole.cpp @@ -134,7 +134,23 @@ void StdInOutConsole::WriteLine(const std::string& s, FormatToken colourFormat) { if (_isPromptShowing) { - std::printf("\r%s%s\x1b[0m\x1b[0K\r\n", formatBegin.c_str(), s.c_str()); + auto* mainString = s.c_str(); + + // If string contains \n, we need to replace with \r\n + std::string newString; + if (s.find('\n') != std::string::npos) + { + for (auto ch : s) + { + if (ch == '\n') + newString += "\r\n"; + else + newString += ch; + } + mainString = newString.c_str(); + } + + std::printf("\r%s%s\x1b[0m\x1b[0K\r\n", formatBegin.c_str(), mainString); std::fflush(stdout); linenoise::linenoiseEditRefreshLine(); }