Fix gender handling

Closes #1933

if not allowed to be genderless, flag as invalid gender
only permit valid genders after genderless is ruled out
(both done by checking the low bit)
This commit is contained in:
Kurt 2018-05-10 18:53:23 -07:00
parent 9fb7056837
commit 815705bc5e
2 changed files with 2 additions and 2 deletions

View file

@ -654,7 +654,7 @@ namespace PKHeX.Core
int gen = GenNumber;
if (2 >= gen || gen >= 6)
return true;
return gender == (gender & 1);
return gender == PKX.GetGenderFromPIDAndRatio(PID, gv);
}

View file

@ -509,7 +509,7 @@ namespace PKHeX.WinForms.Controls
if (gt == 255 || gt == 0 || gt == 254) // Single gender/genderless
return;
int newGender = PKX.GetGenderFromString(Label_Gender.Text) ^ 1;
int newGender = (PKX.GetGenderFromString(Label_Gender.Text) & 1) ^ 1;
if (pkm.Format <= 2)
{
Stats.SetATKIVGender(newGender);