Show all valid yamask-1 formarg values

from 319 (max HP-1) to 9999 (max saved value).

Causes a little bit of GUI lag when loading 10k items to the combobox; could be a number entry but meh. Lazily allocate the 10k strings; wait until it's requested.
This commit is contained in:
Kurt
2020-11-24 12:40:56 -08:00
parent d6294d42f7
commit 771086a222
2 changed files with 14 additions and 10 deletions

View File

@@ -303,6 +303,8 @@ private CheckResult VerifyFormArgument(LegalityAnalysis data, in uint arg)
if (arg != 0)
return GetInvalid(LFormArgumentNotAllowed);
}
if (arg > 9_999)
return GetInvalid(LFormArgumentHigh);
break;
}
case (int)Species.Runerigus:
@@ -316,6 +318,8 @@ private CheckResult VerifyFormArgument(LegalityAnalysis data, in uint arg)
{
if (arg < 49)
return GetInvalid(LFormArgumentLow);
if (arg > 9_999)
return GetInvalid(LFormArgumentHigh);
}
break;
}

View File

@@ -1029,23 +1029,23 @@ public static string[] GetFormArgumentStrings(int species, int form, int generat
if (generation <= 5)
return EMPTY;
static string[] GetBlank(int count)
{
var result = new string[count];
for (int i = 0; i < result.Length; i++)
result[i] = i.ToString();
return result;
}
return species switch
{
(int) Furfrou when form != 0 => new[] {"0", "1", "2", "3", "4", "5"},
(int) Hoopa when form == 1 => new[] {"0", "1", "2", "3"},
(int) Yamask when form == 1 => GetBlank(320),
(int) Runerigus when form == 0 => GetBlank(320), // max Runerigus HP
(int) Yamask when form == 1 => FormArg9999.Value,
(int) Runerigus when form == 0 => FormArg9999.Value,
(int) Alcremie => Enum.GetNames(typeof(AlcremieDecoration)),
_ => EMPTY
};
}
private static readonly Lazy<string[]> FormArg9999 = new Lazy<string[]>(() =>
{
var result = new string[9_999];
for (int i = 0; i < result.Length; i++)
result[i] = i.ToString();
return result;
}, true);
}
}