diff --git a/src/openrct2-ui/interface/InGameConsole.cpp b/src/openrct2-ui/interface/InGameConsole.cpp index 0330bb1e38..0cde98c0c3 100644 --- a/src/openrct2-ui/interface/InGameConsole.cpp +++ b/src/openrct2-ui/interface/InGameConsole.cpp @@ -151,6 +151,11 @@ void InGameConsole::Close() context_stop_text_input(); } +void InGameConsole::Hide() +{ + Close(); +} + void InGameConsole::Toggle() { if (_isOpen) diff --git a/src/openrct2-ui/interface/InGameConsole.h b/src/openrct2-ui/interface/InGameConsole.h index 045934061c..d1edb59a79 100644 --- a/src/openrct2-ui/interface/InGameConsole.h +++ b/src/openrct2-ui/interface/InGameConsole.h @@ -33,6 +33,7 @@ namespace OpenRCT2 { namespace Ui void Clear() override; void Open(); void Close() override; + void Hide() override; void Toggle(); void WriteLine(const std::string &s, uint32 colourFormat) override; diff --git a/src/openrct2/interface/Console.cpp b/src/openrct2/interface/Console.cpp index ee7ce001a6..0fb534abb5 100644 --- a/src/openrct2/interface/Console.cpp +++ b/src/openrct2/interface/Console.cpp @@ -92,12 +92,18 @@ static sint32 cc_clear(InteractiveConsole &console, const utf8 **argv, sint32 ar return 0; } -static sint32 cc_hide(InteractiveConsole &console, const utf8 **argv, sint32 argc) +static sint32 cc_close(InteractiveConsole &console, const utf8 **argv, sint32 argc) { console.Close(); return 0; } +static sint32 cc_hide(InteractiveConsole &console, const utf8 **argv, sint32 argc) +{ + console.Hide(); + return 0; +} + static sint32 cc_echo(InteractiveConsole &console, const utf8 **argv, sint32 argc) { if (argc > 0) @@ -1068,6 +1074,9 @@ static constexpr const utf8* console_window_table[] = { static constexpr const console_command console_command_table[] = { { "clear", cc_clear, "Clears the console.", "clear"}, + { "close", cc_close, "Closes the console.", "close"}, + { "exit", cc_close, "Closes the console.", "exit"}, + { "quit", cc_close, "Closes the console.", "quit"}, { "hide", cc_hide, "Hides the console.", "hide"}, { "echo", cc_echo, "Echoes the text to the console.", "echo " }, { "help", cc_help, "Lists commands or info about a command.", "help [command]" }, @@ -1193,12 +1202,6 @@ void InteractiveConsole::Execute(const std::string &s) if (argc == 0) return; - // Aliases for hiding the console - if(strcmp(argv[0],"quit") == 0 || strcmp(argv[0],"exit") == 0) { - free(argv[0]); - argv[0] = _strdup("hide"); - } - bool validCommand = false; for (const auto &c : console_command_table) { diff --git a/src/openrct2/interface/Console.h b/src/openrct2/interface/Console.h index d9f73b2270..eebc5c97db 100644 --- a/src/openrct2/interface/Console.h +++ b/src/openrct2/interface/Console.h @@ -51,6 +51,7 @@ public: virtual void Clear() abstract; virtual void Close() abstract; + virtual void Hide() abstract; virtual void WriteLine(const std::string &s, uint32 colourFormat) abstract; }; @@ -65,6 +66,7 @@ public: void Clear() override; void Close() override; + void Hide() override { } void WriteLine(const std::string &s) { InteractiveConsole::WriteLine(s); } void WriteLine(const std::string &s, uint32 colourFormat) override; };