Resource supply corpses won't have UnitAI and should never be in formations.

This was SVN commit r12541.
This commit is contained in:
Deiz 2012-08-27 23:14:10 +00:00
parent 205792ddd3
commit dd40cc023e

View File

@ -614,13 +614,15 @@ Formation.prototype.OnGlobalEntityRenamed = function(msg)
{
if (this.members.indexOf(msg.entity) != -1)
{
this.members[this.members.indexOf(msg.entity)] = msg.newentity;
var cmpNewUnitAI = Engine.QueryInterface(msg.newentity, IID_UnitAI);
if (cmpNewUnitAI)
this.members[this.members.indexOf(msg.entity)] = msg.newentity;
var cmpOldUnitAI = Engine.QueryInterface(msg.entity, IID_UnitAI);
cmpOldUnitAI.SetFormationController(INVALID_ENTITY);
var cmpNewUnitAI = Engine.QueryInterface(msg.newentity, IID_UnitAI);
cmpNewUnitAI.SetFormationController(this.entity);
if (cmpNewUnitAI)
cmpNewUnitAI.SetFormationController(this.entity);
}
}