Minor tweak

don't allocate byte array, just set directly
This commit is contained in:
Kurt 2019-10-17 20:16:03 -07:00
parent c24851129f
commit 546ff01e5e

View file

@ -119,7 +119,6 @@ namespace PKHeX.WinForms
private void B_Save_Click(object sender, EventArgs e) private void B_Save_Click(object sender, EventArgs e)
{ {
// Copy Bags // Copy Bags
byte[] bagarray = new byte[12];
int emptyslots = 0; int emptyslots = 0;
for (int i = 0; i < 12; i++) for (int i = 0; i < 12; i++)
{ {
@ -129,14 +128,15 @@ namespace PKHeX.WinForms
emptyslots++; emptyslots++;
continue; continue;
} }
bagarray[i - emptyslots] = (byte)Array.IndexOf(trba, bag); STB.SetBag(i - emptyslots, (byte)Array.IndexOf(trba, bag));
} }
if (float.TryParse(TB_Time1.Text, out var t1)) if (float.TryParse(TB_Time1.Text, out var t1))
SAV.SetData(BitConverter.GetBytes(t1), offsetTime + (4 * 30)); SAV.SetData(BitConverter.GetBytes(t1), offsetTime + (4 * 30));
if (float.TryParse(TB_Time2.Text, out var t2)) if (float.TryParse(TB_Time2.Text, out var t2))
SAV.SetData(BitConverter.GetBytes(t2), offsetTime + (4 * 31)); SAV.SetData(BitConverter.GetBytes(t2), offsetTime + (4 * 31));
SAV.SetData(BitConverter.GetBytes((ushort)WinFormsUtil.GetIndex(CB_S2)), offsetSpec + (4 * 30)); SAV.SetData(BitConverter.GetBytes((ushort)WinFormsUtil.GetIndex(CB_S2)), offsetSpec + (4 * 30));
STB.Bags = bagarray;
Origin.CopyChangesFrom(SAV); Origin.CopyChangesFrom(SAV);
Close(); Close();
} }