From d74a7bc219e5d0acf6c64f38579171bc46da5358 Mon Sep 17 00:00:00 2001 From: William JCM Date: Sun, 30 Jan 2022 14:02:30 +0100 Subject: [PATCH] Mass: make Weapon copyable. This is necessary to add weapon copying. --- src/Mass/Mass.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/Mass/Mass.h b/src/Mass/Mass.h index 5caa2ec..815455d 100644 --- a/src/Mass/Mass.h +++ b/src/Mass/Mass.h @@ -101,6 +101,42 @@ struct WeaponPart { }; struct Weapon { + Weapon() = default; + + Weapon(const Weapon& other) { + name = other.name; + type = other.type; + parts = Containers::Array{other.parts.size()}; + for(UnsignedInt i = 0; i < parts.size(); i++) { + parts[i] = other.parts[i]; + } + customStyles = other.customStyles; + attached = other.attached; + damageType = other.damageType; + dualWield = other.dualWield; + effectColourMode = other.effectColourMode; + effectColour = other.effectColour; + } + Weapon& operator=(const Weapon& other) { + name = other.name; + type = other.type; + parts = Containers::Array{other.parts.size()}; + for(UnsignedInt i = 0; i < parts.size(); i++) { + parts[i] = other.parts[i]; + } + customStyles = other.customStyles; + attached = other.attached; + damageType = other.damageType; + dualWield = other.dualWield; + effectColourMode = other.effectColourMode; + effectColour = other.effectColour; + + return *this; + } + + Weapon(Weapon&& other) = default; + Weapon& operator=(Weapon&& other) = default; + std::string name; std::string type; Containers::Array parts;