diff --git a/Dalamud/Game/ClientState/Actors/ActorTable.cs b/Dalamud/Game/ClientState/Actors/ActorTable.cs index 205f15faa..b21f5c4fb 100644 --- a/Dalamud/Game/ClientState/Actors/ActorTable.cs +++ b/Dalamud/Game/ClientState/Actors/ActorTable.cs @@ -85,34 +85,12 @@ namespace Dalamud.Game.ClientState.Actors { } } - private class ActorTableEnumerator : IEnumerator { - private readonly ActorTable table; - - private int currentIndex; - - public ActorTableEnumerator(ActorTable table) { - this.table = table; - } - - public bool MoveNext() { - this.currentIndex++; - return this.currentIndex != this.table.Length; - } - - public void Reset() { - this.currentIndex = 0; - } - - public Actor Current => this.table[this.currentIndex]; - - object IEnumerator.Current => Current; - - // Required by IEnumerator even though we have nothing we want to dispose here. - public void Dispose() {} - } - public IEnumerator GetEnumerator() { - return new ActorTableEnumerator(this); + for (int i=0;i - { - private readonly PartyList party; - private int currentIndex; - - public PartyListEnumerator(PartyList list) - { - this.party = list; + public IEnumerator GetEnumerator() { + for (var i = 0; i < Length; i++) { + if (this[i] != null) { + yield return this[i]; + } } - - public bool MoveNext() - { - this.currentIndex++; - return this.currentIndex != this.party.Length; - } - - public void Reset() - { - this.currentIndex = 0; - } - - public PartyMember Current => this.party[this.currentIndex]; - - object IEnumerator.Current => Current; - - // Required by IEnumerator even though we have nothing we want to dispose here. - public void Dispose() {} } - public IEnumerator GetEnumerator() => new PartyListEnumerator(this); - IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); public int Length => !this.isReady ? 0 : Marshal.ReadByte(partyListBegin + 0xF0);