mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-29 04:06:40 +00:00
Replace Land::swap by move assignment
This commit is contained in:
parent
c88e9dee27
commit
0cb37742cb
2 changed files with 10 additions and 19 deletions
|
@ -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…
Reference in a new issue