From 5374ca1db62bb3a1c5daf2586746c6c586bebbd7 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 24 Nov 2021 14:14:11 -0800 Subject: [PATCH] Simplify egg location set on version change --- PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs index 1e6a83436..6828c16b3 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs @@ -1248,7 +1248,7 @@ private void ReloadMetLocations(GameVersion version, int format) CB_EggLocation.DataSource = new BindingSource(eggList, null); CB_EggLocation.DropDownWidth = GetWidth(eggList, CB_EggLocation.Font); - int GetWidth(IEnumerable items, Font f) => + static int GetWidth(IEnumerable items, Font f) => items.Max(z => TextRenderer.MeasureText(z.Text, f).Width) + SystemInformation.VerticalScrollBarWidth; @@ -1256,8 +1256,12 @@ private void ReloadMetLocations(GameVersion version, int format) { SetMarkings(); // Set/Remove the Nativity marking when gamegroup changes too int metLoc = EncounterSuggestion.GetSuggestedTransferLocation(Entity); + int eggLoc = CHK_AsEgg.Checked + ? EncounterSuggestion.GetSuggestedEncounterEggLocationEgg(format, version) + : Locations.GetNoneLocation(version); + CB_MetLocation.SelectedValue = Math.Max(0, metLoc); - CB_EggLocation.SelectedIndex = CHK_AsEgg.Checked ? 1 : 0; // daycare : none + CB_EggLocation.SelectedValue = eggLoc; } else {