Replace Land::swap by move assignment

macos_ci_fix
elsid 1 year ago
parent c88e9dee27
commit 0cb37742cb
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

@ -332,22 +332,11 @@ namespace ESM
Land& Land::operator=(const Land& land) Land& Land::operator=(const Land& land)
{ {
Land tmp(land); Land copy(land);
swap(tmp); *this = std::move(copy);
return *this; return *this;
} }
void Land::swap(Land& land)
{
std::swap(mFlags, land.mFlags);
std::swap(mX, land.mX);
std::swap(mY, land.mY);
std::swap(mContext, land.mContext);
std::swap(mDataTypes, land.mDataTypes);
std::swap(mLandData, land.mLandData);
std::swap(mWnam, land.mWnam);
}
const Land::LandData* Land::getLandData(int flags) const const Land::LandData* Land::getLandData(int flags) const
{ {
if (!(flags & mDataTypes)) if (!(flags & mDataTypes))

@ -28,6 +28,14 @@ namespace ESM
Land() = default; Land() = default;
Land(const Land& land);
Land(Land&& other) = default;
Land& operator=(const Land& land);
Land& operator=(Land&& land) = default;
// Only first four bits seem to be used, don't know what they mean. // Only first four bits seem to be used, don't know what they mean.
std::uint32_t mFlags = 0; std::uint32_t mFlags = 0;
// Map coordinates. // Map coordinates.
@ -138,12 +146,6 @@ namespace ESM
/// Check if given data type is loaded /// Check if given data type is loaded
bool isDataLoaded(int flags) const; bool isDataLoaded(int flags) const;
Land(const Land& land);
Land& operator=(const Land& land);
void swap(Land& land);
/// Return land data with at least the data types specified in \a flags loaded (if they /// Return land data with at least the data types specified in \a flags loaded (if they
/// are available). Will return a 0-pointer if there is no data for any of the /// are available). Will return a 0-pointer if there is no data for any of the
/// specified types. /// specified types.

Loading…
Cancel
Save