mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 05:48:44 +00:00
Move inventory item clearing to class
Fixes ClearItem offset being wrong
This commit is contained in:
parent
57efeff0ee
commit
98713f4d7b
3 changed files with 7 additions and 5 deletions
|
@ -99,7 +99,7 @@ namespace PKHeX.Core
|
|||
for (ushort i = 0; i < (ushort)SAV.MaxItemID; i++) // even though there are 3000, just overwrite the ones that people will mess up.
|
||||
{
|
||||
if (!hashSet.Contains(i))
|
||||
InventoryPouch8b.ClearItem(Data, InventoryPouch8b.GetItemOffset(i, Offset));
|
||||
InventoryItem8b.Clear(Data, InventoryPouch8b.GetItemOffset(i, Offset));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ namespace PKHeX.Core
|
|||
{
|
||||
public sealed class InventoryItem8b : InventoryItem, IItemFavorite, IItemNew
|
||||
{
|
||||
public const int SIZE = 0x10;
|
||||
|
||||
public bool IsFavorite { get; set; }
|
||||
public bool IsNew { get; set; }
|
||||
public ushort SortOrder { get; set; }
|
||||
|
@ -38,6 +40,8 @@ namespace PKHeX.Core
|
|||
BitConverter.GetBytes((ushort)0).CopyTo(data, offset + 0xE);
|
||||
}
|
||||
|
||||
public static void Clear(byte[] data, int offset) => Array.Clear(data, offset, SIZE);
|
||||
|
||||
public override void SetNewDetails(int count)
|
||||
{
|
||||
base.SetNewDetails(count);
|
||||
|
|
|
@ -6,8 +6,6 @@ namespace PKHeX.Core
|
|||
{
|
||||
public sealed class InventoryPouch8b : InventoryPouch
|
||||
{
|
||||
private const int SIZE_ITEM = 0x10;
|
||||
|
||||
public bool SetNew { get; set; }
|
||||
|
||||
public InventoryPouch8b(InventoryType type, ushort[] legal, int maxCount, int offset,
|
||||
|
@ -84,8 +82,8 @@ namespace PKHeX.Core
|
|||
}
|
||||
}
|
||||
|
||||
public static int GetItemOffset(ushort index, int baseOffset) => baseOffset + (SIZE_ITEM * index);
|
||||
public static int GetItemOffset(ushort index, int baseOffset) => baseOffset + (InventoryItem8b.SIZE * index);
|
||||
|
||||
public static void ClearItem(byte[] data, int ofs) => Array.Clear(data, ofs, 0x10);
|
||||
public void ClearItem(byte[] data, ushort index) => InventoryItem8b.Clear(data, GetItemOffset(index, Offset));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue