anchor.diff:            GT := BEST_TARGET[  UGA[ fTargetU[I].Index ].GroupType, K  ];
             if (GT = gt_Ranged) then // Skip ranged groups
               continue;
  -          while (fTargetU[I].CloseThreat > 0) AND (AvaiableSquads[GT].Count > 0) do
  +          while (fTargetU[I].CloseThreat > 0) AND (AvailableSquads[GT].Count > 0) do
             begin
               BestDist := 100000;
  -            for L := 0 to AvaiableSquads[GT].Count - 1 do
  +            for L := 0 to AvailableSquads[GT].Count - 1 do
               begin
  -              Dist := KMDistanceSqr(AvaiableSquads[GT].Squads[L].Position, UA[ fTargetU[I].Index ].GetPosition);
  +              Dist := KMDistanceSqr(AvailableSquads[GT].Squads[L].Position, UA[ fTargetU[I].Index ].GetPosition);
                 if (Dist < BestDist) then
                 begin
                   BestDist := Dist;
  
positive.code:         // Unit will be targeted by Ranged group -> if there was minimal priority for close combat then remove it
          if (fTargetU[TargetIdx].CloseThreat = 1) then
            fTargetU[TargetIdx].CloseThreat := 0;
          Dec(AvaiableSquads[GT].Count);
          AvaiableSquads[GT].Squads[I] := AvaiableSquads[GT].Squads[ AvaiableSquads[GT].Count ];
        end
        else
          Squad.TargetUnit := nil;
  
negative.code:     begin
        if (GT = gt_Ranged) then
          continue;
        for I := AvailableSquads[GT].Count - 1 downto 0 do
        begin
          BestDist := INIT_THREAT;
          for K := 0 to Length(HA) - 1 do
            if (
                 (HA[K].HouseType <> htWatchTower)
                 OR ( KMDistanceAbs(AvailableSquads[GT].Squads[I].Position, HA[K].GetPosition) < ATTACK_WATCHTOWER_WITH_CLOSE_COMBAT_DIST)
               )
              AND (GroupAttackCnt[K] < MAX_SOLDIERS_VS_HOUSE) then
            begin
              Dist := KMDistanceSqr(AvailableSquads[GT].Squads[I].Position, HA[K].GetPosition);
              if (Dist > BestDist) AND (Dist <= SQR_CLOSE_COMBAT_DISTANCE_LIMIT) then
              begin
                BestDist := Dist;
  