From 913807f42c3ec9c136fa4b85f76cc8a6dac816ab Mon Sep 17 00:00:00 2001 From: Caraxi Date: Thu, 28 May 2020 09:09:42 +0930 Subject: [PATCH] Update enumerator in PartyList to match ActorTable --- Dalamud/Game/ClientState/PartyList.cs | 33 ++++----------------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/Dalamud/Game/ClientState/PartyList.cs b/Dalamud/Game/ClientState/PartyList.cs index 536af33e6..572122c05 100644 --- a/Dalamud/Game/ClientState/PartyList.cs +++ b/Dalamud/Game/ClientState/PartyList.cs @@ -73,37 +73,14 @@ namespace Dalamud.Game.ClientState } } - private class PartyListEnumerator : IEnumerator - { - 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);