mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-30 12:23:39 +01:00
Update enumerator in PartyList to match ActorTable
This commit is contained in:
parent
dca6a2b815
commit
913807f42c
1 changed files with 5 additions and 28 deletions
|
|
@ -73,37 +73,14 @@ namespace Dalamud.Game.ClientState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class PartyListEnumerator : IEnumerator<PartyMember>
|
public IEnumerator<PartyMember> GetEnumerator() {
|
||||||
{
|
for (var i = 0; i < Length; i++) {
|
||||||
private readonly PartyList party;
|
if (this[i] != null) {
|
||||||
private int currentIndex;
|
yield return this[i];
|
||||||
|
}
|
||||||
public PartyListEnumerator(PartyList list)
|
|
||||||
{
|
|
||||||
this.party = list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||||
|
|
||||||
public int Length => !this.isReady ? 0 : Marshal.ReadByte(partyListBegin + 0xF0);
|
public int Length => !this.isReady ? 0 : Marshal.ReadByte(partyListBegin + 0xF0);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue