copy constructor and swap() must copy status
Fix calref#710
This commit is contained in:
@@ -53,4 +53,13 @@ void iLiving::void_sanctuary() {
|
||||
status[eStatus::INVISIBLE] = 0;
|
||||
}
|
||||
|
||||
iLiving::iLiving() {}
|
||||
|
||||
iLiving::iLiving(const iLiving& other)
|
||||
: status(other.status)
|
||||
, ap(other.ap)
|
||||
, direction(other.direction)
|
||||
, marked_damage(other.marked_damage)
|
||||
{}
|
||||
|
||||
void(* iLiving::print_result)(std::string) = nullptr;
|
||||
|
@@ -54,6 +54,8 @@ public:
|
||||
virtual int get_level() const = 0;
|
||||
virtual location get_loc() const = 0;
|
||||
|
||||
iLiving();
|
||||
iLiving(const iLiving& other);
|
||||
virtual ~iLiving() = default;
|
||||
|
||||
static void(* print_result)(std::string);
|
||||
|
@@ -1209,6 +1209,7 @@ void swap(cPlayer& lhs, cPlayer& rhs) {
|
||||
using std::swap;
|
||||
// Don't swap the party reference!
|
||||
swap(lhs.main_status, rhs.main_status);
|
||||
swap(lhs.status, rhs.status);
|
||||
swap(lhs.name, rhs.name);
|
||||
swap(lhs.skills, rhs.skills);
|
||||
swap(lhs.max_health, rhs.max_health);
|
||||
|
Reference in New Issue
Block a user