Optimizations
This commit is contained in:
@@ -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<T></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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user