mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-24 23:15:11 -05:00
Clean up SetDex guard clauses
add egg checks for gen4-6/8, group species bound checks
This commit is contained in:
@@ -128,8 +128,6 @@ private void ClearSeen(int species)
|
||||
|
||||
public override void SetDex(PKM pkm)
|
||||
{
|
||||
if (SAV.Version == GameVersion.Invalid) // sanity
|
||||
return;
|
||||
if ((uint)(pkm.Species - 1) >= (uint)SAV.MaxSpeciesID) // out of range
|
||||
return;
|
||||
if (pkm.IsEgg) // do not add
|
||||
|
||||
@@ -281,6 +281,8 @@ public override void SetDex(PKM pkm)
|
||||
int species = pkm.Species;
|
||||
if (species is 0 or > Legal.MaxSpeciesID_4)
|
||||
return;
|
||||
if (pkm.IsEgg) // do not add
|
||||
return;
|
||||
|
||||
var gender = pkm.Gender;
|
||||
var form = pkm.Form;
|
||||
|
||||
@@ -67,9 +67,9 @@ protected override void SetAllDexSeenFlags(int baseBit, int form, int gender, bo
|
||||
|
||||
public override void SetDex(PKM pkm)
|
||||
{
|
||||
if (pkm.Species == 0)
|
||||
if (pkm.Species is 0 or > Legal.MaxSpeciesID_5)
|
||||
return;
|
||||
if (pkm.Species > SAV.MaxSpeciesID)
|
||||
if (pkm.IsEgg) // do not add
|
||||
return;
|
||||
|
||||
int bit = pkm.Species - 1;
|
||||
|
||||
@@ -68,13 +68,9 @@ protected override void SetAllDexSeenFlags(int baseBit, int form, int gender, bo
|
||||
|
||||
public override void SetDex(PKM pkm)
|
||||
{
|
||||
if (PokeDex < 0)
|
||||
if (pkm.Species is 0 or > Legal.MaxSpeciesID_6)
|
||||
return;
|
||||
if (pkm.Species == 0)
|
||||
return;
|
||||
if (pkm.Species > SAV.MaxSpeciesID)
|
||||
return;
|
||||
if (SAV.Version == GameVersion.Invalid)
|
||||
if (pkm.IsEgg) // do not add
|
||||
return;
|
||||
|
||||
int bit = pkm.Species - 1;
|
||||
|
||||
@@ -470,6 +470,8 @@ public override void SetDex(PKM pkm)
|
||||
int species = pkm.Species;
|
||||
if (!GetEntry(species, out _))
|
||||
return;
|
||||
if (pkm.IsEgg) // do not add
|
||||
return;
|
||||
|
||||
bool owned = GetCaught(species);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user