Skip to content

Commit

Permalink
Use case-insensitive comparator for face mod list in build.
Browse files Browse the repository at this point in the history
The `SingleOrDefault` comparator uses a case-insensitive comparison, but the `Distinct` operator was not doing so - resulting in an inconsistency that led to the same mod being found twice.

Making `Distinct` also case-insensitive fixes #35.
  • Loading branch information
focustense committed Jul 18, 2021
1 parent 14e0d88 commit 17fde95
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Focus.Apps.EasyNpc/Build/MergedFolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ public static void Build<TKey>(
// of time. This takes up a decent chunk of memory, but, hey, we're talking about users who are running
// modded Skyrim and incorporating NPC mods full of 4K and 8K textures, so they can probably afford it.
progress.StartStage("Building file index");
var allFaceMods = npcs.Select(x => x.FaceModName).Where(s => !string.IsNullOrEmpty(s)).Distinct().ToList();
var allFaceMods = npcs
.Select(x => x.FaceModName)
.Where(s => !string.IsNullOrEmpty(s))
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToList();
// For progress reporting, we select an entirely arbitrary 5% of the total for building the index. We won't
// know what the real total is until we actually read the NIFs, but the max can be adjusted as we go along.
progress.MaxProgress = allFaceMods.Count * 20;
Expand Down

0 comments on commit 17fde95

Please sign in to comment.