mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Fix ActorTable Enumerator
This commit is contained in:
parent
4bbcd526e9
commit
e95dfa8320
1 changed files with 3 additions and 27 deletions
|
|
@ -85,34 +85,10 @@ namespace Dalamud.Game.ClientState.Actors {
|
|||
}
|
||||
}
|
||||
|
||||
private class ActorTableEnumerator : IEnumerator<Actor> {
|
||||
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<T> even though we have nothing we want to dispose here.
|
||||
public void Dispose() {}
|
||||
}
|
||||
|
||||
public IEnumerator<Actor> GetEnumerator() {
|
||||
return new ActorTableEnumerator(this);
|
||||
for (int i=0;i<Length;i++){
|
||||
yield return this[i];
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue