Ticket #1255: #1255-2012-03-28.patch
File #1255-2012-03-28.patch, 1.3 KB (added by , 12 years ago) |
---|
-
binaries/data/mods/public/simulation/helpers/Commands.js
445 445 { 446 446 var entities = []; // subset of ents that have UnitAI 447 447 var members = {}; // { formationentity: [ent, ent, ...], ... } 448 var noFormation = false; 448 449 for each (var ent in ents) 449 450 { 450 451 var cmpUnitAI = Engine.QueryInterface(ent, IID_UnitAI); … … 455 456 members[fid] = []; 456 457 members[fid].push(ent); 457 458 } 459 else 460 { 461 noFormation = true; 462 } 458 463 entities.push(ent); 459 464 } 460 465 461 466 var ids = [ id for (id in members) ]; 467 // If we encountered a unit that isn't part of a formation we add it to ids 468 // to prevent bug #1255. 469 if (noFormation) 470 ids.push(null); 462 471 463 472 return { "entities": entities, "members": members, "ids": ids }; 464 473 } … … 533 542 if (formation.ids.length == 1) 534 543 { 535 544 // Selected units all belong to the same formation. 536 // Check that it doesn't have any othermembers545 // Check that we have all its members 537 546 var fid = formation.ids[0]; 538 547 var cmpFormation = Engine.QueryInterface(+fid, IID_Formation); 539 548 if (cmpFormation && cmpFormation.GetMemberCount() == formation.entities.length)