Fix build by explicitly defining a move assignment operator

This commit is contained in:
Celtic Minstrel 2018-03-24 12:09:04 -04:00
parent 667b2b7bd3
commit c0c5fc9d73
2 changed files with 11 additions and 0 deletions

View file

@ -784,6 +784,14 @@ attack_type::specials_context_t::specials_context_t(attack_type::specials_contex
other.was_moved = true;
}
attack_type::specials_context_t& attack_type::specials_context_t::operator=(attack_type::specials_context_t&& other)
{
// This ugly line calls into the default copy move assignment operator.
operator=(static_cast<attack_type::specials_context_t&>(other));
other.was_moved = true;
return *this;
}
/**
* Calculates the number of attacks this weapon has, considering specials.
* This returns two numbers because of the swarm special. The actual number of

View file

@ -125,11 +125,14 @@ public:
/// Initialize weapon specials context for a pair of units
specials_context_t(const attack_type& weapon, unit_const_ptr self, const map_location& loc, bool attacking);
specials_context_t(const specials_context_t&) = delete;
// Default assignment is needed as a base for the move assignment
specials_context_t& operator=(const specials_context_t&) = default;
bool was_moved = false;
public:
// Destructor at least needs to be public for all this to work.
~specials_context_t();
specials_context_t(specials_context_t&&);
specials_context_t& operator=(specials_context_t&&);
};
// Set up a specials context.
// Usage: auto ctx = weapon.specials_context(...);