anchor.diff:    // ForceToAttack := ForceToAttack OR (gGame.MissionMode = mm_Tactic); // Maybe force attack in mm_Tactic map? But some of mm_Tactic map are also defensive...
   
     // Get array of pointers to available groups
  -  AG.Count := 0;
  -  SetLength(AG.GroupArr, 4);
  -  SetLength(AG.Price, 4);
     for I := 0 to gHands[fOwner].UnitGroups.Count - 1 do
     begin
       Group := gHands[fOwner].UnitGroups[I];
  -    if (Group = nil)
  -      OR Group.IsDead
  +    if Group.IsDead
         OR not Group.IsIdleToAI([wtokFlagPoint, wtokHaltOrder])
         OR (not TakeAllIn AND (Group.Count < MIN_TROOPS_IN_GROUP)) then
         Continue;
       // Add grop pointer to array (but dont increase count now so it will be ignored)
  -    if (Length(AG.GroupArr) <= AG.Count) then
  -    begin
  -      SetLength(AG.GroupArr, AG.Count + 16);
  -      SetLength(AG.Price, AG.Count + 16);
  -    end;
  -    AG.GroupArr[AG.Count] := Group;
  -    AG.Price[AG.Count] := 0;
  +    with AG do
  +    begin
  +      if (Length(GroupArr) <= Count) then
  +      begin
  +        SetLength(GroupArr, Count + 16);
  +        SetLength(Price, Count + 16);
  +      end;
  +      GroupArr[Count] := Group;
  +      Price[Count] := 0;
  +    end;
       // Check if group can be in array
       if ForceToAttack then
       begin
         // Take all groups out of attack class
         if not fAttack.IsGroupInAction(Group) then
  -        Inc(AG.Count,1); // Confirm that the group should be in array GroupArr
  +        Inc(AG.Count); // Confirm that the group should be in array GroupArr
       end
       else
       begin
  
positive.code:           BestPrice := AG.Price[K];
            BestIdx := K;
          end;
        Dec(AG.Count,1);
        AG.GroupArr[BestIdx] := AG.GroupArr[AG.Count];
        AG.Price[BestIdx] := AG.Price[AG.Count];
      end;
  
    if fAttack.FindBestTarget(TargetOwner, TargetPoint, ForceToAttack) then
    begin
      for I := 0 to AG.Count - 1 do
        fDefence.ReleaseGroup(AG.GroupArr[I]);
      OrderAttack(TargetPoint, AG.Count, AG.GroupArr);
      //if ForceToAttack OR (gAIFields.Eye.ArmyEvaluation.CompareAllianceStrength(TargetOwner, AvailableGroups) > COMPANY_MIN_ATTACK_CHANCE) then
    end;
  
    //Comparison := gAIFields.Eye.ArmyEvaluation.CompareAllianceStrength(fOwner, EnemyStats[I].Player) - (EnemyStats[I].Distance / MinDist - 1) * DISTANCE_COEF;
    //fAttack.AttackChance(AvailableGroups);
  
negative.code:       if (DP <> nil) then
        begin
          AG.Price[AG.Count] := DP.Weight; // Change weight
          Inc(AG.Count); // Confirm that the group should be in array GroupArr
        end;
      end;
    end;
  