1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 19:13:07 +01:00

Implement copy constructors (#12970)

This commit is contained in:
Duncan
2020-09-19 13:58:05 +01:00
committed by GitHub
parent 4a79e9305f
commit 124161b459

View File

@@ -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 };