fix movement loss after expire_modification

previously when the unit had a movement effect, expire_modifications
could remove movement via the `movement_ = max_movement_;` line in
the movement effect implementation.
This commit is contained in:
gfgtdf 2018-10-28 16:42:27 +01:00
parent 66a282a96b
commit 3bfe5c2041

View file

@ -1203,6 +1203,7 @@ void unit::expire_modifications(const std::string& duration)
// If any modifications expire, then we will need to rebuild the unit.
const unit_type* rebuild_from = nullptr;
int hp = hit_points_;
int mp = movement_;
// Loop through all types of modifications.
for(const auto& mod_name : ModificationTypes) {
// Loop through all modifications of this type.
@ -1230,6 +1231,7 @@ void unit::expire_modifications(const std::string& duration)
anim_comp_->clear_haloes();
advance_to(*rebuild_from);
hit_points_ = hp;
movement_ = std::min(mp, max_movement_);
}
}