1
0
forked from 0ad/0ad

Remove members from a formation when they garrison. Fixes #2545

This was SVN commit r15181.
This commit is contained in:
sanderd17 2014-05-20 17:47:47 +00:00
parent 672f5a8b11
commit 317c6057ed

View File

@ -2792,6 +2792,21 @@ var UnitFsmSpec = {
if (cmpGarrisonHolder.Garrison(this.entity)) if (cmpGarrisonHolder.Garrison(this.entity))
{ {
this.isGarrisoned = true; this.isGarrisoned = true;
if (this.formationController)
{
var cmpFormation = Engine.QueryInterface(this.formationController, IID_Formation);
if (cmpFormation)
{
// disable rearrange for this removal,
// but enable it again for the next
// move command
var rearrange = cmpFormation.rearrange;
cmpFormation.SetRearrange(false);
cmpFormation.RemoveMembers([this.entity]);
cmpFormation.SetRearrange(rearrange);
}
}
// Check if we are garrisoned in a dropsite // Check if we are garrisoned in a dropsite
var cmpResourceDropsite = Engine.QueryInterface(target, IID_ResourceDropsite); var cmpResourceDropsite = Engine.QueryInterface(target, IID_ResourceDropsite);