diff --git a/Misc/SAV6.cs b/Misc/SAV6.cs index a2028b651..c8ea6bb2a 100644 --- a/Misc/SAV6.cs +++ b/Misc/SAV6.cs @@ -436,6 +436,9 @@ public bool DaycareOccupied2 set { Data[DaycareSlot[DaycareIndex] + (PK6.SIZE_STORED + 8) * 1] = (byte)(value ? 1 : 0); } } + public byte[] Puffs { get { return Data.Skip(Puff).Take(100).ToArray(); } set { value.CopyTo(Data, Puff); } } + public int PuffCount { get { return BitConverter.ToInt32(Data, Puff + 100); } set { BitConverter.GetBytes(value).CopyTo(Data, Puff + 100); } } + // Data Accessing public byte[] getData(int Offset, int Length) { diff --git a/SAV/SAV_Pokepuff.cs b/SAV/SAV_Pokepuff.cs index 033f381d4..3317a89b3 100644 --- a/SAV/SAV_Pokepuff.cs +++ b/SAV/SAV_Pokepuff.cs @@ -63,7 +63,7 @@ private void Setup() dgv.Rows[i].Cells[0].Value = (i + 1).ToString(); dgv.Rows[i].Cells[1].Value = pfa[sav[Main.SAV.Puff + i]]; } - MT_CNT.Text = BitConverter.ToUInt32(sav, Main.SAV.Puff + 100).ToString("0"); + MT_CNT.Text = Main.SAV.PuffCount.ToString(); } private void dropclick(object sender, DataGridViewCellEventArgs e) { @@ -145,11 +145,10 @@ private void B_Save_Click(object sender, EventArgs e) emptyslots++; continue; } - - puffarray[i - emptyslots] = (byte) Array.IndexOf(pfa, puff); + puffarray[i - emptyslots] = (byte)Array.IndexOf(pfa, puff); } - Array.Copy(puffarray, 0, sav, Main.SAV.Puff, 100); - Array.Copy(sav, Main.SAV.Data, sav.Length); + Main.SAV.Puffs = puffarray; + Main.SAV.PuffCount = Util.ToInt32(MT_CNT); Main.SAV.Edited = true; Close(); }