Ticket #1884: attack_plan_error.diff

File attack_plan_error.diff, 811 bytes (added by Yves, 11 years ago)
  • binaries/data/mods/public/simulation/ai/qbot-wc/attack_plan.js

     
    344344            if (targets.length) {
    345345                debug ("Aiming for " + targets);
    346346                // picking a target
    347                 var maxDist = 1000000;
     347                var maxDist = -1;
    348348                var index = 0;
    349349                for (i in targets._entities)
    350350                {
    351351                    // we're sure it has a position has TargetFinder already checks that.
    352352                    var dist = SquareVectorDistance(targets._entities[i].position(), this.rallyPoint);
    353                     if (dist < maxDist)
     353                    if (dist < maxDist || maxDist === -1)
    354354                    {
    355355                        maxDist = dist;
    356356                        index = i;