From d02dd29e83c7074d4ebdb5bc097dfae40a0e1ece Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 2 Jan 2021 10:35:48 -0800 Subject: [PATCH] More version-location shenanigans Should be behaving correctly for gen!2=>gen2 now --- .../Controls/PKM Editor/PKMEditor.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs index 81eb53f3e..c8394ac89 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs @@ -1185,15 +1185,10 @@ private void UpdateSpecies(object sender, EventArgs e) private void UpdateOriginGame(object sender, EventArgs e) { GameVersion version = (GameVersion)WinFormsUtil.GetIndex(CB_GameOrigin); + CheckMetLocationChange(version); if (FieldsLoaded) Entity.Version = (int)version; - // Does the list of locations need to be changed to another group? - var group = GameUtil.GetMetLocationVersionGroup(version); - if (group != origintrack) - ReloadMetLocations(version); - origintrack = group; - // Visibility logic for Gen 4 encounter type; only show for Gen 4 Pokemon. if (Entity.Format >= 4) { @@ -1210,6 +1205,15 @@ private void UpdateOriginGame(object sender, EventArgs e) UpdateLegality(); } + private void CheckMetLocationChange(GameVersion version) + { + // Does the list of locations need to be changed to another group? + var group = GameUtil.GetMetLocationVersionGroup(version); + if (group != origintrack) + ReloadMetLocations(version); + origintrack = group; + } + private void ReloadMetLocations(GameVersion version) { var metList = GameInfo.GetLocationList(version, Entity.Format, egg: false); @@ -1955,7 +1959,10 @@ private void PopulateFilteredDataSources(ITrainerInfo sav, bool force = false) var source = GameInfo.FilteredSources; if (sav.Generation >= 2) + { + CheckMetLocationChange((GameVersion) sav.Game); SetIfDifferentCount(source.Items, CB_HeldItem, force); + } if (sav.Generation >= 3) {