anchor.diff:  
   
   destructor TKMCityPlanner.Destroy();
  -begin
  +var
  +  HT: TKMHouseType;
  +  I, K, Len: Integer;
  +begin
  +  for HT := HOUSE_MIN to HOUSE_MAX do
  +    for I := 0 to fPlannedHouses[HT].Count - 1 do
  +      if (fPlannedHouses[HT].Plans[I].House <> nil) then
  +        gHands.CleanUpHousePointer(fPlannedHouses[HT].Plans[I].House);
     fRoadPlanner.Free;
     fForestsNearby.Free;
     fRoadShortcutPlanner.Free;
  
positive.code:   Output := False;
    BestBid := MAX_BID;
    for I := fPlannedHouses[aHT].Count - 1 downto 0 do
      if not fPlannedHouses[aHT].Plans[I].Placed then
      begin
        if fPlannedHouses[aHT].Plans[I].RemoveTreeInPlanProcedure OR gAIFields.Eye.CanAddHousePlan(fPlannedHouses[aHT].Plans[I].Loc, aHT, True, True) then
        begin
          if (aHT in [ht_GoldMine, ht_IronMine, ht_CoalMine, ht_Quary]) AND CheckMine(I) then // Filter mines / chop-only woodcutters
            continue;
          Bid := DistFromStore(fPlannedHouses[aHT].Plans[I].Loc) + ObstaclesInHousePlan(aHT, fPlannedHouses[aHT].Plans[I].Loc);
          if  (aHT = ht_Woodcutters) then
          begin
            SpecPoint := fPlannedHouses[aHT].Plans[I].SpecPoint;
            Bid := Bid - Byte(gAIFields.Influences.AvoidBuilding[SpecPoint.Y, SpecPoint.X] = 0) * CHOP_ONLY_ADVANTAGE; // Chop only mode
          end;
          if (Bid < BestBid) then
          begin
            BestBid := Bid;
            BestIdx := I;
          end;
          break;
        end
        else
          RemovePlan(aHT, I);
      end;
    if (BestBid <> MAX_BID) then
    begin
      aLoc := fPlannedHouses[aHT].Plans[BestIdx].Loc;
  
negative.code:       HT := H.HouseType;
        CheckExistHouse := False;
        for K := 0 to fPlannedHouses[HT].Count - 1 do
          if KMSamePoint(fPlannedHouses[HT].Plans[K].Loc, H.Entrance) then
          begin
            if (fPlannedHouses[HT].Plans[K].House <> H) then
            begin
              // Make sure that reservation is no longer used
              gHands[fOwner].AI.CityManagement.Builder.UnlockHouseLoc(HT, H.Entrance);
              if (fPlannedHouses[HT].Plans[K].House <> nil) then
                gHands.CleanUpHousePointer(fPlannedHouses[HT].Plans[K].House);
              fPlannedHouses[HT].Plans[K].House := H.GetHousePointer;
            end;
            CheckExistHouse := True;
            break;
          end;
        if not CheckExistHouse then // House was added by script / spectator in debug mode
        begin
          if (HT = ht_Woodcutters) then
            AddPlan(HT, H.Entrance, TKMHouseWoodcutters(H).FlagPoint, TKMHouseWoodcutters(H).WoodcutterMode = wcm_Chop)
          else
            AddPlan(HT, H.Entrance);
        end;
      end;
    end;
    // Check if are existing houses completed / destroyed
    for HT := Low(fPlannedHouses) to High(fPlannedHouses) do
    begin
      SumCalculated := fPlannedHouses[HT].Count;
      for I := 0 to fPlannedHouses[HT].Count - 1 do
        with fPlannedHouses[HT].Plans[I] do
        begin
          Placed := ((House <> nil) AND not House.IsDestroyed) OR gHands[fOwner].BuildList.HousePlanList.ExistPlan(Loc, HT);
          if Placed then // House was placed
          begin
            if (HT = ht_Woodcutters) AND (House <> nil) AND (House.IsComplete) then
              CheckWoodcutter(fPlannedHouses[HT].Plans[I], CheckChopOnly);
          end
          else if (HouseReservation OR RemoveTreeInPlanProcedure) then // House was reserved
          begin
            // Do nothing
          end
          else // House was destroyed
          begin
            SumCalculated := SumCalculated - 1;
          end;
        end;
      fPlannedHouses[HT].Calculated := SumCalculated;
    end;
  end;
  
  