diff --git a/AetherBags/Inventory/State/InventoryStateBase.cs b/AetherBags/Inventory/State/InventoryStateBase.cs index c4d9cc1..23da550 100644 --- a/AetherBags/Inventory/State/InventoryStateBase.cs +++ b/AetherBags/Inventory/State/InventoryStateBase.cs @@ -19,6 +19,7 @@ public abstract class InventoryStateBase protected readonly List AllCategories = new(capacity: 256); protected readonly List FilteredCategories = new(capacity: 256); protected readonly List UserCategoriesSortedScratch = new(capacity: 64); + protected readonly List EnabledUserCategoriesScratch = new(capacity: 64); protected readonly List RemoveKeysScratch = new(capacity: 256); protected readonly HashSet ClaimedKeys = new(capacity: 512); @@ -69,18 +70,22 @@ public abstract class InventoryStateBase bool allaganCategoriesEnabled = config.Categories.AllaganToolsCategoriesEnabled && categoriesEnabled; bool bisCategoriesEnabled = config.Categories.BisBuddyEnabled && categoriesEnabled; // TODO: Cache this when config changes - UserCategoriesSortedScratch.Clear(); - foreach (var cat in config.Categories. UserCategories) + EnabledUserCategoriesScratch.Clear(); + foreach (var cat in config.Categories.UserCategories) { if (cat.Enabled) - UserCategoriesSortedScratch.Add(cat); + EnabledUserCategoriesScratch.Add(cat); } - var userCategories = UserCategoriesSortedScratch; - if (userCategoriesEnabled && userCategories.Count > 0) + if (userCategoriesEnabled && EnabledUserCategoriesScratch.Count > 0) { CategoryBucketManager.BucketByUserCategories( - ItemInfoByKey, userCategories, BucketsByKey, ClaimedKeys, UserCategoriesSortedScratch); + ItemInfoByKey, + EnabledUserCategoriesScratch, + BucketsByKey, + ClaimedKeys, + UserCategoriesSortedScratch + ); } if (allaganCategoriesEnabled)