1
0
forked from 0ad/0ad

Cleanup deprecated SM-specific syntax in ExtractFormations in Commands.js

This piece of code used Array comprehensions, since deprecated, and
removed in Firefox 58. See
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Array_comprehensions

Patch By: smiley
Reviewed By: elexis
Differential Revision: https://code.wildfiregames.com/D1724
This was SVN commit r22199.
This commit is contained in:
wraitii 2019-04-20 15:34:40 +00:00
parent def47cb7ae
commit 6225377c4d

View File

@ -897,9 +897,7 @@ function ExtractFormations(ents)
entities.push(ent);
}
var ids = [ id for (id in members) ];
return { "entities": entities, "members": members, "ids": ids };
return { "entities": entities, "members": members };
}
/**
@ -1473,11 +1471,12 @@ function GetFormationUnitAIs(ents, player, formationTemplate)
var formation = ExtractFormations(formedEnts);
var formationUnitAIs = [];
if (formation.ids.length == 1)
let formationIds = Object.keys(formation.members);
if (formationIds.length == 1)
{
// Selected units either belong to this formation or have no formation
// Check that all its members are selected
var fid = formation.ids[0];
var fid = formationIds[0];
var cmpFormation = Engine.QueryInterface(+fid, IID_Formation);
if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length
&& cmpFormation.GetMemberCount() == formation.entities.length)