anchor.diff:  begin
     fCityUnderAttack := False;
     // Check defensive line
  -  for I := 0 to Length(fDefPolyFirstLine) - 1 do
  -  begin
  -    Threat := 0;
  -    Idx := fDefPolyFirstLine[I];
  -    for GT := Low(TKMGroupType) to High(TKMGroupType) do
  -      Threat := Threat + gAIFields.Influences.EnemyGroupPresence[ fOwner, Idx, GT ];
  -    if (Threat > 0) then
  -    begin
  -      fCityUnderAttack := True;
  -      Loc := gAIFields.NavMesh.Polygons[Idx].CenterPoint;
  -      if not IsCompanyAround(Loc) then
  +
  +  for I := 0 to fPositions.Count - 1 do
  +    if (Positions[I].Line = 0) then
  +    begin
  +      Threat := 0;
  +      Loc := Positions[I].Position.Loc;
  +      Idx := gAIFields.NavMesh.KMPoint2Polygon[Loc];
  +      for GT := Low(TKMGroupType) to High(TKMGroupType) do
  +        Threat := Threat + gAIFields.Influences.EnemyGroupPresence[ fOwner, Idx, GT ];
  +      if (Threat > 0) then
         begin
  -        UGA := gHands.GetGroupsInRadius(Loc, SQR_FIRST_LINE_RADIUS, fOwner, at_Enemy);
  -        if (Length(UGA) > 0) then
  +        fCityUnderAttack := True;
  +        if not IsCompanyAround(Loc) then
           begin
  -          UGA := FindDefenceGroups(Loc);
  +          UGA := gHands.GetGroupsInRadius(Loc, SQR_FIRST_LINE_RADIUS, fOwner, at_Enemy);
             if (Length(UGA) > 0) then
  -            fAttack.CreateCompany(Loc, UGA, cm_Defence);
  +          begin
  +            UGA := FindDefenceGroups(Loc);
  +            if (Length(UGA) > 0) then
  +              fAttack.CreateCompany(Loc, UGA, cm_Defence);
  +          end;
           end;
         end;
       end;
  -  end;
     // Check every group
     for I := 0 to Length(aEnemyGroups) - 1 do
     begin
  
positive.code:     fCityUnderAttack: Boolean;
      fFirstLineCnt: Word;
      fPositions: TKMList;
      fDefPolyFirstLine: TKMWordArray;
  
      fAttack: TKMArmyAttack;
  
      function GetCount: Integer; inline;
      function GetPosition(aIndex: Integer): TKMDefencePosition; inline;
      procedure UpdateDefences();
    public
      TroopFormations: array [TKMGroupType] of TKMFormation; //Defines how defending troops will be formatted. 0 means leave unchanged.
  
      constructor Create(aPlayer: TKMHandIndex; aAttack: TKMArmyAttack; aHostileGroups: TList);
      destructor Destroy; override;
      procedure Save(SaveStream: TKMemoryStream);
      procedure Load(LoadStream: TKMemoryStream);
  
negative.code: begin
    SaveStream.WriteA('DefencePosition');
    SaveStream.Write(fWeight);
    SaveStream.Write(fLine);
    SaveStream.Write(fPosition);
    if (fGroup <> nil) then
      SaveStream.Write(fGroup.UID) //Store ID
  