From 102550174edaf6ecb8fd337649e3d5ba0311db0b Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 11 Mar 2018 18:07:48 -0700 Subject: [PATCH] Simplification invalid/unknown usages were incorrectly interchangable; dex-sets were looking at Unknown which was impossible for some cases. only use GameVersion.Unknown as a temp placeholder for later resolution by the user. --- PKHeX.Core/Game/GameUtil.cs | 2 +- PKHeX.Core/Saves/SAV1.cs | 2 +- PKHeX.Core/Saves/SAV2.cs | 2 +- PKHeX.Core/Saves/SAV3.cs | 3 +-- PKHeX.Core/Saves/SAV4.cs | 2 +- PKHeX.Core/Saves/SAV5.cs | 2 +- PKHeX.Core/Saves/SAV6.cs | 4 ++-- PKHeX.Core/Saves/SAV7.cs | 4 ++-- PKHeX.Core/Saves/SaveFile.cs | 2 +- PKHeX.Core/Saves/SaveUtil.cs | 2 +- PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs | 2 +- 11 files changed, 13 insertions(+), 14 deletions(-) diff --git a/PKHeX.Core/Game/GameUtil.cs b/PKHeX.Core/Game/GameUtil.cs index e54547692..8a5a0b8be 100644 --- a/PKHeX.Core/Game/GameUtil.cs +++ b/PKHeX.Core/Game/GameUtil.cs @@ -99,7 +99,7 @@ case 6: return GameVersion.AS; case 7: return GameVersion.UM; default: - return GameVersion.Unknown; + return GameVersion.Invalid; } } public static int GetGeneration(GameVersion game) diff --git a/PKHeX.Core/Saves/SAV1.cs b/PKHeX.Core/Saves/SAV1.cs index 5d6d11303..605459c18 100644 --- a/PKHeX.Core/Saves/SAV1.cs +++ b/PKHeX.Core/Saves/SAV1.cs @@ -480,7 +480,7 @@ namespace PKHeX.Core return false; if (species > MaxSpeciesID) return false; - if (Version == GameVersion.Unknown) + if (Version == GameVersion.Invalid) return false; return true; } diff --git a/PKHeX.Core/Saves/SAV2.cs b/PKHeX.Core/Saves/SAV2.cs index a4eaf4bb1..f9ab6aed9 100644 --- a/PKHeX.Core/Saves/SAV2.cs +++ b/PKHeX.Core/Saves/SAV2.cs @@ -484,7 +484,7 @@ namespace PKHeX.Core return false; if (species > MaxSpeciesID) return false; - if (Version == GameVersion.Unknown) + if (Version == GameVersion.Invalid) return false; return true; } diff --git a/PKHeX.Core/Saves/SAV3.cs b/PKHeX.Core/Saves/SAV3.cs index b72319b58..a71f95f9b 100644 --- a/PKHeX.Core/Saves/SAV3.cs +++ b/PKHeX.Core/Saves/SAV3.cs @@ -187,7 +187,6 @@ namespace PKHeX.Core // Configuration public override SaveFile Clone() { return new SAV3(Write(DSV:false), Version) {Japanese = Japanese}; } - public override bool IndeterminateGame => Version == GameVersion.Unknown; public override bool IndeterminateSubVersion => Version == GameVersion.FRLG; public override int SIZE_STORED => PKX.SIZE_3STORED; @@ -529,7 +528,7 @@ namespace PKHeX.Core return false; if (species > MaxSpeciesID) return false; - if (Version == GameVersion.Unknown) + if (Version == GameVersion.Invalid) return false; if (BlockOfs.Any(z => z < 0)) return false; diff --git a/PKHeX.Core/Saves/SAV4.cs b/PKHeX.Core/Saves/SAV4.cs index 041fc5d66..110246978 100644 --- a/PKHeX.Core/Saves/SAV4.cs +++ b/PKHeX.Core/Saves/SAV4.cs @@ -792,7 +792,7 @@ namespace PKHeX.Core return; if (pkm.Species > MaxSpeciesID) return; - if (Version == GameVersion.Unknown) + if (Version == GameVersion.Invalid) return; if (PokeDex < 0) return; diff --git a/PKHeX.Core/Saves/SAV5.cs b/PKHeX.Core/Saves/SAV5.cs index 3a33cd5d1..1378e4c91 100644 --- a/PKHeX.Core/Saves/SAV5.cs +++ b/PKHeX.Core/Saves/SAV5.cs @@ -405,7 +405,7 @@ namespace PKHeX.Core return; if (pkm.Species > MaxSpeciesID) return; - if (Version == GameVersion.Unknown) + if (Version == GameVersion.Invalid) return; if (PokeDex < 0) return; diff --git a/PKHeX.Core/Saves/SAV6.cs b/PKHeX.Core/Saves/SAV6.cs index 6fcecc37a..f754d494f 100644 --- a/PKHeX.Core/Saves/SAV6.cs +++ b/PKHeX.Core/Saves/SAV6.cs @@ -242,7 +242,7 @@ namespace PKHeX.Core case 26: return GameVersion.AS; case 27: return GameVersion.OR; } - return GameVersion.Unknown; + return GameVersion.Invalid; } } @@ -710,7 +710,7 @@ namespace PKHeX.Core return; if (pkm.Species > MaxSpeciesID) return; - if (Version == GameVersion.Unknown) + if (Version == GameVersion.Invalid) return; const int brSize = 0x60; diff --git a/PKHeX.Core/Saves/SAV7.cs b/PKHeX.Core/Saves/SAV7.cs index 6ce793eea..27c8ac7f7 100644 --- a/PKHeX.Core/Saves/SAV7.cs +++ b/PKHeX.Core/Saves/SAV7.cs @@ -275,7 +275,7 @@ namespace PKHeX.Core case 32: return GameVersion.US; case 33: return GameVersion.UM; } - return GameVersion.Unknown; + return GameVersion.Invalid; } } @@ -970,7 +970,7 @@ namespace PKHeX.Core } protected override void SetDex(PKM pkm) { - if (PokeDex < 0 || Version == GameVersion.Unknown) // sanity + if (PokeDex < 0 || Version == GameVersion.Invalid) // sanity return; if (pkm.Species == 0 || pkm.Species > MaxSpeciesID) // out of range return; diff --git a/PKHeX.Core/Saves/SaveFile.cs b/PKHeX.Core/Saves/SaveFile.cs index a02c00e26..c3e9dfe96 100644 --- a/PKHeX.Core/Saves/SaveFile.cs +++ b/PKHeX.Core/Saves/SaveFile.cs @@ -26,7 +26,7 @@ namespace PKHeX.Core public byte[] Header { protected get; set; } = new byte[0]; // .gci public bool Japanese { get; protected set; } protected virtual string PlayTimeString => $"{PlayedHours}ː{PlayedMinutes:00}ː{PlayedSeconds:00}"; // not : - public virtual bool IndeterminateGame => false; + public bool IndeterminateGame => Version == GameVersion.Unknown; public virtual bool IndeterminateSubVersion => false; public abstract string Extension { get; } public virtual string[] PKMExtensions => PKM.Extensions.Where(f => diff --git a/PKHeX.Core/Saves/SaveUtil.cs b/PKHeX.Core/Saves/SaveUtil.cs index 5f628ebc3..c470e439b 100644 --- a/PKHeX.Core/Saves/SaveUtil.cs +++ b/PKHeX.Core/Saves/SaveUtil.cs @@ -974,7 +974,7 @@ namespace PKHeX.Core case 9: return (int)GameVersion.R; case 10: return (int)GameVersion.E; case 11: return (int)GameVersion.CXD; - default: return (int)GameVersion.Unknown; + default: return (int)GameVersion.Invalid; } } diff --git a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs index 0a6c6090b..841518e84 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs @@ -1666,7 +1666,7 @@ namespace PKHeX.WinForms.Controls public void ChangeLanguage(SaveFile sav, PKM pk) { // Force an update to the met locations - origintrack = GameVersion.Unknown; + origintrack = GameVersion.Invalid; bool alreadyInit = FieldsInitialized; FieldsInitialized = false;