1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 09:32:29 +01:00

Do not make hide close the game

This commit is contained in:
Ted John
2018-03-22 20:29:41 +00:00
parent 8624a1d28a
commit 4babfa2479
4 changed files with 18 additions and 7 deletions

View File

@@ -151,6 +151,11 @@ void InGameConsole::Close()
context_stop_text_input();
}
void InGameConsole::Hide()
{
Close();
}
void InGameConsole::Toggle()
{
if (_isOpen)

View File

@@ -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;

View File

@@ -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 <text>" },
{ "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)
{

View File

@@ -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;
};