mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-29 03:15:32 +00:00
added copy constructor and assignment operator for Land record struct
(cherry picked from commit b0641934d4
)
This commit is contained in:
parent
a2d4957d2a
commit
35c4af9476
2 changed files with 33 additions and 2 deletions
|
@ -1,5 +1,7 @@
|
|||
#include "loadland.hpp"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "esmreader.hpp"
|
||||
#include "esmwriter.hpp"
|
||||
#include "defs.hpp"
|
||||
|
@ -215,4 +217,29 @@ bool Land::isDataLoaded(int flags) const
|
|||
return (mDataLoaded & flags) == (flags & mDataTypes);
|
||||
}
|
||||
|
||||
Land::Land (const Land& land)
|
||||
: mFlags (land.mFlags), mX (land.mX), mY (land.mY), mPlugin (land.mPlugin),
|
||||
mEsm (land.mEsm), mContext (land.mContext), mDataTypes (land.mDataTypes),
|
||||
mDataLoaded (land.mDataLoaded),
|
||||
mLandData (land.mLandData ? new LandData (*land.mLandData) : 0)
|
||||
{}
|
||||
|
||||
Land& Land::operator= (Land land)
|
||||
{
|
||||
swap (land);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Land::swap (Land& land)
|
||||
{
|
||||
std::swap (mFlags, land.mFlags);
|
||||
std::swap (mX, land.mX);
|
||||
std::swap (mY, land.mY);
|
||||
std::swap (mPlugin, land.mPlugin);
|
||||
std::swap (mEsm, land.mEsm);
|
||||
std::swap (mContext, land.mContext);
|
||||
std::swap (mDataTypes, land.mDataTypes);
|
||||
std::swap (mDataLoaded, land.mDataLoaded);
|
||||
std::swap (mLandData, land.mLandData);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,9 +116,13 @@ struct Land
|
|||
/// @note We only check data types that *can* be loaded (present in mDataTypes)
|
||||
bool isDataLoaded(int flags) const;
|
||||
|
||||
Land (const Land& land);
|
||||
|
||||
Land& operator= (Land land);
|
||||
|
||||
void swap (Land& land);
|
||||
|
||||
private:
|
||||
Land(const Land& land);
|
||||
Land& operator=(const Land& land);
|
||||
|
||||
/// Loads data and marks it as loaded
|
||||
/// \return true if data is actually loaded from file, false otherwise
|
||||
|
|
Loading…
Reference in a new issue