Make sure units in INDIVIDUAL state don't belong to a formation. Should fix #2380

This was SVN commit r14581.
This commit is contained in:
sanderd17
2014-01-14 08:58:11 +00:00
parent 0f56dceef2
commit e98478b68c
@@ -1334,6 +1334,14 @@ var UnitFsmSpec = {
// Sanity-checking
if (this.IsAnimal())
error("Animal got moved into INDIVIDUAL.* state");
// an entity in individual state shouldn't belong to a formation
if (this.IsFormationMember())
{
var cmpFormation = Engine.QueryInterface(this.formationController, IID_Formation);
if (cmpFormation)
cmpFormation.RemoveMembers([this.entity]);
}
},
"Attacked": function(msg) {