Fix halo remaining/duplicating in some situations

Fixes halo remaining when a unit is killed with [put_unit] or replaced by
creating a new unit over it with the context menu, and duplicate halo when a
developer changes the properties with :unit.
This commit is contained in:
newfrenchy83 2017-09-21 16:56:42 +02:00 committed by Jyrki Vesterinen
parent 45f29a247e
commit c6408dbd95
2 changed files with 3 additions and 0 deletions

View file

@ -2014,6 +2014,7 @@ void game_lua_kernel::put_unit_helper(const map_location& loc)
}
units().erase(loc);
resources::whiteboard->on_kill_unit();
}
/**

View file

@ -444,6 +444,7 @@ SYNCED_COMMAND_HANDLER_FUNCTION(debug_unit, child, use_undo, /*show*/, /*error_
// Don't remove the unit until after we've verified there are no errors in creating the new one,
// or else the unit would simply be removed from the map with no replacement.
resources::gameboard->units().erase(loc);
resources::whiteboard->on_kill_unit();
resources::gameboard->units().insert(new_u);
} catch(unit_type::error& e) {
ERR_REPLAY << e.what() << std::endl; // TODO: more appropriate error message log
@ -466,6 +467,7 @@ SYNCED_COMMAND_HANDLER_FUNCTION(debug_create_unit, child, use_undo, /*show*/, e
debug_notification("A unit was created using debug command during turn of $player");
map_location loc(child);
resources::whiteboard->on_kill_unit();
const unit_race::GENDER gender = string_gender(child["gender"], unit_race::NUM_GENDERS);
const unit_type *u_type = unit_types.find(child["type"]);
if (!u_type) {