mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 01:29:50 +00:00
Fix walk and fight with formations.
Introduced in c87229aa48, FindWalkAndFightTargets returns after the
first UnitAI finds a target, instead of also querying the rest of the
members.
Differential revision: https://code.wildfiregames.com/D4208
Comments by: @Stan, @wraitii
Fixes: #6260
This was SVN commit r25847.
This commit is contained in:
@@ -5961,16 +5961,12 @@ UnitAI.prototype.FindWalkAndFightTargets = function()
|
||||
{
|
||||
if (this.IsFormationController())
|
||||
{
|
||||
let cmpUnitAI;
|
||||
let foundSomething = false;
|
||||
let cmpFormation = Engine.QueryInterface(this.entity, IID_Formation);
|
||||
for (let ent of cmpFormation.members)
|
||||
{
|
||||
if (!(cmpUnitAI = Engine.QueryInterface(ent, IID_UnitAI)))
|
||||
continue;
|
||||
if (cmpUnitAI.FindWalkAndFightTargets())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
for (const ent of cmpFormation.members)
|
||||
if (Engine.QueryInterface(ent, IID_UnitAI)?.FindWalkAndFightTargets())
|
||||
foundSomething = true;
|
||||
return foundSomething;
|
||||
}
|
||||
|
||||
let cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|
||||
|
||||
Reference in New Issue
Block a user