diff --git a/src/core/smallvec_type.hpp b/src/core/smallvec_type.hpp --- a/src/core/smallvec_type.hpp +++ b/src/core/smallvec_type.hpp @@ -36,12 +36,20 @@ protected: public: SmallVector() : data(NULL), items(0), capacity(0) { } - template + template SmallVector(const SmallVector &other) : data(NULL), items(0), capacity(0) { MemCpyT(this->Append(other.Length()), other.Begin(), other.Length()); } + template + SmallVector &operator=(const SmallVector &other) + { + this->Reset(); + MemCpyT(this->Append(other.Length()), other.Begin(), other.Length()); + return *this; + } + ~SmallVector() { free(this->data); diff --git a/src/landscape.cpp b/src/landscape.cpp --- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -638,7 +638,7 @@ CommandCost CmdClearArea(TileIndex tile, for (int x = sx; x <= ex; ++x) { for (int y = sy; y <= ey; ++y) { - SmallVector object_areas = _cleared_object_areas; + SmallVector object_areas(_cleared_object_areas); CommandCost ret = DoCommand(TileXY(x, y), 0, 0, flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR); _cleared_object_areas = object_areas; if (ret.Failed()) {