From 0cb37742cb8ee7b3829f9b9b1f1dd7c0c4de8868 Mon Sep 17 00:00:00 2001
From: elsid <elsid.mail@gmail.com>
Date: Sat, 12 Aug 2023 13:27:52 +0200
Subject: [PATCH] Replace Land::swap by move assignment

---
 components/esm3/loadland.cpp | 15 ++-------------
 components/esm3/loadland.hpp | 14 ++++++++------
 2 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/components/esm3/loadland.cpp b/components/esm3/loadland.cpp
index ba04e11dcf..797cf2bc37 100644
--- a/components/esm3/loadland.cpp
+++ b/components/esm3/loadland.cpp
@@ -332,22 +332,11 @@ namespace ESM
 
     Land& Land::operator=(const Land& land)
     {
-        Land tmp(land);
-        swap(tmp);
+        Land copy(land);
+        *this = std::move(copy);
         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
     {
         if (!(flags & mDataTypes))
diff --git a/components/esm3/loadland.hpp b/components/esm3/loadland.hpp
index e0dbca8400..0c7226324c 100644
--- a/components/esm3/loadland.hpp
+++ b/components/esm3/loadland.hpp
@@ -28,6 +28,14 @@ namespace ESM
 
         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.
         std::uint32_t mFlags = 0;
         // Map coordinates.
@@ -138,12 +146,6 @@ namespace ESM
         /// Check if given data type is loaded
         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
         /// are available). Will return a 0-pointer if there is no data for any of the
         /// specified types.