From 63b18ff51f5045e20cc1558a83cf1f6f2b45479d Mon Sep 17 00:00:00 2001 From: Kurt Date: Thu, 8 Jun 2017 20:57:30 -0700 Subject: [PATCH] Fix misc problems flag undistributed gen3 events fix gen3 string writing (resized then expanded yields 00, missing terminator), closes #1204 fix stackoverflow, fix pkmeditor template loading save prompt, closes #1207 --- PKHeX.Core/Legality/Analysis.cs | 3 +++ PKHeX.Core/Legality/Core.cs | 2 +- PKHeX.Core/Legality/LegalityCheckStrings.cs | 3 ++- PKHeX.Core/PKM/PKX.cs | 2 +- PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs | 6 +++++- PKHeX.WinForms/MainWindow/Main.cs | 2 +- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/PKHeX.Core/Legality/Analysis.cs b/PKHeX.Core/Legality/Analysis.cs index 93bf16133..f3c85f667 100644 --- a/PKHeX.Core/Legality/Analysis.cs +++ b/PKHeX.Core/Legality/Analysis.cs @@ -143,6 +143,9 @@ namespace PKHeX.Core if (pkm.Version == 15) verifyCXD(); + + if (info.EncounterMatch is WC3 z && z.NotDistributed) + AddLine(Severity.Invalid, V413, CheckIdentifier.Encounter); } private void parsePK4(PKM pk) { diff --git a/PKHeX.Core/Legality/Core.cs b/PKHeX.Core/Legality/Core.cs index 9bb50ab03..a699c6578 100644 --- a/PKHeX.Core/Legality/Core.cs +++ b/PKHeX.Core/Legality/Core.cs @@ -16,7 +16,7 @@ namespace PKHeX.Core public static bool AllowGen1Tradeback = false; public static bool AllowGen2VCTransfer => AllowGen1Tradeback; public static bool AllowGen2VCCrystal = false; - public static bool AllowGen2Crystal => AllowGBCartEra || AllowGen2Crystal; + public static bool AllowGen2Crystal => AllowGBCartEra || AllowGen2VCCrystal; public static bool AllowGen2MoveReminder => AllowGBCartEra; /// Setting to specify if the e-berry index item is an eningma berry or a e-reader berry and the name of the e-reader berry diff --git a/PKHeX.Core/Legality/LegalityCheckStrings.cs b/PKHeX.Core/Legality/LegalityCheckStrings.cs index 89c993d29..9d4e6b141 100644 --- a/PKHeX.Core/Legality/LegalityCheckStrings.cs +++ b/PKHeX.Core/Legality/LegalityCheckStrings.cs @@ -363,8 +363,9 @@ namespace PKHeX.Core public static string V352 {get; set;} = "Arceus from Hall of Origin. Unreleased event."; public static string V353 {get; set;} = "Non japanese Mew from Faraway Island. Unreleased event."; public static string V354 {get; set;} = "Non Platinum Shaymin from Flower Paradise. Unreleased event."; - public static string V383 {get; set;} = "Non Platinum Darkrai from Newmoon Island.Unreleased event."; + public static string V383 {get; set;} = "Non Platinum Darkrai from Newmoon Island. Unreleased event."; public static string V384 {get; set;} = "Johto Route 45 surfing encounter. Unreachable Water tiles."; + public static string V413 {get; set;} = "Unreleased event."; public static string V357 {get; set;} = "Only one Ninjask move allowed."; public static string V358 {get; set;} = "Inherited move learned by Level-up. Incompatible with event egg moves."; public static string V359 {get; set;} = "Unable to match a gift egg encounter from origin game."; diff --git a/PKHeX.Core/PKM/PKX.cs b/PKHeX.Core/PKM/PKX.cs index d04597ab2..bedcd1175 100644 --- a/PKHeX.Core/PKM/PKX.cs +++ b/PKHeX.Core/PKM/PKX.cs @@ -1403,7 +1403,7 @@ namespace PKHeX.Core } if (strdata.Length > 0) strdata[strdata.Length - 1] = 0xFF; - if (strdata.Length > maxLength) + if (strdata.Length > maxLength && padTo <= maxLength) Array.Resize(ref strdata, maxLength); if (strdata.Length < padTo) { diff --git a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs index 5c2617f75..5827f2bcf 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs @@ -1852,7 +1852,11 @@ namespace PKHeX.WinForms.Controls public void TemplateFields(PKM template) { if (template != null) - { populateFields(template); return; } + { + populateFields(template); + lastData = null; + return; + } if (CB_GameOrigin.Items.Count > 0) CB_GameOrigin.SelectedIndex = 0; CB_Move1.SelectedValue = 1; diff --git a/PKHeX.WinForms/MainWindow/Main.cs b/PKHeX.WinForms/MainWindow/Main.cs index 3a9851fa0..d914769e1 100644 --- a/PKHeX.WinForms/MainWindow/Main.cs +++ b/PKHeX.WinForms/MainWindow/Main.cs @@ -157,7 +157,7 @@ namespace PKHeX.WinForms { openSAV(C_SAV.SAV, null); C_SAV.SAV.Edited = false; // Prevents form close warning from showing until changes are made - } + } } if (pkmArg != null) OpenQuick(pkmArg, force: true);