From b0e57c0ca966ca5bd03f2ffe1d7945e8d332b879 Mon Sep 17 00:00:00 2001 From: Ted John Date: Sat, 2 Jan 2021 10:27:50 +0000 Subject: [PATCH] Do not allocate vector each time format string legacy is called --- src/openrct2/localisation/Formatting.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/openrct2/localisation/Formatting.cpp b/src/openrct2/localisation/Formatting.cpp index aedeac49e5..03264639eb 100644 --- a/src/openrct2/localisation/Formatting.cpp +++ b/src/openrct2/localisation/Formatting.cpp @@ -808,7 +808,8 @@ namespace OpenRCT2 size_t FormatStringLegacy(char* buffer, size_t bufferLen, rct_string_id id, const void* args) { - std::vector anyArgs; + thread_local std::vector anyArgs; + anyArgs.clear(); auto fmt = GetFmtStringById(id); BuildAnyArgListFromLegacyArgBuffer(fmt, anyArgs, args); return FormatStringAny(buffer, bufferLen, fmt, anyArgs);