mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 14:44:24 +00:00
Sanitize gender on species/form change
clean up some if expressions
This commit is contained in:
parent
ecee948107
commit
5be9863ef4
2 changed files with 5 additions and 5 deletions
|
@ -622,7 +622,7 @@ namespace PKHeX.Core
|
|||
return gender == 0;
|
||||
|
||||
int gen = Generation;
|
||||
if (gen is <= 2 or >= 6) // not 3-5
|
||||
if (gen is not (3 or 4 or 5))
|
||||
return gender == (gender & 1);
|
||||
|
||||
return gender == PKX.GetGenderFromPIDAndRatio(PID, gv);
|
||||
|
|
|
@ -960,7 +960,7 @@ namespace PKHeX.WinForms.Controls
|
|||
|
||||
private void UpdateForm(object sender, EventArgs e)
|
||||
{
|
||||
if (CB_Form == sender && FieldsLoaded)
|
||||
if (FieldsLoaded && sender == CB_Form)
|
||||
{
|
||||
Entity.Form = CB_Form.SelectedIndex;
|
||||
uint EXP = Experience.GetEXP(Entity.CurrentLevel, Entity.PersonalInfo.EXPGrowth);
|
||||
|
@ -994,12 +994,12 @@ namespace PKHeX.WinForms.Controls
|
|||
if (CB_Form.Items.Count == 2) // actually M/F; Pumpkaboo formes in German are S,M,L,XL
|
||||
{
|
||||
Entity.Gender = CB_Form.SelectedIndex;
|
||||
UC_Gender.Gender = Entity.Gender;
|
||||
UC_Gender.Gender = Entity.GetSaneGender();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UC_Gender.Gender = Entity.Gender;
|
||||
UC_Gender.Gender = Entity.GetSaneGender();
|
||||
}
|
||||
|
||||
RefreshFormArguments();
|
||||
|
@ -1160,7 +1160,7 @@ namespace PKHeX.WinForms.Controls
|
|||
TB_EXP.Text = EXP.ToString();
|
||||
|
||||
// Check for Gender Changes
|
||||
UC_Gender.Gender = Entity.Gender;
|
||||
UC_Gender.Gender = Entity.GetSaneGender();
|
||||
|
||||
// If species changes and no nickname, set the new name == speciesName.
|
||||
if (!CHK_Nicknamed.Checked)
|
||||
|
|
Loading…
Reference in a new issue