1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-20 02:42:42 +01:00

Codechange: replace seprintf with C++ style formatting

This commit is contained in:
Rubidium
2023-05-30 19:35:27 +02:00
committed by rubidium42
parent fbd71a9d72
commit 55dfca1936
6 changed files with 12 additions and 17 deletions

View File

@@ -1058,7 +1058,7 @@ void ConPrintFramerate()
"AI/GS scripts total",
"Game script",
};
char ai_name_buf[128];
std::string ai_name_buf;
static const PerformanceElement rate_elements[] = { PFE_GAMELOOP, PFE_DRAWING, PFE_VIDEO };
@@ -1077,11 +1077,11 @@ void ConPrintFramerate()
for (PerformanceElement e = PFE_FIRST; e < PFE_MAX; e++) {
auto &pf = _pf_data[e];
if (pf.num_valid == 0) continue;
const char *name;
std::string_view name;
if (e < PFE_AI0) {
name = MEASUREMENT_NAMES[e];
} else {
seprintf(ai_name_buf, lastof(ai_name_buf), "AI %d %s", e - PFE_AI0 + 1, GetAIName(e - PFE_AI0)),
ai_name_buf = fmt::format("AI {} {}", e - PFE_AI0 + 1, GetAIName(e - PFE_AI0));
name = ai_name_buf;
}
IConsolePrint(TC_LIGHT_BLUE, "{} times: {:.2f}ms {:.2f}ms {:.2f}ms",