OpenTTD Source: src/console_func.h Source File

OpenTTD Source 15.0-RC2

console_func.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#ifndef CONSOLE_FUNC_H
11#define CONSOLE_FUNC_H
12
13#include "console_type.h"
14#include "core/format.hpp"
15
16/* console modes */
17extern IConsoleModes _iconsole_mode;
18
19/* console functions */
20void IConsoleInit();
21void IConsoleFree();
22void IConsoleClose();
23
24/* console output */
25void IConsolePrint(TextColour colour_code, const std::string &string);
26
40template <typename A, typename ... Args>
41 inline void IConsolePrint(TextColour colour_code, fmt::format_string<A, Args...> format, A&& first_arg, Args&&... other_args)
42{
43 /* The separate first_arg argument is added to aid overloading.
44 * Otherwise the calls that do no need formatting will still use this function. */
45 IConsolePrint(colour_code, fmt::format(format, std::forward<A>(first_arg), std::forward<Args>(other_args)...));
46}
47
48/* Parser */
49void IConsoleCmdExec(std::string_view command_string, const uint recurse_count = 0);
50
51bool IsValidConsoleColour(TextColour c);
52
53#endif /* CONSOLE_FUNC_H */
IConsoleCmdExec
void IConsoleCmdExec(std::string_view command_string, const uint recurse_count=0)
Execute a given command passed to us.
Definition console.cpp:269
IConsoleClose
void IConsoleClose()
Close the in-game console.
Definition console_gui.cpp:442
IsValidConsoleColour
bool IsValidConsoleColour(TextColour c)
Check whether the given TextColour is valid for console usage.
Definition console_gui.cpp:538
IConsolePrint
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.
Definition console.cpp:90
console_type.h
Globally used console related types.
IConsoleModes
IConsoleModes
Modes of the in-game console.
Definition console_type.h:16
format.hpp
String formatting functions and helpers.
TextColour
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
Definition gfx_type.h:307