From 124161b4592ee71408121e4e83d02f38c82b8f71 Mon Sep 17 00:00:00 2001 From: Duncan Date: Sat, 19 Sep 2020 13:58:05 +0100 Subject: [PATCH] Implement copy constructors (#12970) --- src/openrct2/localisation/Localisation.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/openrct2/localisation/Localisation.h b/src/openrct2/localisation/Localisation.h index 6ecaaed84b..3b8fbecbfc 100644 --- a/src/openrct2/localisation/Localisation.h +++ b/src/openrct2/localisation/Localisation.h @@ -101,6 +101,27 @@ public: { } + Formatter(const Formatter& other) + { + *this = other; + } + + Formatter& operator=(const Formatter& other) + { + // If using global or not + if (other.StartBuf == other.Buffer.data()) + { + std::copy(std::begin(other.Buffer), std::end(other.Buffer), std::begin(Buffer)); + StartBuf = Buffer.data(); + } + else + { + StartBuf = other.StartBuf; + } + CurrentBuf = StartBuf + other.NumBytes(); + return *this; + } + static Formatter Common() { return Formatter{ gCommonFormatArgs };