OpenTTD Source 20241224-master-gf74b0cf984
|
Console functions used outside of the console code. More...
Go to the source code of this file.
Functions | |
void | IConsoleInit () |
void | IConsoleFree () |
void | IConsoleClose () |
Close the in-game console. | |
void | IConsolePrint (TextColour colour_code, const std::string &string) |
Handle the printing of text entered into the console or redirected there by any other means. | |
template<typename A , typename ... Args> | |
void | IConsolePrint (TextColour colour_code, fmt::format_string< A, Args... > format, A &&first_arg, Args &&... other_args) |
Handle the printing of text entered into the console or redirected there by any other means. | |
void | IConsoleCmdExec (const std::string &command_string, const uint recurse_count=0) |
Execute a given command passed to us. | |
bool | IsValidConsoleColour (TextColour c) |
Check whether the given TextColour is valid for console usage. | |
Variables | |
IConsoleModes | _iconsole_mode |
Console functions used outside of the console code.
Definition in file console_func.h.
void IConsoleClose | ( | ) |
Close the in-game console.
Definition at line 445 of file console_gui.cpp.
References ICONSOLE_OPENED, and IConsoleSwitch().
Referenced by InitWindowSystem().
void IConsoleCmdExec | ( | const std::string & | command_string, |
const uint | recurse_count | ||
) |
Execute a given command passed to us.
First chop it up into individual tokens (separated by spaces), then execute it if possible
command_string | string to be parsed and executed |
Definition at line 291 of file console.cpp.
References IConsole::AliasGet(), CC_ERROR, CHR_ALLOW, CHR_DISALLOW, CHR_HIDE, IConsole::CmdGet(), CS_ALPHANUMERAL, Debug, IConsoleCmd::hook, ICON_MAX_STREAMSIZE, ICON_TOKEN_COUNT, IConsoleAliasExec(), IConsolePrint(), IsValidChar(), lengthof, IConsoleCmd::proc, and StrEmpty().
Referenced by IConsoleAliasExec(), TCPClientConnecter::OnConnect(), IConsoleWindow::OnKeyPress(), AfterNewGRFScan::OnNewGRFsScanned(), OnStartGame(), ServerNetworkAdminSocketHandler::Receive_ADMIN_RCON(), ServerNetworkGameSocketHandler::Receive_CLIENT_ACK(), and ServerNetworkGameSocketHandler::Receive_CLIENT_RCON().
void IConsoleFree | ( | ) |
Definition at line 74 of file console.cpp.
void IConsoleInit | ( | ) |
Definition at line 39 of file console.cpp.
void IConsolePrint | ( | TextColour | colour_code, |
const std::string & | string | ||
) |
Handle the printing of text entered into the console or redirected there by any other means.
Text can be redirected to other clients in a network game as well as to a logfile. If the network server is a dedicated server, all activities are also logged. All lines to print are added to a temporary buffer which can be used as a history to print them onscreen
colour_code | The colour of the command. |
string | The message to output on the console (notice, error, etc.) |
Definition at line 89 of file console.cpp.
References _network_dedicated, _redirect_console_to_admin, _redirect_console_to_client, GetLogPrefix(), IConsoleGUIPrint(), INVALID_ADMIN_ID, INVALID_CLIENT_ID, IsValidConsoleColour(), NetworkAdminConsole(), NetworkServerSendAdminRcon(), NetworkServerSendRcon(), StrMakeValid(), and SVS_NONE.
Referenced by IConsole::AliasRegister(), ConPrintFramerate(), DebugSendRemoteMessages(), DEF_CONSOLE_CMD(), DEF_CONSOLE_CMD(), DEF_CONSOLE_CMD(), DEF_CONSOLE_CMD(), DEF_CONSOLE_CMD(), DEF_CONSOLE_CMD(), DEF_CONSOLE_CMD(), DEF_CONSOLE_HOOK(), DEF_CONSOLE_HOOK(), DEF_CONSOLE_HOOK(), DEF_CONSOLE_HOOK(), DEF_CONSOLE_HOOK(), DEF_CONSOLE_HOOK(), IConsoleAliasExec(), IConsoleCmdExec(), IConsoleGetSetting(), IConsoleListSettings(), IConsolePrint(), NetworkAutoCleanCompanies(), NetworkAvailable(), NetworkPrintClients(), NetworkServer_Tick(), NetworkServerShowStatusToConsole(), ConsoleContentCallback::OnConnect(), ConsoleContentCallback::OnDisconnect(), ConsoleContentCallback::OnDownloadComplete(), IConsoleWindow::OnKeyPress(), OutputContentState(), Gamelog::PrintConsole(), PrintLineByLine(), ServerNetworkGameSocketHandler::Receive_CLIENT_CHAT(), ServerNetworkGameSocketHandler::Receive_CLIENT_COMMAND(), ClientNetworkGameSocketHandler::Receive_SERVER_COMMAND(), ClientNetworkGameSocketHandler::Receive_SERVER_RCON(), and ShowErrorMessage().
|
inline |
Handle the printing of text entered into the console or redirected there by any other means.
Text can be redirected to other clients in a network game as well as to a logfile. If the network server is a dedicated server, all activities are also logged. All lines to print are added to a temporary buffer which can be used as a history to print them onscreen
colour_code | The colour of the command. |
format_string | The formatting string to tell what to do with the remaining arguments. |
first_arg | The first argument to the format. |
other_args | The other arguments to the format. |
A | The type of the first argument. |
Args | The types of the other arguments. |
Definition at line 41 of file console_func.h.
References IConsolePrint().
bool IsValidConsoleColour | ( | TextColour | c | ) |
Check whether the given TextColour is valid for console usage.
c | The text colour to compare to. |
Definition at line 541 of file console_gui.cpp.
References GetColourGradient(), and TC_IS_PALETTE_COLOUR.
Referenced by IConsolePrint(), ServerNetworkAdminSocketHandler::Receive_ADMIN_EXTERNAL_CHAT(), ClientNetworkGameSocketHandler::Receive_SERVER_EXTERNAL_CHAT(), and ClientNetworkGameSocketHandler::Receive_SERVER_RCON().
|
extern |
Definition at line 113 of file console_gui.cpp.