anchor.diff:      procedure CloseDelivery(aID: Integer);
       procedure CloseDemand(aWare: TKMWareType; aID: Integer);
       procedure CloseOffer(aWare: TKMWareType; aID: Integer);
  -    function ValidWareTypePair(oWT, dWT: TKMWareType): Boolean;
  +    function ValidWareTypePair(oWT, dWT: TKMWareType): Boolean; inline;
  +    function ValidDemand(dWT: TKMWareType; iD: Integer): Boolean; inline;
       function ValidDelivery(oWT, dWT: TKMWareType; iO, iD: Integer; aIgnoreOffer: Boolean = False): Boolean;
       function SerfCanDoDelivery(oWT: TKMWareType; iO: Integer; aSerf: TKMUnitSerf): Boolean;
       function PermitDelivery(oWT, dWT: TKMWareType; iO, iD: Integer; aSerf: TKMUnitSerf): Boolean;
  
positive.code:     allowOffroad := True; //(fDemand[oldDemandId].Loc_Unit <> nil) or fQueue[aDeliveryId].IsFromUnit;
  
      fBestBidCandidates.Clear;
  //    fBestBidCandidates.EnlargeTo(128);      // Do we need it ?
  
      //Try to find house or unit demand first (not storage)
      for dWT := Low(fDemandCount) to High(fDemandCount) do
        if ValidWareTypePair(aWare, dWT) then
          for iD := 0 to fDemandCount[dWT] - 1 do
            if fDemand[dWT,iD].IsActive
              and not ((iD = oldDemandId) and (dWT = oldDWT))
              and not fDemand[dWT,iD].IsDeleted
              and (fDemand[dWT,iD].Importance >= bestImportance)
              and ValidBestDemand(dWT, oldDWT, iD, oldDemandId) then
            begin
  
negative.code: end;
  
  
  function TKMDeliveries.ValidDemand(dWT: TKMWareType; iD: Integer): Boolean;
  begin
    Result := fDemand[dWT,iD].IsActive
              and ((fDemand[dWT,iD].DemandType = dtAlways) or (fDemand[dWT,iD].BeingPerformed = 0))
              and not fDemand[dWT,iD].IsDeleted;
  end;
  
  
  //IgnoreOffer means we don't check whether offer was already taken or deleted (used after offer was already claimed)
  function TKMDeliveries.ValidDelivery(oWT, dWT: TKMWareType; iO, iD: Integer; aIgnoreOffer: Boolean = False): Boolean;
  var
  