semantic changes

This commit is contained in:
Sebastian Bularca
2026-04-21 00:08:13 +02:00
parent 3af200a847
commit f71e6a145e
3 changed files with 9 additions and 11 deletions

View File

@@ -9,13 +9,11 @@ namespace Jovian.EncounterSystem {
[TextArea(2, 6)] public string inlineText; [TextArea(2, 6)] public string inlineText;
public string Resolve(DialogLineLibrary library) { public string Resolve(DialogLineLibrary library) {
if(library != null && !string.IsNullOrEmpty(id)) { if(!library || string.IsNullOrEmpty(id)) {
var text = library.Resolve(id); return inlineText;
if(!string.IsNullOrEmpty(text)) {
return text;
}
} }
return inlineText; var text = library.Resolve(id);
return !string.IsNullOrEmpty(text) ? text : inlineText;
} }
} }
} }

View File

@@ -23,7 +23,7 @@ namespace Jovian.EncounterSystem {
} }
private void RenameToMatchId() { private void RenameToMatchId() {
if(this == null || string.IsNullOrEmpty(id)) { if(!this || string.IsNullOrEmpty(id)) {
return; return;
} }

View File

@@ -18,7 +18,7 @@ namespace Jovian.EncounterSystem {
} }
EnsureCache(); EnsureCache();
return idCache.TryGetValue(internalId, out var encounter) ? encounter : null; return idCache.GetValueOrDefault(internalId);
} }
/// <summary>Force the id lookup cache to rebuild on next use.</summary> /// <summary>Force the id lookup cache to rebuild on next use.</summary>
@@ -43,7 +43,7 @@ namespace Jovian.EncounterSystem {
IEncounter selected = null; IEncounter selected = null;
var seen = 0; var seen = 0;
for(int i = 0; i < encounters.Count; i++) { for(var i = 0; i < encounters.Count; i++) {
var encounter = encounters[i]; var encounter = encounters[i];
if(encounter == null || encounter.GetType() != type) { if(encounter == null || encounter.GetType() != type) {
continue; continue;
@@ -68,7 +68,7 @@ namespace Jovian.EncounterSystem {
IEncounter selected = null; IEncounter selected = null;
var seen = 0; var seen = 0;
for(int i = 0; i < encounters.Count; i++) { for(var i = 0; i < encounters.Count; i++) {
var encounter = encounters[i]; var encounter = encounters[i];
if(encounter == null || !filter(encounter)) { if(encounter == null || !filter(encounter)) {
continue; continue;
@@ -91,7 +91,7 @@ namespace Jovian.EncounterSystem {
return; return;
} }
for(int i = 0; i < encounters.Count; i++) { for(var i = 0; i < encounters.Count; i++) {
var encounter = encounters[i]; var encounter = encounters[i];
var internalId = encounter?.EncounterDefinition?.internalId; var internalId = encounter?.EncounterDefinition?.internalId;
if(!string.IsNullOrEmpty(internalId)) { if(!string.IsNullOrEmpty(internalId)) {