diff --git a/SAV/SAV_BerryFieldORAS.cs b/SAV/SAV_BerryFieldORAS.cs index 56221f03d..ba5988682 100644 --- a/SAV/SAV_BerryFieldORAS.cs +++ b/SAV/SAV_BerryFieldORAS.cs @@ -9,7 +9,6 @@ public SAV_BerryFieldORAS() { InitializeComponent(); Util.TranslateInterface(this, Main.curlanguage); - sav = (byte[])Main.SAV.Data.Clone(); nup_spec = new[] { NUP_Red, NUP_Blue, NUP_Pink, NUP_Green, NUP_Yellow, NUP_Rainbow, NUP_RedPlus, NUP_BluePlus, NUP_PinkPlus, NUP_GreenPlus, NUP_YellowPlus, NUP_RainbowPlus }; Label[] lbl_spec = { L_Red, L_Blue, L_Pink, L_Green, L_Yellow, L_Rainbow, L_RedPlus, L_BluePlus, L_PinkPlus, L_GreenPlus, L_YellowPlus, L_RainbowPlus }; @@ -20,7 +19,7 @@ public SAV_BerryFieldORAS() } } private readonly NumericUpDown[] nup_spec; - private readonly byte[] sav; + private readonly byte[] sav = (byte[])Main.SAV.Data.Clone(); private void B_Cancel_Click(object sender, EventArgs e) { diff --git a/SAV/SAV_BerryFieldXY.cs b/SAV/SAV_BerryFieldXY.cs index a01011b65..c0ec15d0a 100644 --- a/SAV/SAV_BerryFieldXY.cs +++ b/SAV/SAV_BerryFieldXY.cs @@ -9,10 +9,9 @@ public SAV_BerryFieldXY() { InitializeComponent(); Util.TranslateInterface(this, Main.curlanguage); - sav = (byte[])Main.SAV.Data.Clone(); listBox1.SelectedIndex = 0; } - public readonly byte[] sav; + private readonly byte[] sav = (byte[])Main.SAV.Data.Clone(); private void changefield(object sender, EventArgs e) { diff --git a/SAV/SAV_BoxLayout.cs b/SAV/SAV_BoxLayout.cs index cbbee3699..acea36554 100644 --- a/SAV/SAV_BoxLayout.cs +++ b/SAV/SAV_BoxLayout.cs @@ -10,7 +10,6 @@ public SAV_BoxLayout(int box) { InitializeComponent(); Util.TranslateInterface(this, Main.curlanguage); - sav = new SAV6((byte[])Main.SAV.Data.Clone()); editing = true; // Repopulate Wallpaper names @@ -24,8 +23,8 @@ public SAV_BoxLayout(int box) MT_BG2.Text = sav.Data[sav.PCFlags + 2].ToString(); LB_BoxSelect.SelectedIndex = box; } - public SAV6 sav; - public bool editing; + private readonly SAV6 sav = new SAV6((byte[])Main.SAV.Data.Clone()); + private bool editing; private void changeBox(object sender, EventArgs e) { diff --git a/SAV/SAV_EventFlagsORAS.cs b/SAV/SAV_EventFlagsORAS.cs index fdb0c331e..ff0dc27e8 100644 --- a/SAV/SAV_EventFlagsORAS.cs +++ b/SAV/SAV_EventFlagsORAS.cs @@ -23,9 +23,9 @@ public SAV_EventFlagsORAS() MT_Ash.Text = BitConverter.ToUInt16(Main.SAV.Data, Main.SAV.EventAsh).ToString(); } private bool setup = true; - public CheckBox[] chka; - public readonly bool[] flags = new bool[3072]; - public readonly ushort[] Constants = new ushort[(Main.SAV.EventFlag - Main.SAV.EventConst) / 2]; + private CheckBox[] chka; + private readonly bool[] flags = new bool[3072]; + private readonly ushort[] Constants = new ushort[(Main.SAV.EventFlag - Main.SAV.EventConst) / 2]; private void B_Cancel_Click(object sender, EventArgs e) { Close(); diff --git a/SAV/SAV_Inventory.cs b/SAV/SAV_Inventory.cs index 50dfea40d..84f46887e 100644 --- a/SAV/SAV_Inventory.cs +++ b/SAV/SAV_Inventory.cs @@ -10,7 +10,6 @@ public SAV_Inventory() { InitializeComponent(); Util.TranslateInterface(this, Main.curlanguage); - sav = (byte[])Main.SAV.Data.Clone(); item_val = getItems(Main.SAV.ORAS ? Legal.Pouch_Items_ORAS : Legal.Pouch_Items_XY); keyitem_val = getItems(Main.SAV.ORAS ? Legal.Pouch_Key_ORAS : Legal.Pouch_Key_XY); @@ -30,7 +29,7 @@ public SAV_Inventory() B_DisplayKeyItems.Text = Main.itempouch[4]; } - private readonly byte[] sav; + private readonly byte[] sav = (byte[])Main.SAV.Data.Clone(); private readonly string[] item_val, keyitem_val, tmhm_val, medicine_val, berries_val; diff --git a/SAV/SAV_PokedexORAS.cs b/SAV/SAV_PokedexORAS.cs index 7a6cece39..4e24ba12e 100644 --- a/SAV/SAV_PokedexORAS.cs +++ b/SAV/SAV_PokedexORAS.cs @@ -12,7 +12,6 @@ public SAV_PokedexORAS() CP = new[] { CHK_P1, CHK_P2, CHK_P3, CHK_P4, CHK_P5, CHK_P6, CHK_P7, CHK_P8, CHK_P9, }; CL = new[] { CHK_L1, CHK_L2, CHK_L3, CHK_L4, CHK_L5, CHK_L6, CHK_L7, }; Util.TranslateInterface(this, Main.curlanguage); - sav = (byte[])Main.SAV.Data.Clone(); Setup(); LB_Species.SelectedIndex = 0; @@ -21,7 +20,7 @@ public SAV_PokedexORAS() private readonly CheckBox[] CP; private readonly CheckBox[] CL; - private readonly byte[] sav; + private readonly byte[] sav = (byte[])Main.SAV.Data.Clone(); private readonly bool[,] specbools = new bool[9, 0x60 * 8]; private readonly bool[,] langbools = new bool[7, 0x60 * 8]; private bool editing; diff --git a/SAV/SAV_PokedexXY.cs b/SAV/SAV_PokedexXY.cs index 0f611f468..fab20d8df 100644 --- a/SAV/SAV_PokedexXY.cs +++ b/SAV/SAV_PokedexXY.cs @@ -12,7 +12,6 @@ public SAV_PokedexXY() CP = new[] { CHK_P1, CHK_P2, CHK_P3, CHK_P4, CHK_P5, CHK_P6, CHK_P7, CHK_P8, CHK_P9, }; CL = new[] { CHK_L1, CHK_L2, CHK_L3, CHK_L4, CHK_L5, CHK_L6, CHK_L7, }; Util.TranslateInterface(this, Main.curlanguage); - sav = (byte[])Main.SAV.Data.Clone(); Setup(); LB_Species.SelectedIndex = 0; @@ -21,7 +20,7 @@ public SAV_PokedexXY() private readonly CheckBox[] CP; private readonly CheckBox[] CL; - private readonly byte[] sav; + private readonly byte[] sav = (byte[])Main.SAV.Data.Clone(); private readonly bool[,] specbools = new bool[9, 0x60 * 8]; private readonly bool[,] langbools = new bool[7, 0x60 * 8]; private readonly bool[] foreignbools = new bool[0x52 * 8]; diff --git a/SAV/SAV_Pokepuff.cs b/SAV/SAV_Pokepuff.cs index e8bd45088..bf044d34b 100644 --- a/SAV/SAV_Pokepuff.cs +++ b/SAV/SAV_Pokepuff.cs @@ -9,7 +9,6 @@ public SAV_Pokepuff() { InitializeComponent(); Util.TranslateInterface(this, Main.curlanguage); - sav = (byte[])Main.SAV.Data.Clone(); pfa = Main.puffs; pfa[0] = "---"; @@ -19,7 +18,7 @@ public SAV_Pokepuff() new ToolTip().SetToolTip(B_All, "Hold CTRL to give Deluxe instead of Supreme."); } - private readonly byte[] sav; + private readonly byte[] sav = (byte[])Main.SAV.Data.Clone(); private readonly string[] pfa; private void Setup() { diff --git a/SAV/SAV_SecretBase.cs b/SAV/SAV_SecretBase.cs index ecddb3ccc..164c63f3c 100644 --- a/SAV/SAV_SecretBase.cs +++ b/SAV/SAV_SecretBase.cs @@ -10,7 +10,6 @@ public SAV_SecretBase() { InitializeComponent(); Util.TranslateInterface(this, Main.curlanguage); - sav = (byte[])Main.SAV.Data.Clone(); abilitylist = Main.abilitylist; setupComboBoxes(); @@ -23,7 +22,7 @@ public SAV_SecretBase() B_SAV2FAV(null, null); } - private readonly byte[] sav; + private readonly byte[] sav = (byte[])Main.SAV.Data.Clone(); private bool editing; private bool loading = true; diff --git a/SAV/SAV_SuperTrain.cs b/SAV/SAV_SuperTrain.cs index 47631c1c6..2fed7b46d 100644 --- a/SAV/SAV_SuperTrain.cs +++ b/SAV/SAV_SuperTrain.cs @@ -7,7 +7,6 @@ public partial class SAV_SuperTrain : Form { public SAV_SuperTrain() { - sav = (byte[])Main.SAV.Data.Clone(); trba = Main.trainingbags; trba[0] = "---"; offsetTime = Main.SAV.SuperTrain + 0x08; @@ -23,7 +22,7 @@ public SAV_SuperTrain() setup(); } - private readonly byte[] sav; + private readonly byte[] sav = (byte[])Main.SAV.Data.Clone(); private readonly string[] trba = { "Empty", "HP Bag S","HP Bag M","HP Bag L", diff --git a/SAV/SAV_Trainer.cs b/SAV/SAV_Trainer.cs index fc5d0fc5c..22e50bade 100644 --- a/SAV/SAV_Trainer.cs +++ b/SAV/SAV_Trainer.cs @@ -200,7 +200,7 @@ public SAV_Trainer() CB_Stats.Items.Add(statdata[2 * i + 1]); CB_Stats.SelectedIndex = 0; } - private readonly string[] statdata = { }; + private readonly string[] statdata; private bool editing; private readonly ToolTip Tip1 = new ToolTip(), Tip2 = new ToolTip(); private readonly MaskedTextBox[] MaisonRecords; diff --git a/SAV/SAV_Wondercard.cs b/SAV/SAV_Wondercard.cs index 7154afcc2..3ab07e606 100644 --- a/SAV/SAV_Wondercard.cs +++ b/SAV/SAV_Wondercard.cs @@ -13,7 +13,6 @@ public SAV_Wondercard(byte[] wcdata = null) { InitializeComponent(); Util.TranslateInterface(this, Main.curlanguage); - sav = (byte[])Main.SAV.Data.Clone(); pba = new[] { PB_Card01, PB_Card02, PB_Card03, PB_Card04, PB_Card05, PB_Card06, @@ -42,7 +41,7 @@ public SAV_Wondercard(byte[] wcdata = null) Array.Copy(wcdata, wondercard_data, wcdata.Length); loadwcdata(); } - private readonly byte[] sav; + private readonly byte[] sav = (byte[])Main.SAV.Data.Clone(); private byte[] wondercard_data = new byte[WC6.Size]; private const uint EonTicketConst = 0x225D73C2; private readonly PictureBox[] pba; @@ -175,7 +174,9 @@ private void clickSet(object sender, EventArgs e) if (Main.SAV.ORAS) // ORAS Only if (BitConverter.ToUInt16(wondercard_data, 0) == 0x800) // Eon Ticket # if (BitConverter.ToUInt16(wondercard_data, 0x68) == 0x2D6) // Eon Ticket - BitConverter.GetBytes(EonTicketConst).CopyTo(sav, Main.SAV.EonTicket); + { BitConverter.GetBytes(EonTicketConst).CopyTo(sav, Main.SAV.EonTicket); } + else + { Util.Alert("Cannot set Eon Ticket to non OR/AS games."); return; } Array.Copy(wondercard_data, 0, sav, offset, WC6.Size); populateWClist();