Skip to content

Commit

Permalink
short circuit the checks if no RSV data is present
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAdam committed May 16, 2021
1 parent 5649db2 commit f723d45
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Lumina/Excel/RSV/RsvProvider.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Lumina.Data;

namespace Lumina.Excel.RSV
Expand All @@ -19,7 +20,12 @@ public RsvProvider()
_rsvEntries = new();
}

private readonly Dictionary< string, string> _rsvEntries;
private readonly Dictionary< string, string > _rsvEntries;

/// <summary>
/// Returns true if there's any RSV values present, otherwise false.
/// </summary>
public bool HasValues => _rsvEntries.Any();

/// <summary>
/// Add a RSV mapping for a language to the collection
Expand Down
6 changes: 6 additions & 0 deletions src/Lumina/Excel/RowParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ public T[] ReadStructuresAsArray< T >( int offset, int count ) where T : struct

private SeString? ReplaceRsvKeyWithValue( byte[] originalData )
{
// so we don't do unnecessary array comparisons
if( !Sheet.GameData.Excel.RsvProvider.HasValues )
{
return null;
}

if( originalData.Length < _rsvMagic.Length )
{
return null;
Expand Down

0 comments on commit f723d45

Please sign in to comment.