2
0
Fork 0
mirror of https://github.com/kwsch/PKHeX synced 2024-12-19 00:43:14 +00:00

no mo go to yo

pull goto default into 'when' so other cases continue to default

this is a goto free codebase ( ͡° ͜ʖ ͡°)
This commit is contained in:
Kurt 2018-08-27 20:48:57 -07:00
parent 4dc04cb4b9
commit f74c1e321a
2 changed files with 13 additions and 26 deletions
PKHeX.Core/Legality/Evolutions
PKHeX.WinForms/Subforms/Save Editors/Gen6

View file

@ -50,30 +50,19 @@ namespace PKHeX.Core
return !pkm.IsUntraded || skipChecks; return !pkm.IsUntraded || skipChecks;
// Special Levelup Cases // Special Levelup Cases
case 16: case 16 when !(pkm is IContestStats s) || s.CNT_Beauty < Argument:
if (!(pkm is IContestStats s) || s.CNT_Beauty < Argument)
return skipChecks; return skipChecks;
goto default; case 23 when pkm.Gender != 0: // Gender = Male
case 23: // Gender = Male
if (pkm.Gender != 0)
return false; return false;
goto default; case 24 when pkm.Gender != 1: // Gender = Female
case 24: // Gender = Female
if (pkm.Gender != 1)
return false; return false;
goto default; case 34 when pkm.Gender != 1 || pkm.AltForm != 1: // Gender = Female, out Form1
case 34: // Gender = Female, out Form1
if (pkm.Gender != 1 || pkm.AltForm != 1)
return false; return false;
goto default;
case 36: // Any Time on Version case 36 when ((pkm.Version & 1) != (Argument & 1) && pkm.IsUntraded) || skipChecks: // Any Time on Version
case 37: // Daytime on Version case 37 when ((pkm.Version & 1) != (Argument & 1) && pkm.IsUntraded) || skipChecks: // Daytime on Version
case 38: // Nighttime on Version case 38 when ((pkm.Version & 1) != (Argument & 1) && pkm.IsUntraded) || skipChecks: // Nighttime on Version
// Version checks come in pairs, check for any pair match return skipChecks; // Version checks come in pairs, check for any pair match
if (((pkm.Version & 1) != (Argument & 1) && pkm.IsUntraded) || skipChecks)
return skipChecks;
goto default;
default: default:
if (Level == 0 && lvl < 2) if (Level == 0 && lvl < 2)

View file

@ -35,9 +35,7 @@ namespace PKHeX.WinForms
CB_BG.Items.Clear(); CB_BG.Items.Clear();
switch (SAV.Generation) switch (SAV.Generation)
{ {
case 3: case 3 when !SAV.GameCube:
if (SAV.GameCube)
goto default;
CB_BG.Items.AddRange(GameInfo.Strings.wallpapernames.Take(16).ToArray()); CB_BG.Items.AddRange(GameInfo.Strings.wallpapernames.Take(16).ToArray());
return true; return true;
case 4: case 4: