anchor.diff:        //fAreas[Y,X] := Max(0, Min(255,cnt) * Byte(  gRes.Tileset.TileIsWalkable( gTerrain.Land[Y, X].Terrain )  ));
       end;
     end;
  +  //procedure InitAreas();
  +  //const
  +  //  RAD = 4;
  +  //  MAX_ELEMENTS = (RAD*2+1) * (RAD*2+1);
  +  //  COEF = Round(255 / MAX_ELEMENTS - 0.5);
  +  //var
  +  //  X,Y, X0,Y0, cnt: Integer;
  +  //begin
  +  //  for Y := 1 to fMapY - 1 do
  +  //  for X := 1 to fMapX - 1 do
  +  //  begin
  +  //    cnt := MAX_ELEMENTS;
  +  //    for Y0 := Max(1, Y - RAD) to Min(Y + RAD, fMapY - 1) do
  +  //    for X0 := Max(1, X - RAD) to Min(X + RAD, fMapX - 1) do
  +  //      cnt := cnt - Byte(  not gRes.Tileset.TileIsWalkable( gTerrain.Land[Y0, X0].Terrain )  );
  +  //    fAreas[Y,X] := Max(0, Min(255,cnt) * Byte(  gRes.Tileset.TileIsWalkable( gTerrain.Land[Y, X].Terrain )  ));
  +  //  end;
  +  //end;
     //procedure InitNavMeshAreas();
     //var
     //  WAD: TKMWalkableAreasDetector;
  
positive.code: 
      if (Cnt > 0) then
        //fFloodFill.MilitaryPresence(aPL, gAIFields.Eye.ArmyEvaluation.GroupStrength(G), MAX_DISTANCE, Cnt-1, G.GroupType, PointArr);
        fFloodFill.MilitaryPresence(aPL, Max(G.Count,30), MAX_DISTANCE, Cnt-1, G.GroupType, PointArr);
    end;
  end;
  
  
negative.code: procedure TKMInfluences.AddAvoidBuilding(aX,aY: Word; aRad: Single; aValue: Byte = 255; aDecreasing: Boolean = False; aDecreaseSpeed: Single = 1);
  var
    X,Y: Integer;
    SqrDist, SqrMaxDist: Single;
  begin
    if (aRad = 0) then
      Exit;
    SqrMaxDist := Sqr(aRad);
    for Y := Max(aY - Ceil(aRad), 1) to Min(aY + Ceil(aRad), fMapY - 1) do
    for X := Max(aX - Ceil(aRad), 1) to Min(aX + Ceil(aRad), fMapX - 1) do
      if (AvoidBuilding[Y,X] = 0) OR (AvoidBuilding[Y,X] >= AVOID_BUILDING_FOREST_MINIMUM) then // Protect reservation tiles
      begin
        SqrDist := Sqr(aX-X) + Sqr(aY-Y);
        if (SqrDist <= SqrMaxDist) then
        begin
          if aDecreasing then
            //AvoidBuilding[Y,X] := Min(AvoidBuilding[Y,X] + Max(0, Round((1 - Dist * MaxDistInv) * aValue)), 255)
            AvoidBuilding[Y,X] := Min(AvoidBuilding[Y,X] + Max(0, Round(aValue - SqrDist * aDecreaseSpeed)), 255)
          else
            AvoidBuilding[Y,X] := Min(AvoidBuilding[Y,X] + aValue, 255);
        end;
  