mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Fix GameInventoryItem array initialization (#2222)
This commit is contained in:
parent
baf796f5e1
commit
0d9eca1877
1 changed files with 8 additions and 3 deletions
|
|
@ -120,9 +120,7 @@ internal class GameInventory : IInternalDisposableService
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Assumption: newItems is sorted by slots, and the last item has the highest slot number.
|
// Assumption: newItems is sorted by slots, and the last item has the highest slot number.
|
||||||
var oldItems = this.inventoryItems[i] ??= new GameInventoryItem[newItems[^1].InternalItem.Slot + 1];
|
var oldItems = this.inventoryItems[i] ??= this.CreateItemsArray(newItems[^1].InternalItem.Slot + 1);
|
||||||
if (this.inventoryItems[i] == null)
|
|
||||||
oldItems.Initialize();
|
|
||||||
|
|
||||||
foreach (ref readonly var newItem in newItems)
|
foreach (ref readonly var newItem in newItems)
|
||||||
{
|
{
|
||||||
|
|
@ -314,6 +312,13 @@ internal class GameInventory : IInternalDisposableService
|
||||||
this.mergedEvents.Clear();
|
this.mergedEvents.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private GameInventoryItem[] CreateItemsArray(int length)
|
||||||
|
{
|
||||||
|
var items = new GameInventoryItem[length];
|
||||||
|
items.Initialize();
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
private unsafe void RaptureAtkModuleUpdateDetour(RaptureAtkModule* ram, float f1)
|
private unsafe void RaptureAtkModuleUpdateDetour(RaptureAtkModule* ram, float f1)
|
||||||
{
|
{
|
||||||
this.inventoriesMightBeChanged |= ram->AgentUpdateFlag != 0;
|
this.inventoriesMightBeChanged |= ram->AgentUpdateFlag != 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue