performance optimizations

This commit is contained in:
Sebastian Bularca
2026-04-20 08:07:24 +02:00
parent f055250ca6
commit 2445781f33
7 changed files with 152 additions and 48 deletions

View File

@@ -7,18 +7,13 @@ namespace Jovian.EncounterSystem {
public EncounterTable table;
public string internalId;
/// <summary>O(1) lookup via <see cref="EncounterTable.Resolve"/>. Returns <c>null</c> if the
/// table is missing or the id can't be found.</summary>
public IEncounter Resolve() {
if(table == null || table.encounters == null || string.IsNullOrEmpty(internalId)) {
if(table == null || string.IsNullOrEmpty(internalId)) {
return null;
}
foreach(var encounter in table.encounters) {
if(encounter?.EncounterDefinition?.internalId == internalId) {
return encounter;
}
}
return null;
return table.Resolve(internalId);
}
}
}