Codechange: replace IConsolePrintF with IConsolePrint and fmt formatting

Also make some strings more consistent with the rest of the console strings.
This commit is contained in:
rubidium42
2021-06-12 21:33:01 +02:00
committed by rubidium42
parent d9c1d18f2b
commit eb6cdadc4d
9 changed files with 97 additions and 120 deletions

View File

@@ -59,7 +59,7 @@ static void IConsoleWriteToLogFile(const char *string)
fwrite("\n", 1, 1, _iconsole_output_file) != 1) {
fclose(_iconsole_output_file);
_iconsole_output_file = nullptr;
IConsolePrintF(CC_DEFAULT, "cannot write to log file");
IConsolePrint(CC_ERROR, "Cannot write to console log file; closing the log file.");
}
}
}
@@ -67,7 +67,7 @@ static void IConsoleWriteToLogFile(const char *string)
bool CloseConsoleLogIfActive()
{
if (_iconsole_output_file != nullptr) {
IConsolePrintF(CC_DEFAULT, "file output complete");
IConsolePrint(CC_INFO, "Console log file closed.");
fclose(_iconsole_output_file);
_iconsole_output_file = nullptr;
return true;
@@ -125,25 +125,6 @@ void IConsolePrint(TextColour colour_code, const std::string &string)
IConsoleGUIPrint(colour_code, str);
}
/**
* Handle the printing of text entered into the console or redirected there
* by any other means. Uses printf() style format, for more information look
* at IConsolePrint()
*/
void CDECL IConsolePrintF(TextColour colour_code, const char *format, ...)
{
assert(IsValidConsoleColour(colour_code));
va_list va;
char buf[ICON_MAX_STREAMSIZE];
va_start(va, format);
vseprintf(buf, lastof(buf), format, va);
va_end(va);
IConsolePrint(colour_code, buf);
}
/**
* Change a string into its number representation. Supports
* decimal and hexadecimal numbers as well as 'on'/'off' 'true'/'false'