From f8dff15fe07847cc6a05a54215191443518dc11f Mon Sep 17 00:00:00 2001 From: Soreepeong Date: Fri, 1 Dec 2023 22:02:08 +0900 Subject: [PATCH] fix bugs --- Dalamud/Game/Inventory/GameInventory.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Dalamud/Game/Inventory/GameInventory.cs b/Dalamud/Game/Inventory/GameInventory.cs index 5842996b6..b5e3029b9 100644 --- a/Dalamud/Game/Inventory/GameInventory.cs +++ b/Dalamud/Game/Inventory/GameInventory.cs @@ -22,7 +22,7 @@ namespace Dalamud.Game.Inventory; [ServiceManager.BlockingEarlyLoadedService] internal class GameInventory : IDisposable, IServiceType, IGameInventory { - private static readonly ModuleLog Log = new("GameInventory"); + private static readonly ModuleLog Log = new(nameof(GameInventory)); private readonly List addedEvents = new(); private readonly List removedEvents = new(); @@ -195,20 +195,23 @@ internal class GameInventory : IDisposable, IServiceType, IGameInventory for (var j = i - 1; j >= 0; --j) { var e2 = this.changedEvents[j]; - if (e1.Item.ItemId != e2.Item.ItemId || e1.Item.ItemId != e2.Item.ItemId) + if (e1.Item.ItemId != e2.OldItemState.ItemId || e1.OldItemState.ItemId != e2.Item.ItemId) continue; - // move happened, and e2 has an item + // Move happened, and e2 has an item. if (!e2.Item.IsEmpty) this.movedEvents.Add(new(e1, e2)); - // move happened, and e1 has an item + // Move happened, and e1 has an item. if (!e1.Item.IsEmpty) this.movedEvents.Add(new(e2, e1)); // Remove the reinterpreted entries. Note that i > j. this.changedEvents.RemoveAt(i); this.changedEvents.RemoveAt(j); + + // We've removed two. Adjust the outer counter. + --i; break; } }