1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-11 01:52:32 +01:00

Fix for MSVC

This commit is contained in:
Ted John
2018-03-12 17:39:58 +00:00
parent dbf41a1e47
commit 6d526d020c
5 changed files with 11 additions and 13 deletions

View File

@@ -2,7 +2,7 @@
namespace OpenRCT2 { namespace Ui namespace OpenRCT2 { namespace Ui
{ {
class InGameConsole : public InteractiveConsole class InGameConsole final : public InteractiveConsole
{ {
private: private:
static constexpr sint32 CONSOLE_MAX_LINES = 300; static constexpr sint32 CONSOLE_MAX_LINES = 300;

View File

@@ -1234,11 +1234,11 @@ void InteractiveConsole::WriteLineWarning(const std::string &s)
WriteLine(s, FORMAT_YELLOW); WriteLine(s, FORMAT_YELLOW);
} }
void InteractiveConsole::WriteFormatLine(const std::string &format, ...) void InteractiveConsole::WriteFormatLine(const char * format, ...)
{ {
va_list list; va_list list;
va_start(list, format); va_start(list, format);
auto buffer = String::Format_VA(format.c_str(), list); auto buffer = String::Format_VA(format, list);
va_end(list); va_end(list);
auto s = std::string(buffer); auto s = std::string(buffer);

View File

@@ -43,20 +43,18 @@ class InteractiveConsole
public: public:
virtual ~InteractiveConsole() { } virtual ~InteractiveConsole() { }
sint32 cc_clear(const utf8 **argv, sint32 argc);
void Execute(const std::string &s); void Execute(const std::string &s);
void WriteLine(const std::string &s); void WriteLine(const std::string &s);
void WriteLineError(const std::string &s); void WriteLineError(const std::string &s);
void WriteLineWarning(const std::string &s); void WriteLineWarning(const std::string &s);
void WriteFormatLine(const std::string &format, ...); void WriteFormatLine(const char * format, ...);
virtual void Clear() abstract; virtual void Clear() abstract;
virtual void Close() abstract; virtual void Close() abstract;
virtual void WriteLine(const std::string &s, uint32 colourFormat) abstract; virtual void WriteLine(const std::string &s, uint32 colourFormat) abstract;
}; };
class StdInOutConsole : public InteractiveConsole class StdInOutConsole final : public InteractiveConsole
{ {
private: private:
std::queue<std::tuple<std::promise<void>, std::string>> _evalQueue; std::queue<std::tuple<std::promise<void>, std::string>> _evalQueue;

View File

@@ -1,5 +1,5 @@
#include "../OpenRCT2.h"
#include "../thirdparty/linenoise.hpp" #include "../thirdparty/linenoise.hpp"
#include "../OpenRCT2.h"
#include "Console.h" #include "Console.h"
void StdInOutConsole::Start() void StdInOutConsole::Start()

View File

@@ -333,7 +333,7 @@ inline void PushBuffer(WCHAR c)
// Send the string to the input buffer. // Send the string to the input buffer.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
inline void SendSequence(LPWSTR seq) inline void SendSequence(LPCWSTR seq)
{ {
DWORD out; DWORD out;
INPUT_RECORD in; INPUT_RECORD in;
@@ -776,14 +776,14 @@ inline void InterpretEscSeq(void)
if (es_argv[0] == 21) // ESC[21t Report xterm window's title if (es_argv[0] == 21) // ESC[21t Report xterm window's title
{ {
WCHAR buf[MAX_PATH * 2]; WCHAR buf[MAX_PATH * 2];
DWORD len = GetConsoleTitleW(buf + 3, lenof(buf) - 3 - 2); DWORD len2 = GetConsoleTitleW(buf + 3, lenof(buf) - 3 - 2);
// Too bad if it's too big or fails. // Too bad if it's too big or fails.
buf[0] = ESC; buf[0] = ESC;
buf[1] = ']'; buf[1] = ']';
buf[2] = 'l'; buf[2] = 'l';
buf[3 + len] = ESC; buf[3 + len2] = ESC;
buf[3 + len + 1] = '\\'; buf[3 + len2 + 1] = '\\';
buf[3 + len + 2] = '\0'; buf[3 + len2 + 2] = '\0';
SendSequence(buf); SendSequence(buf);
} }
return; return;