OpenTTD Source 20260531-master-g0e951f3528
console_func.h File Reference

Console functions used outside of the console code. More...

#include "console_type.h"
#include "core/format.hpp"

Go to the source code of this file.

Functions

void IConsoleInit ()
void IConsoleFree ()
void IConsoleClose ()
 Close the in-game console.
void IConsolePrint (ExtendedTextColour 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 (ExtendedTextColour 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 (std::string_view command_string, const uint recurse_count=0)
 Execute a given command passed to us.
bool IsValidConsoleColour (ExtendedTextColour c)
 Check whether the given TextColour is valid for console usage.

Variables

IConsoleModes _iconsole_mode
 Console modes.

Detailed Description

Console functions used outside of the console code.

Definition in file console_func.h.

Function Documentation

◆ IConsoleClose()

void IConsoleClose ( )

Close the in-game console.

Definition at line 446 of file console_gui.cpp.

References _iconsole_mode, ICONSOLE_OPENED, and IConsoleSwitch().

Referenced by ConScreenShot(), and InitWindowSystem().

◆ IConsoleCmdExec()

void IConsoleCmdExec ( std::string_view command_string,
const uint recurse_count )

◆ IConsoleFree()

void IConsoleFree ( )

Definition at line 75 of file console.cpp.

◆ IConsoleInit()

void IConsoleInit ( )

Definition at line 40 of file console.cpp.

◆ IConsolePrint() [1/2]

void IConsolePrint ( ExtendedTextColour 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

Parameters
colour_codeThe colour of the command.
stringThe message to output on the console (notice, error, etc.)

Definition at line 90 of file console.cpp.

References _network_dedicated, _redirect_console_to_admin, _redirect_console_to_client, GetLogPrefix(), IConsoleGUIPrint(), INVALID_CLIENT_ID, IsValidConsoleColour(), NetworkAdminConsole(), NetworkServerSendAdminRcon(), NetworkServerSendRcon(), and StrMakeValid().

Referenced by IConsole::AliasRegister(), ConAlias(), ConBan(), ConBanList(), ConChangeDirectory(), ConClearBuffer(), ConClientNickChange(), ConCompanies(), ConContent(), ConDebugLevel(), ConDumpCargoTypes(), ConDumpInfo(), ConDumpRailTypes(), ConDumpRoadTypes(), ConEcho(), ConEchoC(), ConExec(), ConExit(), ConFont(), ConFramerate(), ConFramerateWindow(), ConGamelogPrint(), ConGetDate(), ConGetSeed(), ConGetSysDate(), ConHelp(), ConHookClientOnly(), ConHookNeedNetwork(), ConHookNeedNonDedicatedNetwork(), ConHookNewGRFDeveloperTool(), ConHookNoNetwork(), ConHookServerOnly(), ConHookServerOrNoNetwork(), ConInfoCmd(), ConJoinCompany(), ConKick(), ConKickOrBan(), ConListAI(), ConListAILibs(), ConListAliases(), ConListCommands(), ConListDirs(), ConListFiles(), ConListGame(), ConListGameLibs(), ConListHeightmaps(), ConListScenarios(), ConListSettings(), ConLoad(), ConLoadHeightmap(), ConLoadScenario(), ConMoveClient(), ConNetworkAuthorizedKey(), ConNetworkClients(), ConNetworkConnect(), ConNetworkReconnect(), ConNewGame(), ConNewGRFProfile(), ConNewGRFReload(), ConPart(), ConPauseGame(), ConPrintFramerate(), ConPrintWorkingDirectory(), ConRcon(), ConReload(), ConReloadAI(), ConRemove(), ConRescanAI(), ConRescanGame(), ConRescanNewGRF(), ConResetCompany(), ConResetEnginePool(), ConResetEngines(), ConRestart(), ConReturn(), ConSave(), ConSaveConfig(), ConSay(), ConSayClient(), ConSayCompany(), ConSchedule(), ConScreenShot(), ConScript(), ConScrollToTile(), ConServerInfo(), ConSetting(), ConSettingNewgame(), ConStartAI(), ConStatus(), ConStopAI(), ConUnBan(), ConUnpauseGame(), ConZoomToLevel(), DebugSendRemoteMessages(), IConsoleAliasExec(), IConsoleCmdExec(), IConsoleGetSetting(), IConsoleListSettings(), IConsolePrint(), NetworkAutoCleanCompanies(), NetworkAvailable(), NetworkPrintClients(), NetworkServer_Tick(), NetworkServerShowStatusToConsole(), NetworkTextMessage(), ConsoleContentCallback::OnConnect(), ConsoleContentCallback::OnDisconnect(), ConsoleContentCallback::OnDownloadComplete(), IConsoleWindow::OnKeyPress(), OutputContentState(), Gamelog::PrintConsole(), PrintLineByLine(), ServerNetworkGameSocketHandler::ReceiveClientChat(), ServerNetworkGameSocketHandler::ReceiveClientCommand(), ClientNetworkGameSocketHandler::ReceiveServerCommand(), ClientNetworkGameSocketHandler::ReceiveServerRemoteConsoleCommand(), and ShowErrorMessage().

◆ IConsolePrint() [2/2]

template<typename A, typename ... Args>
void IConsolePrint ( ExtendedTextColour colour_code,
fmt::format_string< A, Args... > format,
A && first_arg,
Args &&... other_args )
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

Parameters
colour_codeThe colour of the command.
formatThe formatting string to tell what to do with the remaining arguments.
first_argThe first argument to the format.
other_argsThe other arguments to the format.
Template Parameters
AThe type of the first argument.
ArgsThe types of the other arguments.

Definition at line 41 of file console_func.h.

References A, and IConsolePrint().

◆ IsValidConsoleColour()

Variable Documentation

◆ _iconsole_mode