Codechange: Don't format strings passed to GrfMsg unless the message will be used.

This makes GrfMsg() behave more like Debug().
This commit is contained in:
Peter Nelson 2024-07-01 17:35:31 +01:00 committed by Peter Nelson
parent ba0acb87eb
commit 55acc1b36d

View File

@ -202,7 +202,7 @@ void ResetNewGRFData();
void ResetPersistentNewGRFData();
void GrfMsgI(int severity, const std::string &msg);
#define GrfMsg(severity, format_string, ...) GrfMsgI(severity, fmt::format(FMT_STRING(format_string), ## __VA_ARGS__))
#define GrfMsg(severity, format_string, ...) do { if ((severity) == 0 || _debug_grf_level >= (severity)) GrfMsgI(severity, fmt::format(FMT_STRING(format_string), ## __VA_ARGS__)); } while (false)
bool GetGlobalVariable(uint8_t param, uint32_t *value, const GRFFile *grffile);