1
0
forked from mirrors/0ad

Fix oversight from 832501fc9b and b93634fb28

When merging twin formations, the calls to AddMembers()
and RemoveMembers() got inverted. RemoveMembers()
calls UnsetFormationController() on each member, which overwrites
the formation controller reference just set by AddMembers() to
INVALID_ENTITY.
This commit is contained in:
Atrik
2026-03-20 15:02:57 +01:00
committed by Vantha
parent 8a9dd76bc0
commit 73f7884b4a
@@ -1015,10 +1015,10 @@ Formation.prototype.UpdateTwinFormationsForMerge = function()
continue;
const otherMembers = cmpOtherFormation.members;
// Merge the members from the other formation into this one
this.AddMembers(otherMembers, true);
// The other formation will get disbanded for having no members
cmpOtherFormation.RemoveMembers(otherMembers);
// Merge the members from the other formation into this one
this.AddMembers(otherMembers, true);
// Remove the merged formation from twin formations list
this.twinFormations.splice(i, 1);