Disallow negative forme ids

hax behavior sets '1' to altform textbox (from '-1')
This commit is contained in:
Kurt
2019-01-15 16:47:32 -08:00
parent ae6010f169
commit 338638db94

View File

@@ -232,7 +232,7 @@ private void LoadFieldsFromPKM(PKM pk, bool focus = true, bool skipConversionChe
if (focus)
Tab_Main.Focus();
if (!skipConversionCheck && !PKMConverter.TryMakePKMCompatible(pk, CurrentPKM, out string c, out pk))
if (!skipConversionCheck && !PKMConverter.TryMakePKMCompatible(pk, pkm, out string c, out pk))
{ WinFormsUtil.Alert(c); return; }
bool oldInit = FieldsInitialized;
@@ -252,7 +252,7 @@ private void LoadFieldsFromPKM(PKM pk, bool focus = true, bool skipConversionChe
{
MT_Level.Text = (pk.Stat_HPMax != 0 ? pk.Stat_Level : Experience.GetLevel(pk.EXP, pk.Species, pk.AltForm)).ToString();
TB_EXP.Text = pk.EXP.ToString();
MT_Form.Text = pk.AltForm.ToString();
MT_Form.Text = Math.Max(0, pk.AltForm).ToString();
if (pk.PartyStatsPresent) // stats present
Stats.LoadPartyStats(pk);
}
@@ -986,7 +986,7 @@ private void UpdateForm(object sender, EventArgs e)
if (ChangingFields)
return;
ChangingFields = true;
MT_Form.Text = CB_Form.SelectedIndex.ToString();
MT_Form.Text = Math.Max(0, CB_Form.SelectedIndex).ToString();
ChangingFields = false;
UpdateSprite();