anchor.diff:    total: Int64;
   begin
     //HashCode should be the same if we swap From and To
  -  Int64Rec(total).Words[0] := (FromP.X + ToP.X);
  -  Int64Rec(total).Words[1] := Abs(FromP.X - ToP.X);
  -  Int64Rec(total).Words[2] := FromP.Y + ToP.Y;
  -  Int64Rec(total).Words[3] := Abs(FromP.Y - ToP.Y);
  +  Int64Rec(total).Words[0] := (FromP.X + ToP.X);    // values range is 0..MAX_MAP_SIZE*2 (0..512)
  +  Int64Rec(total).Words[1] := Abs(FromP.X - ToP.X); // (0..256)
  +  Int64Rec(total).Words[2] := FromP.Y + ToP.Y;      // (0..512)
  +  Int64Rec(total).Words[3] := Abs(FromP.Y - ToP.Y); // (0..256)
  +  //GetHashValue(Integer/Cardinal) is even faster, but we can't fit our 34 bits there
     Result := THashBobJenkins.GetHashValue(total, SizeOf(Int64), 0);
   end;
   
  +
  +{ TKMDeliveryBid }
  +function TKMDeliveryBid.GetTTL: Integer;
  +begin
  +  Result := 0;
  +  case Kind of
  +    dbkSerfToOffer:   Result := SERF_OFFER_CACHED_BID_TTL;
  +    dbkOfferToDemand: Result := OFFER_DEMAND_CACHED_BID_TTL;
  +  end;
  +end;
  +
  +
  +function TKMDeliveryBid.IsExpired(aTick: Integer): Boolean;
  +begin
  +  Result := aTick - CreatedAt > GetTTL;
  +end;
  +
  +
   end.
  
positive.code: end;
  
  
  procedure TKMDeliveries.UpdateState(aTick: Cardinal);
  {$IFDEF USE_HASH}
  var
    I: Integer;
    bidPair: TPair<TKMDeliveryBidKey, TKMDeliveryBid>;
    bid: TKMDeliveryBid;
  {$ENDIF}
  begin
    {$IFDEF USE_HASH}
    if CACHE_DELIVERY_BIDS then
    begin
      fRemoveKeysList.Clear;
  
      // Decrease TimeToLive for every cache record
      for bidPair in fBidsCache do
      begin
        bid := bidPair.Value;
        Dec(bid.TimeToLive);
  
        if bid.TimeToLive <= 0 then
          fRemoveKeysList.Add(bidPair.Key) // its not safe to remove dictionary value in the loop, will cause desyncs
        else
          fBidsCache[bidPair.Key]:= bid;
      end;
  
      // Remove old records after full dictionary scan
      for I := 0 to fRemoveKeysList.Count - 1 do
        fBidsCache.Remove(fRemoveKeysList[I]);
    end;
    {$ENDIF}
  end;
  
  
negative.code:     aBidBasicValue := aBidBasicValue + 1000;
  
    {$IFDEF USE_HASH}
    fBidsCache.Add(bidKey, aBidBasicValue, dbkOfferToDemand);
    {$ENDIF}
  
    aBidBasicValue := aBidBasicValue + SerfBidValue;
  