summaryrefslogtreecommitdiff
path: root/src/console.cpp
diff options
context:
space:
mode:
authorrubidium42 <rubidium@openttd.org>2021-06-12 20:43:37 +0200
committerrubidium42 <rubidium42@users.noreply.github.com>2021-06-13 15:25:31 +0200
commit6b757c716a736b2f0b91ede0e0e397be6ad03a27 (patch)
treeeb4e276dae0118e14de8725545e3a18f3f6cef52 /src/console.cpp
parent1e432fbd7124a617374e3db56f41a26541890ce5 (diff)
downloadopenttd-6b757c716a736b2f0b91ede0e0e397be6ad03a27.tar.xz
Codechange: add an IConsolePrint overload that does formatting with fmt
Diffstat (limited to 'src/console.cpp')
-rw-r--r--src/console.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/console.cpp b/src/console.cpp
index c18cbbcdf..6389aef6c 100644
--- a/src/console.cpp
+++ b/src/console.cpp
@@ -88,14 +88,13 @@ void IConsoleFree()
* 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
- * @param colour_code the colour of the command. Red in case of errors, etc.
- * @param string the message entered or output on the console (notice, error, etc.)
+ * @param colour_code The colour of the command.
+ * @param string The message to output on the console (notice, error, etc.)
*/
-void IConsolePrint(TextColour colour_code, const char *string)
+void IConsolePrint(TextColour colour_code, const std::string &string)
{
assert(IsValidConsoleColour(colour_code));
- char *str;
if (_redirect_console_to_client != INVALID_CLIENT_ID) {
/* Redirect the string to the client */
NetworkServerSendRcon(_redirect_console_to_client, colour_code, string);
@@ -109,7 +108,7 @@ void IConsolePrint(TextColour colour_code, const char *string)
/* Create a copy of the string, strip if of colours and invalid
* characters and (when applicable) assign it to the console buffer */
- str = stredup(string);
+ char *str = stredup(string.c_str());
str_strip_colours(str);
StrMakeValidInPlace(str);