From f74c1e321a7447d20912990f5b6aec7e199cf43d Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 27 Aug 2018 20:48:57 -0700 Subject: [PATCH] no mo go to yo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pull goto default into 'when' so other cases continue to default this is a goto free codebase ( ͡° ͜ʖ ͡°) --- .../Legality/Evolutions/EvolutionMethod.cs | 35 +++++++------------ .../Save Editors/Gen6/SAV_BoxLayout.cs | 4 +-- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/PKHeX.Core/Legality/Evolutions/EvolutionMethod.cs b/PKHeX.Core/Legality/Evolutions/EvolutionMethod.cs index 873a22cdb..8019c438a 100644 --- a/PKHeX.Core/Legality/Evolutions/EvolutionMethod.cs +++ b/PKHeX.Core/Legality/Evolutions/EvolutionMethod.cs @@ -50,30 +50,19 @@ namespace PKHeX.Core return !pkm.IsUntraded || skipChecks; // Special Levelup Cases - case 16: - if (!(pkm is IContestStats s) || s.CNT_Beauty < Argument) - return skipChecks; - goto default; - case 23: // Gender = Male - if (pkm.Gender != 0) - return false; - goto default; - case 24: // Gender = Female - if (pkm.Gender != 1) - return false; - goto default; - case 34: // Gender = Female, out Form1 - if (pkm.Gender != 1 || pkm.AltForm != 1) - return false; - goto default; + case 16 when !(pkm is IContestStats s) || s.CNT_Beauty < Argument: + return skipChecks; + case 23 when pkm.Gender != 0: // Gender = Male + return false; + case 24 when pkm.Gender != 1: // Gender = Female + return false; + case 34 when pkm.Gender != 1 || pkm.AltForm != 1: // Gender = Female, out Form1 + return false; - case 36: // Any Time on Version - case 37: // Daytime on Version - case 38: // Nighttime on Version - // Version checks come in pairs, check for any pair match - if (((pkm.Version & 1) != (Argument & 1) && pkm.IsUntraded) || skipChecks) - return skipChecks; - goto default; + case 36 when ((pkm.Version & 1) != (Argument & 1) && pkm.IsUntraded) || skipChecks: // Any Time on Version + case 37 when ((pkm.Version & 1) != (Argument & 1) && pkm.IsUntraded) || skipChecks: // Daytime on Version + case 38 when ((pkm.Version & 1) != (Argument & 1) && pkm.IsUntraded) || skipChecks: // Nighttime on Version + return skipChecks; // Version checks come in pairs, check for any pair match default: if (Level == 0 && lvl < 2) diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen6/SAV_BoxLayout.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen6/SAV_BoxLayout.cs index 4869b60ea..f4bec2fe9 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen6/SAV_BoxLayout.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen6/SAV_BoxLayout.cs @@ -35,9 +35,7 @@ namespace PKHeX.WinForms CB_BG.Items.Clear(); switch (SAV.Generation) { - case 3: - if (SAV.GameCube) - goto default; + case 3 when !SAV.GameCube: CB_BG.Items.AddRange(GameInfo.Strings.wallpapernames.Take(16).ToArray()); return true; case 4: