anchor.diff:  
   
   procedure TAISquad.UpdateState(aTick: Cardinal);
  -begin
  -
  +var
  +  ActPos, FinPos: TKMPoint;
  +begin
  +  // Check group
  +  if (fGroup = nil) OR fGroup.IsDead then
  +    Exit;
  +  if not fGroup.IsIdleToAI(True) then
  +    Exit;
  +
  +  // Check targets
  +  if (fTargetHouse <> nil) AND (fTargetHouse.IsDestroyed) then
  +    gHands.CleanUpHousePointer(fTargetHouse);
  +  if (fTargetUnit <> nil) AND (fTargetUnit.IsDead) then
  +    gHands.CleanUpUnitPointer(fTargetUnit);
  +
  +  // Do order
  +  //fTimeLimit := aTick;
  +  ActPos := fGroup.Position;
  +  if (fTargetUnit <> nil) then
  +  begin
  +    FinPos := fTargetUnit.GetPosition;
  +    if PlanPath(ActPos, FinPos) then
  +      Group.OrderWalk(FinPos, True, FinalPosition.Dir)
  +    else
  +      Group.OrderAttackUnit(fTargetUnit, True);
  +  end
  +  else if (fTargetHouse <> nil) then
  +  begin
  +    FinPos := fTargetHouse.GetPosition;
  +    if PlanPath(ActPos, FinPos) then
  +      Group.OrderWalk(FinPos, True, FinalPosition.Dir)
  +    else
  +      Group.OrderAttackHouse(fTargetHouse, True);
  +  end
  +  else
  +  begin
  +    FinPos := FinalPosition.Loc;
  +    if PlanPath(ActPos, FinPos) then
  +      Group.OrderWalk(FinPos, True, FinalPosition.Dir)
  +    else
  +      Group.OrderWalk(FinalPosition.Loc, True, FinalPosition.Dir);
  +  end;
  +end;
  +
  +
  +function TAISquad.PlanPath(var aActualPosition, aTargetPosition: TKMPoint): Boolean;
  +const
  +  TARGET_REACHED_TOLERANCE = 6;
  +var
  +  InitPolygon, ClosestPolygon: Word;
  +  I: Integer;
  +  PolygonPath: TKMWordArray;
  +  PointPath: TKMPointArray;
  +begin
  +  Result := False;
  +  fIsReady := False;
  +  if (KMDistanceAbs(aActualPosition, aTargetPosition) < TARGET_REACHED_TOLERANCE) then
  +  begin
  +    fIsReady := True;
  +    Exit;
  +  end;
  +  if gAIFields.Eye.Pathfinding.Route_Make(aActualPosition, aTargetPosition, PolygonPath, PointPath) then
  +  begin
  +    InitPolygon := gAIFields.NavMesh.FindClosestPolygon(aActualPosition);
  +    I := Length(PointPath)-2;
  +    repeat
  +      aTargetPosition := PointPath[ Max(0, I) ];
  +      ClosestPolygon := gAIFields.NavMesh.FindClosestPolygon(aTargetPosition);
  +      I := I - 1;
  +    until (InitPolygon <> ClosestPolygon) OR (I < 0);
  +
  +    fDEBUGPointPath := PointPath;//  DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG
  +  end;
  +  Result := True;
   end;
   
   
  
positive.code: begin
    inherited Create;
    fOwner := aPlayer;
    fPathfinding := TNavMeshPathFinding.Create();
    for GT := Low(TGroupType) to High(TGroupType) do
      fSquads[GT] := TKMList.Create();
  end;
  
  
  destructor TAICompany.Destroy;
  var
    GT: TGroupType;
  begin
    fPathfinding.Free;
    for GT := Low(TGroupType) to High(TGroupType) do
      fSquads[GT].Free;
    inherited;
  end;
  
  
  procedure TAICompany.Save(SaveStream: TKMemoryStream);
  begin
    //SaveStream.Write(fOwner);
  end;
  
  
  procedure TAICompany.Load(LoadStream: TKMemoryStream);
  begin
    //LoadStream.Read(fOwner);
  end;
  
  
  procedure TAICompany.UpdateState(aTick: Cardinal);
  begin
  
  end;
  
  
  
negative.code:   COLOR_RED = $800000FF;
    COLOR_YELLOW = $8000FFFF;
    COLOR_GREEN_Field = $4400FF00;
    COLOR_GREEN_1 = $3355FFFF;
    COLOR_BLUE = $60FF0000;
  var
    I,K,J: Integer;
    Position: TKMPoint;
    GT: TGroupType;
    Company: TAICompany;
    Squad: TAISquad;
  begin
    if (fOwner <> gMySpectator.HandIndex) then // Show just 1 player (it prevents notification to be mess)
      Exit;
    for I := 0 to Count - 1 do
    begin
      Company := fCompanies.Items[I];
      Position := Company.Position;
      gRenderAux.CircleOnTerrain(Position.X, Position.Y, COMPANY_SCAN_RAD, $09FFFFFF, $99FFFFFF);
      if (Length(Company.PointPath) > 0) then
        for K := Length(Company.PointPath)-2 downto 0 do
          gRenderAux.LineOnTerrain(Company.PointPath[K+1], Company.PointPath[K], COLOR_RED);
      for GT := Low(TGroupType) to High(TGroupType) do
        for K := Company.Squads[GT].Count - 1 downto 0 do
        begin
          Squad := Company.Squads[GT].Items[K];
          Position := Squad.Position;
          gRenderAux.CircleOnTerrain(Position.X, Position.Y, 1, $0500FF00, $6600FF00);
          if (Squad.TargetHouse <> nil) then
            gRenderAux.LineOnTerrain(Position, Squad.TargetHouse.GetPosition, $AA6666FF)
          else if (Squad.TargetUnit <> nil) then
            gRenderAux.LineOnTerrain(Position, Squad.TargetUnit.GetPosition, $AA6666FF)
          else if not KMSamePoint(Squad.FinalPosition.Loc,KMPOINT_ZERO) then
          begin
            //gRenderAux.LineOnTerrain(Position, Squad.FinalPosition.Loc, $AAFF5555);
            gRenderAux.CircleOnTerrain(Squad.FinalPosition.Loc.X, Squad.FinalPosition.Loc.Y, 1, $05FF0000, $66FF0000);
            if (Length(Squad.PointPath) > 0) then
              for J := Length(Squad.PointPath)-2 downto 0 do
                gRenderAux.LineOnTerrain(Squad.PointPath[J+1], Squad.PointPath[J], COLOR_BLUE);
          end;
        end;
    end;
    //gRenderAux.LineOnTerrain(P1, P2, $CCFF2222);
    //gRenderAux.CircleOnTerrain(CenterPlatoon.X, CenterPlatoon.Y, 5, $09FFFFFF, $99FFFFFF);
    //gRenderAux.Quad(Loc.X, Loc.Y, Color);
  