Hopefully smarter and more even overwatch position finding.

Seeks out positions that aren't visible by other pawns in the AO.
INEPT_fnc_visibilityQuality tests more points in about the same amount of time
by avoiding INEPT_fnc_rotatedVector which is slow.
M ineptifex/fn_configurePawnWaypoint.sqf +1 -4
@@ 208,12 208,9 @@ case WP_TYPE_OVERWATCH:
     private _idx =
         [_samples, {
             private _asl_pos = [_x select 0, _x select 1, getTerrainHeightASL _x];
-            LOGVAR(_asl_pos);
             private _quality = [_asl_pos] call INEPT_fnc_visibilityQuality;
             private _vision = 1 + ([_ao, _asl_pos, _pawn] call INEPT_fnc_hasVision);
-            LOGVAR(_quality);
-            LOGVAR(_vision);
-            (_quality / _vision)
+            (_quality / _vision ^ 1.5)
         }] call INEPT_fnc_indexOfBest;
 
     LOGVAR(_idx);

          
M ineptifex/fn_hasVision.sqf +1 -2
@@ 10,11 10,10 @@ 
 
 //#define DEBUG_VAR "INEPT_fnc_hasVision_is_verbose"
 
-#define ELEVATION   1
+#define ELEVATION   2
 
 #include "common\defines.h"
 #include "data.h"
-#include "behaviordata.h"
 
 params ["_ao", "_to_pos", "_omit_pawn"];
 

          
M ineptifex/fn_rotatedVector.sqf +1 -5
@@ 8,14 8,10 @@ 
  *  Returns argument 0 rotated around the z axis by argument 1 degrees.
  */
 
-#define DEBUG_VAR "INEPT_fnc_rotatedVector_is_verbose"
-
 #include "common\defines.h"
 #include "data.h"
 
-LOGENTRY();
-VAR(_vec) = ARGUMENT_0;
-VAR(_theta) = ARGUMENT_1;
+params ["_vec", "_theta"];
 if (_theta == 0) exitWith {_vec};
 if (count _vec == 2) then
 {

          
M ineptifex/fn_visibilityQuality.sqf +18 -23
@@ 17,11 17,7 @@ 
 #include "common\defines.h"
 #include "data.h"
 
-#define NUM_SLICES  8
-#define DIST_NEAR   100
-#define DIST_MID    400
-#define DIST_FAR    1200
-#define ELEVATION   1
+#define ELEVATION   2
 
 LOGENTRY();
 

          
@@ 31,30 27,29 @@ params ["_origin"];
 // underneath the terrain then we won't intersect it
 _origin = _origin vectorAdd [0, 0, ELEVATION];
 
-private _inc = 360 / NUM_SLICES;
 private _q = 0;
+private _checks =
+// >>> rotate_vec = lambda x, y, d: (x * math.cos(d) - y * math.sin(d), x * math.sin(d) + y * math.cos(d))
+// >>> sum([[[round(x, 4), round(y, 4), 0] for (x,y) in [thingy(dist, 0, math.pi/180*d) for d in range(0,360,30)]] for dist in [350, 600, 1100, 1500]], [])
+[[350.0, 0.0, 0], [303.1089, 175.0, 0], [175.0, 303.1089, 0], [0.0, 350.0, 0], [-175.0, 303.1089, 0], [-303.1089, 175.0, 0], [-350.0, 0.0, 0], [-303.1089, -175.0, 0], [-175.0, -303.1089, 0], [-0.0, -350.0, 0], [175.0, -303.1089, 0], [303.1089, -175.0, 0], [600.0, 0.0, 0], [519.6152, 300.0, 0], [300.0, 519.6152, 0], [0.0, 600.0, 0], [-300.0, 519.6152, 0], [-519.6152, 300.0, 0], [-600.0, 0.0, 0], [-519.6152, -300.0, 0], [-300.0, -519.6152, 0], [-0.0, -600.0, 0], [300.0, -519.6152, 0], [519.6152, -300.0, 0], [1100.0, 0.0, 0], [952.6279, 550.0, 0], [550.0, 952.6279, 0], [0.0, 1100.0, 0], [-550.0, 952.6279, 0], [-952.6279, 550.0, 0], [-1100.0, 0.0, 0], [-952.6279, -550.0, 0], [-550.0, -952.6279, 0], [-0.0, -1100.0, 0], [550.0, -952.6279, 0], [952.6279, -550.0, 0], [1500.0, 0.0, 0], [1299.0381, 750.0, 0], [750.0, 1299.0381, 0], [0.0, 1500.0, 0], [-750.0, 1299.0381, 0], [-1299.0381, 750.0, 0], [-1500.0, 0.0, 0], [-1299.0381, -750.0, 0], [-750.0, -1299.0381, 0], [-0.0, -1500.0, 0], [750.0, -1299.0381, 0], [1299.0381, -750.0, 0]]
+;
+private _num_checks = count _checks;
 
 {
-    private _vec = [0, _x, 0];
-    for "_i" from 0 to (NUM_SLICES - 1) do
+    private _dest = _origin vectorAdd _x;
+    private _terrain_height = getTerrainHeightASL _dest;
+    _dest set [2, (0 max _terrain_height) + ELEVATION];
+    if !(terrainIntersectASL [_origin, _dest]) then
     {
-        private _delta = [_vec, _inc * _i] call INEPT_fnc_rotatedVector;
-        private _dest = _origin vectorAdd _delta;
-        private _terrain_height = getTerrainHeightASL _dest;
-        _dest set [2, (0 max _terrain_height) + ELEVATION];
-        if !(terrainIntersectASL [_origin, _dest]) then
+        private _score = 1 / _num_checks;
+        if (_terrain_height <= 0) then
         {
-            private _score = 1 / NUM_SLICES / 2;
-            if (_terrain_height <= 0) then
-            {
-                // Water counts for less, we don't really need to watch it
-                // because they would never attack by sea ...
-                _score = _score * 0.3;
-            };
-            _q = _q + _score;
+            // Water counts for less, we don't really need to watch it
+            // because they would never attack by sea ...
+            _score = _score * 0.3;
         };
+        _q = _q + _score;
     };
 }
-forEach [DIST_NEAR, DIST_MID, DIST_FAR];
-
+forEach _checks;
 _q