Use shared_ptr::reset for clearing halo handlers

This commit is contained in:
Charles Dang 2017-06-21 16:45:46 +11:00
parent 721e2d7e9e
commit ec042a4f4e
4 changed files with 6 additions and 6 deletions

View file

@ -1269,7 +1269,7 @@ void unit_animation::particle::redraw(const frame_parameters& value,const map_lo
void unit_animation::particle::clear_halo()
{
halo_id_ = halo::handle(); // halo::NO_HALO
halo_id_.reset();
}
std::set<map_location> unit_animation::particle::get_overlaped_hex(const frame_parameters& value, const map_location& src, const map_location& dst)
@ -1281,12 +1281,12 @@ std::set<map_location> unit_animation::particle::get_overlaped_hex(const frame_p
unit_animation::particle::~particle()
{
halo_id_ = halo::handle(); // halo::NO_HALO
halo_id_.reset();
}
void unit_animation::particle::start_animation(int start_time)
{
halo_id_ = halo::handle(); // halo::NO_HALO
halo_id_.reset();
parameters_.override(get_animation_duration());
animated<unit_frame>::start_animation(start_time,cycles_);
last_frame_begin_time_ = get_begin_time() -1;

View file

@ -151,7 +151,7 @@ void unit_animation_component::refresh()
void unit_animation_component::clear_haloes ()
{
unit_halo_ = halo::handle(); //halo::NO_HALO; <-- Removes it from the halo manager automatically.
unit_halo_.reset();
if(anim_ ) anim_->clear_haloes();
}

View file

@ -169,7 +169,7 @@ void unit_drawer::redraw_unit (const unit & u) const
}
if(has_halo && u.image_halo().empty()) {
halo_man.remove(ac.unit_halo_);
ac.unit_halo_ = halo::handle(); //halo::NO_HALO;
ac.unit_halo_.reset();
} else if(has_halo) {
halo_man.set_location(ac.unit_halo_, x, y - height_adjust);
}

View file

@ -560,7 +560,7 @@ void unit_frame::redraw(const int frame_time, bool on_start_time, bool in_scope_
current_data.blend_ratio, current_data.submerge, !facing_north);
}
halo_id = halo::handle(); //halo::NO_HALO;
halo_id.reset();
if(!in_scope_of_frame) { //check after frame as first/last frame image used in defense/attack anims
return;