anchor.diff:  
     // Get closest mine
     function FindPlaceForMine(aMine: THouseType): Boolean;
  +  const
  +    BEST_BID = -10000;
     var
       Output: Boolean;
  -    Loc: TKMPoint;
  +    I, BestIdx: Integer;
       Bid, BestBid: Single;
  -  begin
  -    Output := gAIFields.Eye.GetMineLoc(aMine, Loc);
  -    if Output then
  -      AddPlan(aHT, Loc);
  -    Result := Output
  +    Locs: TKMPointTagList;
  +  begin
  +    Output := False;
  +    Locs := gAIFields.Eye.GetMineLocs(aMine);
  +    try
  +      if (Locs.Count > 0) then
  +      begin
  +        Locs.SortByTag();
  +        BestBid := BEST_BID;
  +        for I := Locs.Count-1 downto 0 do
  +        begin
  +          Bid := Locs.Tag[I] + DistCrit(aMine, Locs.Items[I]) * 10;
  +          if (Bid > BestBid) then
  +          begin
  +            BestIdx := I;
  +            BestBid := Bid;
  +          end;
  +        end;
  +        if (BestBid <> BEST_BID) then
  +        begin
  +          AddPlan(aHT, Locs.Items[BestIdx]);
  +          Output := True;
  +        end;
  +      end;
  +    finally
  +      Locs.Free;
  +    end;
  +    Result := Output;
     end;
   
     // Determine whether are coal tiles under coal mine plan in aCoalLoc
  -  function IsCoalUnderPlan(aCoalLoc: TKMPoint): Boolean;
  -  var
  -    Output: Boolean;
  +  function CoalUnderPlan(aCoalLoc: TKMPoint): Byte;
  +  var
  +    Output: Byte;
       X,Y,I: Integer;
       HMA: THouseMappingArray;
     begin
  -    Output := True;
  +    Output := 0;
       HMA := gAIFields.Eye.HousesMapping;
       for I := Low(HMA[ht_CoalMine].Tiles) to High(HMA[ht_CoalMine].Tiles) do
       begin
         X := aCoalLoc.X + HMA[ht_CoalMine].Tiles[I].X;
         Y := aCoalLoc.Y + HMA[ht_CoalMine].Tiles[I].Y;
  -      if not (gTerrain.TileIsCoal(X, Y) > 1) then
  -      begin
  -        Output := False;
  -        break;
  -      end;
  +      Output := Output + Byte(gTerrain.TileIsCoal(X, Y) > 1);
       end;
       Result := Output;
     end;
   
     // Coal mine planner
     function FindPlaceForCoalMine(): Boolean;
  +  const
  +    BEST_BID = -10000;
     var
       Output: Boolean;
  -    I: Integer;
  +    Coal: Byte;
  +    I, BestIdx: Integer;
  +    Bid, BestBid: Single;
       Locs: TKMPointTagList;
     begin
       Output := False;
  
positive.code:       FieldLoc := KMPointAdd(aLoc, HMA[HT].Surroundings[Dist,Dir,I]);
        if gTerrain.TileInMapCoords(FieldLoc.X, FieldLoc.Y)                         // Tile must be in map
          AND gHands[fOwner].CanAddFieldPlan(FieldLoc, ft_Wine)                     // Plan can be placed
          AND (gAIFields.Influences.AvoidBuilding[FieldLoc.Y, FieldLoc.X] = 0) then // Tile is not reserved
          aNodeList.Add(FieldLoc);
        if (aNodeList.Count >= MAX_VINE) then
          Exit;
  
negative.code:   // Add plan
    with fPlannedHouses[aHT].Plans[ fPlannedHouses[aHT].Count ] do
    begin
      Placed := False;
      ShortcutsCompleted := False;
      RemoveTreeInPlanProcedure := False;
  