OpenTTD Source  1.11.0-beta2
console_func.h File Reference
#include "console_type.h"

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 char *string)
 Handle the printing of text entered into the console or redirected there by any other means. More...
 
void CDECL IConsolePrintF (TextColour colour_code, const char *format,...) WARN_FORMAT(2
 
void CDECL void IConsoleDebug (const char *dbg, const char *string)
 It is possible to print debugging information to the console, which is achieved by using this function. More...
 
void IConsoleWarning (const char *string)
 It is possible to print warnings to the console. More...
 
void IConsoleError (const char *string)
 It is possible to print error information to the console. More...
 
void IConsoleCmdExec (const char *cmdstr, 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
 

Detailed Description

Console functions used outside of the console code.

Definition in file console_func.h.

Function Documentation

◆ IConsoleCmdExec()

void IConsoleCmdExec ( const char *  cmdstr,
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

Parameters
cmdstrstring to be parsed and executed

Definition at line 407 of file console.cpp.

References CC_ERROR, CHR_ALLOW, CHR_DISALLOW, CHR_HIDE, CS_ALPHANUMERAL, DEBUG, IConsoleCmd::hook, ICON_MAX_STREAMSIZE, ICON_TOKEN_COUNT, IConsoleAliasExec(), IConsoleAliasGet(), IConsoleCmdGet(), IConsoleError(), IConsolePrintF(), IsValidChar(), lengthof, IConsoleCmd::proc, RemoveUnderscores(), and StrEmpty().

Referenced by IConsoleAliasExec(), and TCPClientConnecter::OnConnect().

◆ IConsoleDebug()

void CDECL void IConsoleDebug ( const char *  dbg,
const char *  string 
)

It is possible to print debugging information to the console, which is achieved by using this function.

Can only be used by debug() in debug.cpp. You need at least a level 2 (developer) for debugging messages to show up

Parameters
dbgdebugging category
stringdebugging message

Definition at line 147 of file console.cpp.

References _settings_client, CC_DEBUG, GUISettings::developer, ClientSettings::gui, and IConsolePrintF().

◆ IConsoleError()

void IConsoleError ( const char *  string)

It is possible to print error information to the console.

This can include game errors, or errors in general you would want the user to notice

Definition at line 168 of file console.cpp.

References CC_ERROR, and IConsolePrintF().

Referenced by DEF_CONSOLE_HOOK(), IConsoleAliasExec(), IConsoleAliasRegister(), IConsoleCmdExec(), and NetworkAvailable().

◆ IConsolePrint()

void IConsolePrint ( TextColour  colour_code,
const char *  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

Parameters
colour_codethe colour of the command. Red in case of errors, etc.
stringthe message entered or output on the console (notice, error, etc.)

Definition at line 85 of file console.cpp.

References _redirect_console_to_admin, _redirect_console_to_client, INVALID_ADMIN_ID, INVALID_CLIENT_ID, IsValidConsoleColour(), NetworkServerSendAdminRcon(), NetworkServerSendRcon(), str_strip_colours(), and stredup().

Referenced by DEF_CONSOLE_CMD(), IConsolePrintF(), and ClientNetworkGameSocketHandler::Receive_SERVER_RCON().

◆ IConsoleWarning()

void IConsoleWarning ( const char *  string)

It is possible to print warnings to the console.

These are mostly errors or mishaps, but non-fatal. You need at least a level 1 (developer) for debugging messages to show up

Definition at line 158 of file console.cpp.

References _settings_client, CC_WARNING, GUISettings::developer, ClientSettings::gui, and IConsolePrintF().

◆ IsValidConsoleColour()

bool IsValidConsoleColour ( TextColour  c)

Check whether the given TextColour is valid for console usage.

Parameters
cThe text colour to compare to.
Returns
true iff the TextColour is valid for console usage.

Definition at line 523 of file console_gui.cpp.

References TC_IS_PALETTE_COLOUR.

Referenced by IConsolePrint(), IConsolePrintF(), and ClientNetworkGameSocketHandler::Receive_SERVER_RCON().