mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 05:04:15 +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>
|
||||
{
|
||||
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue