Update enumerator in PartyList to match ActorTable

This commit is contained in:
Caraxi 2020-05-28 09:09:42 +09:30
parent dca6a2b815
commit 913807f42c

View file

@ -73,37 +73,14 @@ namespace Dalamud.Game.ClientState
}
}
private class PartyListEnumerator : IEnumerator<PartyMember>
{
private readonly PartyList party;
private int currentIndex;
public PartyListEnumerator(PartyList list)
{
this.party = list;
public IEnumerator<PartyMember> 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<T> even though we have nothing we want to dispose here.
public void Dispose() {}
}
public IEnumerator<PartyMember> GetEnumerator() => new PartyListEnumerator(this);
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
public int Length => !this.isReady ? 0 : Marshal.ReadByte(partyListBegin + 0xF0);