Rename legacy runtime cache

This commit is contained in:
Meta Vens 2026-06-13 07:11:16 +01:00
commit 742bb69d43
6 changed files with 28 additions and 27 deletions

View file

@ -10,7 +10,7 @@ using System.Reflection;
using MessagePack;
using UniRx;
public class CultCache
public class LegacyCatalogCache
{
private readonly object addLock = new object();
@ -27,7 +27,7 @@ public class CultCache
public IEnumerable<DatabaseEntry> AllEntries => _entries.Values;
public CultCache()
public LegacyCatalogCache()
{
foreach (var type in typeof(DatabaseEntry).GetAllChildClasses())
{

View file

@ -78,21 +78,21 @@ public class DatabaseLinkBase
public Guid LinkID;
[IgnoreMember]
private static CultCache LegacyCatalogCache { get; set; }
private static LegacyCatalogCache CatalogCache { get; set; }
protected static T ResolveLegacyCatalog<T>(Guid linkId) where T : DatabaseEntry
{
if (LegacyCatalogCache == null)
if (CatalogCache == null)
throw new InvalidOperationException("Legacy DatabaseLink resolution is not bound. Open LegacyCatalogBoundary before reading legacy catalog object graphs.");
return LegacyCatalogCache.Get<T>(linkId);
return CatalogCache.Get<T>(linkId);
}
public static void BindLegacyCatalog(CultCache cache)
public static void BindLegacyCatalog(LegacyCatalogCache cache)
{
if (cache == null) throw new ArgumentNullException(nameof(cache));
LegacyCatalogCache = cache;
CatalogCache = cache;
}
}

View file

@ -32,7 +32,7 @@ public class Galaxy
private HashSet<Guid> _containedFactions;
private GalaxyZone[] _exitPath;
private Dictionary<Faction, MarkovNameGenerator> _nameGenerators = new Dictionary<Faction, MarkovNameGenerator>();
private readonly CultCache _cache;
private readonly LegacyCatalogCache _cache;
public GalaxyZone[] ExitPath
{
@ -48,7 +48,7 @@ public class Galaxy
SectorGenerationSettings settings,
SectorBackgroundSettings background,
NameGeneratorSettings nameGeneratorSettings,
CultCache cache,
LegacyCatalogCache cache,
Action<string> log,
Action<string> progressCallback = null,
uint seed = 0)
@ -96,7 +96,7 @@ public class Galaxy
TutorialGenerationSettings settings,
SectorBackgroundSettings background,
NameGeneratorSettings nameGeneratorSettings,
CultCache cache,
LegacyCatalogCache cache,
PlayerSettings playerSettings,
DirectoryInfo narrativeDirectory,
Action<string> log,
@ -280,7 +280,7 @@ public class Galaxy
}
}
private void GenerateNames(CultCache cache,
private void GenerateNames(LegacyCatalogCache cache,
NameGeneratorSettings nameGeneratorSettings,
ref Random random,
Action<string> progressCallback = null)

View file

@ -31,7 +31,7 @@ public class ItemManager
// private Guid _forceLoadZone;
// public GlobalData GlobalData => _globalData ?? (_globalData = ItemData.GetAll<GlobalData>().FirstOrDefault());
public CultCache ItemData { get; }
public LegacyCatalogCache ItemData { get; }
public GameplaySettings GameplaySettings { get; }
// public double Time
@ -47,7 +47,7 @@ public class ItemManager
// private readonly Dictionary<CraftedItemData, int> Tier = new Dictionary<CraftedItemData, int>();
public ItemManager(CultCache itemData, GameplaySettings settings, Action<string> logger)
public ItemManager(LegacyCatalogCache itemData, GameplaySettings settings, Action<string> logger)
{
ItemData = itemData;
GameplaySettings = settings;
@ -247,4 +247,4 @@ public class ItemManager
int upgrades = (int) ((item.Quality - tier.Quality) / .0499f);
return (tier, upgrades);
}
}
}