mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
Fix/simplify range handling
This commit is contained in:
parent
dceeccb242
commit
1633e68b76
1 changed files with 7 additions and 5 deletions
|
|
@ -1643,13 +1643,15 @@ internal class SeStringEvaluator : IServiceType, ISeStringEvaluator
|
||||||
if (entryEnd == -1)
|
if (entryEnd == -1)
|
||||||
entryEnd = ranges.Length;
|
entryEnd = ranges.Length;
|
||||||
|
|
||||||
|
var entry = ranges.AsSpan(0, entryEnd);
|
||||||
|
|
||||||
if (ranges.StartsWith("noun", StringComparison.Ordinal))
|
if (ranges.StartsWith("noun", StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
isNoun = true;
|
isNoun = true;
|
||||||
}
|
}
|
||||||
else if (ranges.StartsWith("col", StringComparison.Ordinal) && colIndex < cols.Length)
|
else if (ranges.StartsWith("col", StringComparison.Ordinal) && colIndex < cols.Length)
|
||||||
{
|
{
|
||||||
cols[colIndex++] = int.Parse(ranges.AsSpan(4, entryEnd - 4));
|
cols[colIndex++] = int.Parse(entry[4..]);
|
||||||
}
|
}
|
||||||
else if (ranges.StartsWith("tail", StringComparison.Ordinal))
|
else if (ranges.StartsWith("tail", StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
|
|
@ -1659,18 +1661,18 @@ internal class SeStringEvaluator : IServiceType, ISeStringEvaluator
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var dash = ranges.IndexOf('-');
|
var dash = entry.IndexOf('-');
|
||||||
|
|
||||||
hasRanges |= true;
|
hasRanges |= true;
|
||||||
|
|
||||||
if (dash == -1)
|
if (dash == -1)
|
||||||
{
|
{
|
||||||
isInRange |= int.Parse(ranges.AsSpan(0, entryEnd)) == rowId;
|
isInRange |= int.Parse(entry) == rowId;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
isInRange |= rowId >= int.Parse(ranges.AsSpan(0, dash))
|
isInRange |= rowId >= int.Parse(entry[..dash])
|
||||||
&& rowId <= int.Parse(ranges.AsSpan(dash + 1, entryEnd - dash - 1));
|
&& rowId <= int.Parse(entry[(dash + 1)..]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue