anchor.diff:  
   //Check if specific woodcutters are in Fell only mode
   procedure TKMCityManagement.CheckMarketplaces();
  +var
  +  RequiedCnt, AvaiableCnt: Word;
  +  RequiredWares, AvaiableWares: array of TWareType;
  +  procedure AddWare(aWare: TWareType; IsRequired: Boolean = True);
  +  begin
  +    if IsRequired then
  +    begin
  +      RequiredWares[RequiedCnt] := aWare;
  +      RequiedCnt := RequiedCnt + 1;
  +    end
  +    else
  +    begin
  +      AvaiableWares[AvaiableCnt] := aWare;
  +      AvaiableCnt := AvaiableCnt + 1;
  +    end;
  +  end;
  +
  +  procedure TryBuyItem(aResFrom, aResTo: TWareType);
  +  const
  +    TRADE_QUANTITY = 20;
  +  var
  +    I: Integer;
  +    Houses: TKMHousesCollection;
  +    HM, IdleHM: TKMHouseMarket;
  +  begin
  +    Houses := gHands[fOwner].Houses;
  +    IdleHM := nil;
  +    for I := 0 to Houses.Count - 1 do
  +      if (Houses[I].HouseType = ht_Marketplace)
  +        AND Houses[I].IsComplete
  +        AND not Houses[I].IsDestroyed then
  +      begin
  +        HM := TKMHouseMarket(Houses[I]);
  +        if (TKMHouseMarket(HM).ResOrder[0] <> 0)
  +          AND (HM.ResTo = aResTo) then
  +          Exit
  +        else if HM.AllowedToTrade(aResFrom)
  +          AND HM.AllowedToTrade(aResTo)
  +          AND (TKMHouseMarket(HM).ResOrder[0] = 0) then
  +          IdleHM := HM;
  +      end;
  +    if (IdleHM <> nil) then  // AND (IdleHM.ResFrom <> aResFrom) or (IdleHM.ResTo <> aResTo) then
  +    begin
  +      //IdleHM.ResOrder[0] := 0; //First we must cancel the current trade
  +      IdleHM.ResFrom := aResFrom;
  +      IdleHM.ResTo := aResTo;
  +      IdleHM.ResOrder[0] := TRADE_QUANTITY; //Set the new trade
  +    end;
  +  end;
   const
     SOLD_ORDER: array[0..27] of TWareType = (
       wt_Sausages,     wt_Wine,     wt_Fish,       wt_Bread,
  
positive.code:     wt_Horse,        wt_Corn,     wt_Flour,
      wt_Steel,        wt_Gold,     wt_IronOre,    wt_Coal,     wt_GoldOre
    );
  var
    MarketCnt, RequiedCnt, AvaiableCnt, L: Word;
    RequiredWares, AvaiableWares: array of TWareType;
  
    procedure AddWare(aWare: TWareType; IsRequired: Boolean = True);
    begin
      if IsRequired then
      begin
        RequiredWares[RequiedCnt] := aWare;
        RequiedCnt := RequiedCnt + 1;
      end
      else
      begin
        AvaiableWares[AvaiableCnt] := aWare;
        AvaiableCnt := AvaiableCnt + 1;
      end;
    end;
  
    procedure TryBuyItem(aResFrom, aResTo: TWareType);
    var
      M: Integer;
      Houses: TKMHousesCollection;
      H: TKMHouseMarket;
    begin
      Houses := gHands[fOwner].Houses;
      for M := 0 to Houses.Count - 1 do
        if (Houses[M].HouseType = ht_Marketplace)
          AND Houses[M].IsComplete
          AND not Houses[M].IsDestroyed then
        begin
          H := TKMHouseMarket(Houses[M]);
          if (TKMHouseMarket(H).ResOrder[0] <> 0)
            AND (H.ResTo = aResTo) then
            Exit;
        end;
      for M := 0 to Houses.Count - 1 do
        if (Houses[M].HouseType = ht_Marketplace)
          AND Houses[M].IsComplete
          AND not Houses[M].IsDestroyed then
        begin
          H := TKMHouseMarket(Houses[M]);
          if H.AllowedToTrade(aResFrom)
            AND H.AllowedToTrade(aResTo)
            AND (TKMHouseMarket(H).ResOrder[0] = 0) then
          begin
            if (H.ResFrom <> aResFrom) or (H.ResTo <> aResTo) then
            begin
              //H.ResOrder[0] := 0; //First we must cancel the current trade
              H.ResFrom := aResFrom;
              H.ResTo := aResTo;
              H.ResOrder[0] := 20; //Set the new trade
              break;
            end;
          end;
        end;
    end;
  const
    MIN_GOLD_AMOUNT = LACK_OF_GOLD * 3;
    LACK_OF_STONE = 50;
    SELL_LIMIT = 100;
  begin
  
    MarketCnt := gHands[fOwner].Stats.GetHouseQty(ht_Marketplace);
  
negative.code: 
    AvaiableCnt := 0;
    SetLength(AvaiableWares, RequiedCnt);
    for I := 0 to Length(SOLD_ORDER) - 1 do
      if (AvaiableCnt < RequiedCnt) then
      begin
        WareCnt := gHands[fOwner].Stats.GetWareBalance( SOLD_ORDER[I] );
        if (  (SOLD_ORDER[I] in [WARFARE_MIN..WARFARE_MAX]) AND (WareCnt > WARFARE_SELL_LIMIT)  )
           OR (WareCnt > SELL_LIMIT) then
          AddWare(SOLD_ORDER[I], False);
      end;
  
    for I := 0 to RequiedCnt - 1 do
      if (I < AvaiableCnt) then
        TryBuyItem(AvaiableWares[I], RequiredWares[I])
    else
      break;
  end;
  
  
  