Fix some enabling stuff. Always use PathResolver. Add counter to materials and imcs.

This commit is contained in:
Ottermandias 2022-04-29 15:59:41 +02:00
parent e8ee729ec5
commit 15602f5be5
6 changed files with 22 additions and 35 deletions

View file

@ -16,6 +16,9 @@ public partial class ModCollection
public bool HasCache
=> _cache != null;
public int RecomputeCounter
=> _cache?.RecomputeCounter ?? 0;
// Only create, do not update.
private void CreateCache( bool isDefault )
{

View file

@ -18,7 +18,7 @@ public partial class ModCollection
// Shared caches to avoid allocations.
private static readonly Dictionary< Utf8GamePath, FileRegister > RegisteredFiles = new(1024);
private static readonly Dictionary< MetaManipulation, FileRegister > RegisteredManipulations = new(1024);
private static readonly List< ModSettings? > ResolvedSettings = new(128);
private static readonly List< ModSettings? > ResolvedSettings = new(128);
private readonly ModCollection _collection;
private readonly SortedList< string, object? > _changedItems = new();
@ -27,6 +27,10 @@ public partial class ModCollection
public readonly MetaManager MetaManipulations;
public ConflictCache Conflicts = new();
// Count the number of recalculations of the effective file list.
// This is used for material and imc changes.
public int RecomputeCounter { get; private set; } = 0;
// Obtain currently changed items. Computes them if they haven't been computed before.
public IReadOnlyDictionary< string, object? > ChangedItems
{
@ -120,6 +124,7 @@ public partial class ModCollection
}
AddMetaFiles();
++RecomputeCounter;
}
// Identify and record all manipulated objects for this entire collection.