- handle all remaining StatIterators.

This commit is contained in:
Christoph Oelckers 2021-11-06 09:29:38 +01:00
parent 69223af7b0
commit df5d980f79
3 changed files with 11 additions and 14 deletions

View file

@ -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();

View file

@ -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)
{

View file

@ -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;
}
}
}