Optimizations

This commit is contained in:
Sebastian Bularca
2026-04-20 09:51:08 +02:00
parent 2b48af8d3e
commit e7595bdc89
7 changed files with 152 additions and 48 deletions

View File

@@ -16,12 +16,17 @@ namespace Jovian.EncounterSystem {
handlers.Remove(typeof(T));
}
public void Resolve(IEnumerable<IEncounterEvent> events, EncounterContext context) {
/// <summary>Indexed iteration over <paramref name="events"/> — avoids the boxed enumerator
/// that an <c>IEnumerable&lt;T&gt;</c> parameter would force. <see cref="EncounterDialogOption.events"/>
/// is a <c>List</c>, which implements <c>IReadOnlyList</c>, so call sites just pass it directly.</summary>
public void Resolve(IReadOnlyList<IEncounterEvent> events, EncounterContext context) {
if(events == null) {
return;
}
foreach(var evt in events) {
var count = events.Count;
for(int i = 0; i < count; i++) {
var evt = events[i];
if(evt == null) {
continue;
}