Check IDs match before re-using an existing fake_unit. IDs can be different in the situation described by bug #20299, where the user selects the next unit while planning a move.
This commit is contained in:
Wedge009 2015-10-11 01:08:06 +11:00
parent 7e57ab0059
commit 3c4d8f1f67

View file

@ -713,7 +713,9 @@ void manager::create_temp_move()
if(path.size() >= 2)
{
if(!fake_unit)
// Bug #20299 demonstrates a situation where an incorrect fake/ghosted unit can be used.
// So before assuming that a pre-existing fake_unit can be re-used, check that its ID matches the unit being moved.
if(!fake_unit || fake_unit.get_unit_ptr()->id() != temp_moved_unit->id())
{
// Create temp ghost unit
fake_unit = fake_unit_ptr(unit_ptr (new unit(*temp_moved_unit)), resources::fake_units);