mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-03 23:26:40 +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 "loadland.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <utility>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "esmreader.hpp"
 | 
					#include "esmreader.hpp"
 | 
				
			||||||
#include "esmwriter.hpp"
 | 
					#include "esmwriter.hpp"
 | 
				
			||||||
#include "defs.hpp"
 | 
					#include "defs.hpp"
 | 
				
			||||||
| 
						 | 
					@ -215,4 +217,29 @@ bool Land::isDataLoaded(int flags) const
 | 
				
			||||||
    return (mDataLoaded & flags) == (flags & mDataTypes);
 | 
					    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)
 | 
					    /// @note We only check data types that *can* be loaded (present in mDataTypes)
 | 
				
			||||||
    bool isDataLoaded(int flags) const;
 | 
					    bool isDataLoaded(int flags) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private:
 | 
					 | 
				
			||||||
        Land (const Land& land);
 | 
					        Land (const Land& land);
 | 
				
			||||||
        Land& operator=(const Land& land);
 | 
					
 | 
				
			||||||
 | 
					        Land& operator= (Land land);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        void swap (Land& land);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// Loads data and marks it as loaded
 | 
					        /// Loads data and marks it as loaded
 | 
				
			||||||
        /// \return true if data is actually loaded from file, false otherwise
 | 
					        /// \return true if data is actually loaded from file, false otherwise
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue