anchor.diff:  
   procedure TKMayor.PlanDefenceTowers;
   const
  -  DISTANCE_BETWEEN_TOWERS = 10;
  +  DISTANCE_BETWEEN_TOWERS = 7;
   var
     P: TKMHand;
  -  Outline1, Outline2: TKMWeightSegments;
  +  pom: boolean;
  +  //Outline1, Outline2: TKMWeightSegments;
     I, K, DefCount: Integer;
  -  Loc: TKMPoint;
  -  SegLength, Ratio: Single;
  -begin
  -  if fDefenceTowersPlanned then Exit;
  +  // DefCount: Integer;
  +  Point1, Point2: TKMPoint;
  +  //Loc: TKMPoint;
  +  Ratio: Single;
  +  //SegLength: Single;
  +  DefLines: TKMDefenceLines;
  +begin
  +  if fDefenceTowersPlanned then
  +    Exit;
     fDefenceTowersPlanned := True;
     P := gHands[fOwner];
  -  if not P.Locks.HouseCanBuild(ht_WatchTower) then Exit;
  +  if not P.Locks.HouseCanBuild(ht_WatchTower) then
  +    Exit;
  +  pom := not gAIFields.NavMesh.Defences.FindDefenceLines(fOwner, DefLines) OR (DefLines.Count < 1);
  +  if pom then
  +    Exit;
  +
  +  for I := 0 to DefLines.Count - 1 do
  +    with DefLines.Lines[I] do
  +    begin
  +      Point1 := gAIFields.NavMesh.Nodes[ DefLines.Lines[I].Nodes[0] ].Loc;
  +      Point2 := gAIFields.NavMesh.Nodes[ DefLines.Lines[I].Nodes[1] ].Loc;
  +      DefCount := Ceil( KMLength(Point1, Point2) / DISTANCE_BETWEEN_TOWERS );
  +      for K := 0 to DefCount - 1 do
  +      begin
  +        Ratio := (K + 1) / (DefCount + 1);
  +        fDefenceTowers.Add( KMPointRound(KMLerp(Point1, Point2, Ratio)), gAIFields.Influences.GetBestAllianceOwnership(fOwner, Polygon, at_Enemy));
  +      end;
  +    end;
   
     //Get defence Outline with weights representing how important each segment is
     //gAIFields.NavMesh.GetDefenceOutline(fOwner, Outline1, Outline2);
  +
     //Make list of defence positions
  -  for I := 0 to High(Outline2) do
  -  begin
  -    //Longer segments will get several towers
  -    SegLength := KMLength(Outline2[I].A, Outline2[I].B);
  -    DefCount := Max(Trunc(SegLength / DISTANCE_BETWEEN_TOWERS), 1);
  -    for K := 0 to DefCount - 1 do
  -    begin
  -      Ratio := (K + 1) / (DefCount + 1);
  -      Loc := KMPointRound(KMLerp(Outline2[I].A, Outline2[I].B, Ratio));
  -      fDefenceTowers.Add(Loc, Trunc(1000*Outline2[I].Weight));
  -    end;
  -  end;
  +  //for I := 0 to High(Outline2) do
  +  //begin
  +  //  //Longer segments will get several towers
  +  //  SegLength := KMLength(Outline2[I].A, Outline2[I].B);
  +  //  DefCount := Max(Trunc(SegLength / DISTANCE_BETWEEN_TOWERS), 1);
  +  //  for K := 0 to DefCount - 1 do
  +  //  begin
  +  //    Ratio := (K + 1) / (DefCount + 1);
  +  //    Loc := KMPointRound(KMLerp(Outline2[I].A, Outline2[I].B, Ratio));
  +  //    fDefenceTowers.Add(Loc, Trunc(1000*Outline2[I].Weight));
  +  //  end;
  +  //end;
     fDefenceTowers.SortByTag;
     fDefenceTowers.Inverse; //So highest weight is first
   end;
  
positive.code:   KM_AIMayorBalance, KM_AICityPlanner, KM_AISetup,
    KM_PathfindingRoad,
    KM_ResHouses, KM_HouseCollection,
    KM_CommonClasses, KM_Defaults, KM_Points;
  
  
  type
  
negative.code: procedure TKMayor.TryBuildDefenceTower;
  const
    SEARCH_RAD = 6;
    MAX_ROAD_DISTANCE = 50;
  var
    P: TKMHand;
    IY, IX: Integer;
  