anchor.diff:    KM_ScriptingEvents, KM_Sound,
     KM_CommonUtils;
   
  +const
  +  //Maximum number of Demands we can place at once (stops the delivery queue from becoming clogged with 1500 items)
  +  MAX_RES_ORDERED = 10;
  +
   
   { TKMHouseMarket }
   constructor TKMHouseMarket.Create(aUID: Integer; aHouseType: TKMHouseType; PosX, PosY: Integer; aOwner: TKMHandID; aBuildState: TKMHouseBuildState);
  
positive.code: 
  //Player has changed the amount of order
  procedure TKMHouseMarket.SetResOrder(aId: Byte; aValue: Integer);
  const
    //Maximum number of Demands we can place at once (stops the delivery queue from becoming clogged with 1500 items)
    MAX_RES_ORDERED = 10;
  var
    resRequired, ordersAllowed, ordersRemoved, orderToDo, movedOut2In: Integer;
  begin
  
negative.code:   if (aResource = fResFrom) and TradeInProgress then
    begin
      SetResInCnt(aResource, fMarketResIn[aResource] + aCount); //Place the new resource in the IN list
  
      //As we only order 10 resources at one time, we might need to order another now to fill the gap made by the one delivered
      ordersAllowed := MAX_RES_ORDERED - fMarketDeliveryCount[fResFrom];
  
      Assert(ordersAllowed >= 0); //We must never have ordered more than we are allowed
  
      ordersToDo := Min3(aCount, GetResRequired, ordersAllowed);
  
      if ordersToDo > 0 then
      begin
        Inc(fMarketDeliveryCount[aResource], ordersToDo);
        gHands[fOwner].Deliveries.Queue.AddDemand(Self, nil, fResFrom, ordersToDo, dtOnce, diNorm);
      end;
  