mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-11-10 07:04:27 +00:00
Misc optimization
This commit is contained in:
parent
ec757e3ef8
commit
f91dfe7efa
1 changed files with 4 additions and 1 deletions
|
@ -130,9 +130,10 @@ public sealed class Trading : IDisposable {
|
|||
|
||||
// Once we have initial state, we remove items that we're supposed to give from our inventory
|
||||
// This loop is a bit more complex due to the fact that we might have a mix of the same item splitted into different amounts
|
||||
HashSet<Asset> itemsToRemove = [];
|
||||
|
||||
foreach (Asset itemToGive in itemsToGive) {
|
||||
uint amountToGive = itemToGive.Amount;
|
||||
HashSet<Asset> itemsToRemove = [];
|
||||
|
||||
foreach (Asset item in inventoryState.Where(item => (item.AppID == itemToGive.AppID) && (item.ClassID == itemToGive.ClassID) && (item.InstanceID == itemToGive.InstanceID))) {
|
||||
if (amountToGive >= item.Amount) {
|
||||
|
@ -154,6 +155,8 @@ public sealed class Trading : IDisposable {
|
|||
|
||||
if (itemsToRemove.Count > 0) {
|
||||
inventoryState.ExceptWith(itemsToRemove);
|
||||
|
||||
itemsToRemove.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue