OpenTTD Source
20241108-master-g80f628063a
|
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. More... | |
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. More... | |
void | IConsoleCmdExec (const std::string &command_string, const uint recurse_count=0) |
Execute a given command passed to us. More... | |
bool | IsValidConsoleColour (TextColour c) |
Check whether the given TextColour is valid for console usage. More... | |
Variables | |
IConsoleModes | _iconsole_mode |
Console functions used outside of the console code.
Definition in file console_func.h.
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(), and OnStartGame().
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(), INVALID_ADMIN_ID, INVALID_CLIENT_ID, IsValidConsoleColour(), NetworkAdminConsole(), NetworkServerSendAdminRcon(), NetworkServerSendRcon(), StrMakeValid(), and SVS_NONE.
Referenced by ConPrintFramerate(), DebugSendRemoteMessages(), DEF_CONSOLE_CMD(), DEF_CONSOLE_HOOK(), IConsoleAliasExec(), IConsoleCmdExec(), IConsoleGetSetting(), IConsoleListSettings(), NetworkAutoCleanCompanies(), NetworkAvailable(), NetworkPrintClients(), ConsoleContentCallback::OnDisconnect(), OutputContentState(), Gamelog::PrintConsole(), PrintLineByLine(), ClientNetworkGameSocketHandler::Receive_SERVER_COMMAND(), and ClientNetworkGameSocketHandler::Receive_SERVER_RCON().
|
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.
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 TC_IS_PALETTE_COLOUR.
Referenced by IConsolePrint(), ClientNetworkGameSocketHandler::Receive_SERVER_EXTERNAL_CHAT(), and ClientNetworkGameSocketHandler::Receive_SERVER_RCON().