mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-01 22:23:29 +00:00
Change signature to set stackalloc ivs
This commit is contained in:
parent
d40bfa63c7
commit
274b613487
2 changed files with 15 additions and 8 deletions
|
@ -76,12 +76,19 @@ namespace PKHeX.Core
|
|||
public int[] IVs
|
||||
{
|
||||
get => new[] { IV_HP, IV_ATK, IV_DEF, IV_SPE, IV_SPA, IV_SPD };
|
||||
set
|
||||
{
|
||||
if (value.Length != 6) return;
|
||||
IV_HP = value[0]; IV_ATK = value[1]; IV_DEF = value[2];
|
||||
IV_SPE = value[3]; IV_SPA = value[4]; IV_SPD = value[5];
|
||||
}
|
||||
set => SetIVs(value);
|
||||
}
|
||||
|
||||
public void SetIVs(ReadOnlySpan<int> value)
|
||||
{
|
||||
if (value.Length != 6)
|
||||
return;
|
||||
IV_HP = value[0];
|
||||
IV_ATK = value[1];
|
||||
IV_DEF = value[2];
|
||||
IV_SPE = value[3];
|
||||
IV_SPA = value[4];
|
||||
IV_SPD = value[5];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -38,14 +38,14 @@ namespace PKHeX.WinForms
|
|||
|
||||
private void SaveData()
|
||||
{
|
||||
int[] IVs = new int[6];
|
||||
Span<int> IVs = stackalloc int[6];
|
||||
var iv = new[] { TB_HPIV, TB_ATKIV, TB_DEFIV, TB_SPEIV, TB_SPAIV, TB_SPDIV };
|
||||
for (int i = 0; i < iv.Length; i++)
|
||||
IVs[i] = Util.ToInt32(iv[i].Text);
|
||||
|
||||
Reader.PID = Util.GetHexValue(TB_PID.Text);
|
||||
Reader.Species = WinFormsUtil.GetIndex(CB_Species);
|
||||
Reader.IVs = IVs;
|
||||
Reader.SetIVs(IVs);
|
||||
Reader.Active = CHK_Active.Checked;
|
||||
Reader.CurrentLevel = (int)NUD_Level.Value;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue