Rename ShowInfo to ShowInfoI, add ShowInfo fmt macro
This commit is contained in:
@@ -128,9 +128,14 @@ std::string GetDebugString();
|
||||
}
|
||||
|
||||
|
||||
void ShowInfo(const char *str);
|
||||
void ShowInfoI(const char *str);
|
||||
void CDECL ShowInfoF(const char *str, ...) WARN_FORMAT(1, 2);
|
||||
|
||||
inline void ShowInfoI(const std::string &str)
|
||||
{
|
||||
ShowInfoI(str.c_str());
|
||||
}
|
||||
|
||||
struct log_prefix {
|
||||
const char *GetLogPrefix();
|
||||
|
||||
|
@@ -13,6 +13,8 @@
|
||||
#include "debug.h"
|
||||
#include "core/format.hpp"
|
||||
|
||||
#define ShowInfo(format_string, ...) ShowInfoI(fmt::format(FMT_STRING(format_string), ## __VA_ARGS__))
|
||||
|
||||
/**
|
||||
* Ouptut a line of debugging information.
|
||||
* @param name The category of debug information.
|
||||
|
@@ -259,7 +259,7 @@ void CDECL ShowInfoF(const char *str, ...)
|
||||
va_start(va, str);
|
||||
vseprintf(buf, lastof(buf), str, va);
|
||||
va_end(va);
|
||||
ShowInfo(buf);
|
||||
ShowInfoI(buf);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -343,7 +343,7 @@ static void ShowHelp()
|
||||
#if !defined(_WIN32)
|
||||
printf("%s\n", buf);
|
||||
#else
|
||||
ShowInfo(buf);
|
||||
ShowInfoI(buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ static void WriteSavegameInfo(const char *name)
|
||||
#if !defined(_WIN32)
|
||||
printf("%s\n", buf);
|
||||
#else
|
||||
ShowInfo(buf);
|
||||
ShowInfoI(buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -445,7 +445,7 @@ static void WriteSavegameDebugData(const char *name)
|
||||
#if !defined(_WIN32)
|
||||
printf("%s\n", buf);
|
||||
#else
|
||||
ShowInfo(buf);
|
||||
ShowInfoI(buf);
|
||||
#endif
|
||||
free(buf);
|
||||
}
|
||||
@@ -805,7 +805,7 @@ int openttd_main(int argc, char *argv[])
|
||||
videodriver = "dedicated";
|
||||
blitter = "null";
|
||||
dedicated = true;
|
||||
SetDebugString("net=3", ShowInfo);
|
||||
SetDebugString("net=3", ShowInfoI);
|
||||
if (mgo.opt != nullptr) {
|
||||
scanner->dedicated_host = ParseFullConnectionString(mgo.opt, scanner->dedicated_port);
|
||||
}
|
||||
@@ -829,7 +829,7 @@ int openttd_main(int argc, char *argv[])
|
||||
#if defined(_WIN32)
|
||||
CreateConsole();
|
||||
#endif
|
||||
if (mgo.opt != nullptr) SetDebugString(mgo.opt, ShowInfo);
|
||||
if (mgo.opt != nullptr) SetDebugString(mgo.opt, ShowInfoI);
|
||||
break;
|
||||
}
|
||||
case 'e': _switch_mode = (_switch_mode == SM_LOAD_GAME || _switch_mode == SM_LOAD_SCENARIO ? SM_LOAD_SCENARIO : SM_EDITOR); break;
|
||||
|
@@ -202,7 +202,7 @@ std::string FS2OTTD(const std::string &name)
|
||||
|
||||
#endif /* WITH_ICONV */
|
||||
|
||||
void ShowInfo(const char *str)
|
||||
void ShowInfoI(const char *str)
|
||||
{
|
||||
fprintf(stderr, "%s\n", str);
|
||||
}
|
||||
|
@@ -274,7 +274,7 @@ void CreateConsole()
|
||||
_close(fd);
|
||||
CloseHandle(hand);
|
||||
|
||||
ShowInfo("Unable to open an output handle to the console. Check known-bugs.txt for details.");
|
||||
ShowInfoI("Unable to open an output handle to the console. Check known-bugs.txt for details.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ static INT_PTR CALLBACK HelpDialogFunc(HWND wnd, UINT msg, WPARAM wParam, LPARAM
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void ShowInfo(const char *str)
|
||||
void ShowInfoI(const char *str)
|
||||
{
|
||||
if (_has_console) {
|
||||
fprintf(stderr, "%s\n", str);
|
||||
|
@@ -471,7 +471,7 @@ static void CDECL HandleSavegameLoadCrash(int signum)
|
||||
"Please file a bug report and attach this savegame.\n");
|
||||
}
|
||||
|
||||
ShowInfo(buffer);
|
||||
ShowInfoI(buffer);
|
||||
|
||||
#ifdef WITH_SIGACTION
|
||||
struct sigaction call;
|
||||
|
Reference in New Issue
Block a user