Mass: make Weapon copyable.

This is necessary to add weapon copying.
This commit is contained in:
Guillaume Jacquemin 2022-01-30 14:02:30 +01:00
parent 51faed7210
commit d74a7bc219

View file

@ -101,6 +101,42 @@ struct WeaponPart {
}; };
struct Weapon { struct Weapon {
Weapon() = default;
Weapon(const Weapon& other) {
name = other.name;
type = other.type;
parts = Containers::Array<WeaponPart>{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<WeaponPart>{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 name;
std::string type; std::string type;
Containers::Array<WeaponPart> parts; Containers::Array<WeaponPart> parts;