diff --git a/source/games/sw/src/hornet.cpp b/source/games/sw/src/hornet.cpp index 6ffd518a4..ad1128def 100644 --- a/source/games/sw/src/hornet.cpp +++ b/source/games/sw/src/hornet.cpp @@ -550,7 +550,6 @@ DoHornetDeath(DSWActor* actor) int DoCheckSwarm(DSWActor* actor) { USER* u = actor->u(); - int i; SPRITEp sp = &actor->s(), tsp; USERp tu; int dist, pdist, a,b,c; @@ -572,10 +571,9 @@ int DoCheckSwarm(DSWActor* actor) return 0; // all enemys - StatIterator it(STAT_ENEMY); - while ((i = it.NextIndex()) >= 0) + SWStatIterator it(STAT_ENEMY); + while (auto itActor = it.Next()) { - auto itActor = &swActors[i]; tsp = &itActor->s(); tu = itActor->u(); diff --git a/source/games/sw/src/rooms.cpp b/source/games/sw/src/rooms.cpp index 51cdd2225..b78766263 100644 --- a/source/games/sw/src/rooms.cpp +++ b/source/games/sw/src/rooms.cpp @@ -351,16 +351,15 @@ bool FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects, int GetZadjustment(short sectnum, short hitag) { - int i; SPRITEp sp; if (sectnum < 0 || !TEST(sector[sectnum].extra, SECTFX_Z_ADJUST)) return 0L; - StatIterator it(STAT_ST1); - while ((i = it.NextIndex()) >= 0) + SWStatIterator it(STAT_ST1); + while (auto itActor = it.Next()) { - sp = &sprite[i]; + sp = &itActor->s(); if (sp->hitag == hitag && sp->sectnum == sectnum) { diff --git a/source/games/sw/src/rotator.cpp b/source/games/sw/src/rotator.cpp index 020e96c3e..526d0989f 100644 --- a/source/games/sw/src/rotator.cpp +++ b/source/games/sw/src/rotator.cpp @@ -286,7 +286,6 @@ int DoRotator(DSWActor* actor) ROTATORp r; short ndx,w,startwall,endwall; SPRITEp pivot = nullptr; - int i; vec2_t nxy; int dist,closest; bool kill = false; @@ -364,16 +363,17 @@ int DoRotator(DSWActor* actor) } closest = 99999; - StatIterator it(STAT_ROTATOR_PIVOT); - while ((i = it.NextIndex()) >= 0) + SWStatIterator it(STAT_ROTATOR_PIVOT); + while (auto itActor = it.Next()) { - if (sprite[i].lotag == sp->lotag) + auto itsp = &itActor->s(); + if (itsp->lotag == sp->lotag) { - dist = Distance(sp->x, sp->y, sprite[i].x, sprite[i].y); + dist = Distance(sp->x, sp->y, itsp->x, itsp->y); if (dist < closest) { closest = dist; - pivot = &sprite[i]; + pivot = itsp; } } }