mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-10 17:42:29 +01:00
Do not make hide close the game
This commit is contained in:
@@ -151,6 +151,11 @@ void InGameConsole::Close()
|
|||||||
context_stop_text_input();
|
context_stop_text_input();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InGameConsole::Hide()
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
void InGameConsole::Toggle()
|
void InGameConsole::Toggle()
|
||||||
{
|
{
|
||||||
if (_isOpen)
|
if (_isOpen)
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ namespace OpenRCT2 { namespace Ui
|
|||||||
void Clear() override;
|
void Clear() override;
|
||||||
void Open();
|
void Open();
|
||||||
void Close() override;
|
void Close() override;
|
||||||
|
void Hide() override;
|
||||||
void Toggle();
|
void Toggle();
|
||||||
void WriteLine(const std::string &s, uint32 colourFormat) override;
|
void WriteLine(const std::string &s, uint32 colourFormat) override;
|
||||||
|
|
||||||
|
|||||||
@@ -92,12 +92,18 @@ static sint32 cc_clear(InteractiveConsole &console, const utf8 **argv, sint32 ar
|
|||||||
return 0;
|
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();
|
console.Close();
|
||||||
return 0;
|
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)
|
static sint32 cc_echo(InteractiveConsole &console, const utf8 **argv, sint32 argc)
|
||||||
{
|
{
|
||||||
if (argc > 0)
|
if (argc > 0)
|
||||||
@@ -1068,6 +1074,9 @@ static constexpr const utf8* console_window_table[] = {
|
|||||||
|
|
||||||
static constexpr const console_command console_command_table[] = {
|
static constexpr const console_command console_command_table[] = {
|
||||||
{ "clear", cc_clear, "Clears the console.", "clear"},
|
{ "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"},
|
{ "hide", cc_hide, "Hides the console.", "hide"},
|
||||||
{ "echo", cc_echo, "Echoes the text to the console.", "echo <text>" },
|
{ "echo", cc_echo, "Echoes the text to the console.", "echo <text>" },
|
||||||
{ "help", cc_help, "Lists commands or info about a command.", "help [command]" },
|
{ "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)
|
if (argc == 0)
|
||||||
return;
|
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;
|
bool validCommand = false;
|
||||||
for (const auto &c : console_command_table)
|
for (const auto &c : console_command_table)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ public:
|
|||||||
|
|
||||||
virtual void Clear() abstract;
|
virtual void Clear() abstract;
|
||||||
virtual void Close() abstract;
|
virtual void Close() abstract;
|
||||||
|
virtual void Hide() abstract;
|
||||||
virtual void WriteLine(const std::string &s, uint32 colourFormat) abstract;
|
virtual void WriteLine(const std::string &s, uint32 colourFormat) abstract;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -65,6 +66,7 @@ public:
|
|||||||
|
|
||||||
void Clear() override;
|
void Clear() override;
|
||||||
void Close() override;
|
void Close() override;
|
||||||
|
void Hide() override { }
|
||||||
void WriteLine(const std::string &s) { InteractiveConsole::WriteLine(s); }
|
void WriteLine(const std::string &s) { InteractiveConsole::WriteLine(s); }
|
||||||
void WriteLine(const std::string &s, uint32 colourFormat) override;
|
void WriteLine(const std::string &s, uint32 colourFormat) override;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user