- reroute all uses of FActorIterator and NActorIterator through FLevelLocals.

This commit is contained in:
Christoph Oelckers 2019-01-24 18:50:22 +01:00
parent 1f2162fea8
commit 4c250a58ca
9 changed files with 91 additions and 87 deletions

View File

@ -3206,7 +3206,7 @@ void AM_drawAuthorMarkers ()
tex = TexMan.GetTexture(picnum); tex = TexMan.GetTexture(picnum);
} }
} }
FActorIterator it (mark->args[0]); auto it = level.GetActorIterator(mark->args[0]);
AActor *marked = mark->args[0] == 0 ? mark : it.Next(); AActor *marked = mark->args[0] == 0 ? mark : it.Next();
while (marked != NULL) while (marked != NULL)

View File

@ -1175,7 +1175,7 @@ static void PrintSecretString(const char *string, bool thislevel)
{ {
long tid = (long)strtoll(string+2, (char**)&string, 10); long tid = (long)strtoll(string+2, (char**)&string, 10);
if (*string == ';') string++; if (*string == ';') string++;
FActorIterator it(tid); auto it = level.GetActorIterator(tid);
AActor *actor; AActor *actor;
bool foundone = false; bool foundone = false;
if (thislevel) if (thislevel)

View File

@ -142,6 +142,10 @@ struct FLevelLocals : public FLevelData
{ {
return FActorIterator(tid); return FActorIterator(tid);
} }
FActorIterator GetActorIterator(int tid, AActor *start)
{
return FActorIterator(tid, start);
}
NActorIterator GetActorIterator(FName type, int tid) NActorIterator GetActorIterator(FName type, int tid)
{ {
return NActorIterator(type, tid); return NActorIterator(type, tid);

View File

@ -31,6 +31,7 @@
#include "serializer.h" #include "serializer.h"
#include "d_player.h" #include "d_player.h"
#include "r_utility.h" #include "r_utility.h"
#include "g_levellocals.h"
static FRandom pr_quake ("Quake"); static FRandom pr_quake ("Quake");
@ -401,7 +402,7 @@ bool P_StartQuakeXYZ(AActor *activator, int tid, int intensityX, int intensityY,
} }
else else
{ {
FActorIterator iterator (tid); auto iterator = level.GetActorIterator(tid);
while ( (center = iterator.Next ()) ) while ( (center = iterator.Next ()) )
{ {
res = true; res = true;

View File

@ -3603,7 +3603,7 @@ int DLevelScript::ThingCount (int type, int stringid, int tid, int tag)
do_count: do_count:
if (tid) if (tid)
{ {
FActorIterator iterator (tid); auto iterator = level.GetActorIterator(tid);
while ( (actor = iterator.Next ()) ) while ( (actor = iterator.Next ()) )
{ {
if (actor->health > 0 && if (actor->health > 0 &&
@ -3779,7 +3779,7 @@ int DLevelScript::DoSpawnSpot (int type, int spot, int tid, int angle, bool forc
if (spot != 0) if (spot != 0)
{ {
FActorIterator iterator (spot); auto iterator = level.GetActorIterator(spot);
AActor *aspot; AActor *aspot;
while ( (aspot = iterator.Next ()) ) while ( (aspot = iterator.Next ()) )
@ -3800,7 +3800,7 @@ int DLevelScript::DoSpawnSpotFacing (int type, int spot, int tid, bool force)
if (spot != 0) if (spot != 0)
{ {
FActorIterator iterator (spot); auto iterator = level.GetActorIterator(spot);
AActor *aspot; AActor *aspot;
while ( (aspot = iterator.Next ()) ) while ( (aspot = iterator.Next ()) )
@ -3984,7 +3984,7 @@ AActor *SingleActorFromTID (int tid, AActor *defactor)
} }
else else
{ {
FActorIterator iterator (tid); auto iterator = level.GetActorIterator(tid);
return iterator.Next(); return iterator.Next();
} }
} }
@ -4069,7 +4069,7 @@ void DLevelScript::SetActorProperty (int tid, int property, int value)
else else
{ {
AActor *actor; AActor *actor;
FActorIterator iterator (tid); auto iterator = level.GetActorIterator(tid);
while ((actor = iterator.Next()) != NULL) while ((actor = iterator.Next()) != NULL)
{ {
@ -4566,7 +4566,7 @@ int DLevelScript::DoClassifyActor(int tid)
} }
else else
{ {
FActorIterator it(tid); auto it = level.GetActorIterator(tid);
actor = it.Next(); actor = it.Next();
} }
if (actor == NULL) if (actor == NULL)
@ -5050,7 +5050,7 @@ static void SetActorAngle(AActor *activator, int tid, int angle, bool interpolat
} }
else else
{ {
FActorIterator iterator(tid); auto iterator = level.GetActorIterator(tid);
AActor *actor; AActor *actor;
while ((actor = iterator.Next())) while ((actor = iterator.Next()))
@ -5072,7 +5072,7 @@ static void SetActorPitch(AActor *activator, int tid, int angle, bool interpolat
} }
else else
{ {
FActorIterator iterator(tid); auto iterator = level.GetActorIterator(tid);
AActor *actor; AActor *actor;
while ((actor = iterator.Next())) while ((actor = iterator.Next()))
@ -5094,7 +5094,7 @@ static void SetActorRoll(AActor *activator, int tid, int angle, bool interpolate
} }
else else
{ {
FActorIterator iterator(tid); auto iterator = level.GetActorIterator(tid);
AActor *actor; AActor *actor;
while ((actor = iterator.Next())) while ((actor = iterator.Next()))
@ -5121,7 +5121,7 @@ static void SetActorTeleFog(AActor *activator, int tid, FString telefogsrc, FStr
} }
else else
{ {
FActorIterator iterator(tid); auto iterator = level.GetActorIterator(tid);
AActor *actor; AActor *actor;
PClassActor * src = PClass::FindActor(telefogsrc); PClassActor * src = PClass::FindActor(telefogsrc);
@ -5149,7 +5149,7 @@ static int SwapActorTeleFog(AActor *activator, int tid)
} }
else else
{ {
FActorIterator iterator(tid); auto iterator = level.GetActorIterator(tid);
AActor *actor; AActor *actor;
while ((actor = iterator.Next())) while ((actor = iterator.Next()))
@ -5503,7 +5503,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
} }
else else
{ {
FActorIterator iterator(args[0]); auto iterator = level.GetActorIterator(args[0]);
while ((actor = iterator.Next())) while ((actor = iterator.Next()))
{ {
@ -5529,7 +5529,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
} }
else else
{ {
FActorIterator iterator(args[0]); auto iterator = level.GetActorIterator(args[0]);
while ( (actor = iterator.Next()) ) while ( (actor = iterator.Next()) )
{ {
@ -5568,7 +5568,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
} }
else else
{ {
FActorIterator iterator(args[0]); auto iterator = level.GetActorIterator(args[0]);
while ( (actor = iterator.Next()) ) while ( (actor = iterator.Next()) )
{ {
@ -5621,7 +5621,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
} }
else else
{ {
FActorIterator it(args[0]); auto it = level.GetActorIterator(args[0]);
AActor *actor; AActor *actor;
while ( (actor = it.Next()) ) while ( (actor = it.Next()) )
@ -5699,8 +5699,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
if (args[1] == 0) return 1; // [KS] I'm sure the activator can see itself. if (args[1] == 0) return 1; // [KS] I'm sure the activator can see itself.
FActorIterator dstiter (args[1]); auto dstiter = level.GetActorIterator(args[1]);
while ( (dest = dstiter.Next ()) ) while ( (dest = dstiter.Next ()) )
{ {
if (P_CheckSight(source, dest, flags)) return 1; if (P_CheckSight(source, dest, flags)) return 1;
@ -5708,13 +5707,13 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
} }
else else
{ {
FActorIterator srciter (args[0]); auto srciter = level.GetActorIterator(args[0]);
while ( (source = srciter.Next ()) ) while ( (source = srciter.Next ()) )
{ {
if (args[1] != 0) if (args[1] != 0)
{ {
FActorIterator dstiter (args[1]); auto dstiter = level.GetActorIterator(args[1]);
while ( (dest = dstiter.Next ()) ) while ( (dest = dstiter.Next ()) )
{ {
if (P_CheckSight(source, dest, flags)) return 1; if (P_CheckSight(source, dest, flags)) return 1;
@ -5856,7 +5855,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
else else
{ {
AActor *source; AActor *source;
FActorIterator it(args[0]); auto it = level.GetActorIterator(args[0]);
while ((source = it.Next()) != NULL) while ((source = it.Next()) != NULL)
{ {
@ -5887,7 +5886,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
} }
if (sid != 0 || funcIndex == ACSF_PlayActorSound) if (sid != 0 || funcIndex == ACSF_PlayActorSound)
{ {
FActorIterator it(args[0]); auto it = level.GetActorIterator(args[0]);
AActor *spot; AActor *spot;
int chan = argCount > 2 ? args[2] : CHAN_BODY; int chan = argCount > 2 ? args[2] : CHAN_BODY;
@ -5933,7 +5932,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
} }
else else
{ {
FActorIterator it(args[0]); auto it = level.GetActorIterator(args[0]);
AActor *spot; AActor *spot;
while ((spot = it.Next()) != NULL) while ((spot = it.Next()) != NULL)
@ -5956,7 +5955,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
} }
else else
{ {
FActorIterator it(args[0]); auto it = level.GetActorIterator(args[0]);
AActor *spot; AActor *spot;
while ((spot = it.Next()) != NULL) while ((spot = it.Next()) != NULL)
@ -6074,7 +6073,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
} }
else else
{ {
FActorIterator it(args[0]); auto it = level.GetActorIterator(args[0]);
AActor *actor; AActor *actor;
while ((actor = it.Next()) != NULL) while ((actor = it.Next()) != NULL)
@ -6110,7 +6109,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
} }
else else
{ {
FActorIterator it(args[0]); auto it = level.GetActorIterator(args[0]);
AActor *actor; AActor *actor;
while ((actor = it.Next()) != NULL) while ((actor = it.Next()) != NULL)
@ -6144,7 +6143,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
} }
else else
{ {
FActorIterator it(args[0]); auto it = level.GetActorIterator(args[0]);
AActor *actor; AActor *actor;
while ((actor = it.Next()) != NULL) while ((actor = it.Next()) != NULL)
@ -6321,7 +6320,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
} }
} }
FActorIterator iterator(args[0]); auto iterator = level.GetActorIterator(args[0]);
bool canraiseall = true; bool canraiseall = true;
while ((actor = iterator.Next())) while ((actor = iterator.Next()))
{ {
@ -6531,7 +6530,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
} }
else else
{ {
FActorIterator it(tid); auto it = level.GetActorIterator(tid);
while ((actor = it.Next()) != nullptr) while ((actor = it.Next()) != nullptr)
{ {
// Don't log errors when affecting many actors because things might share a TID but not share the flag // Don't log errors when affecting many actors because things might share a TID but not share the flag
@ -6555,7 +6554,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
} }
else else
{ {
FActorIterator it(tid); auto it = level.GetActorIterator(tid);
while ((actor = it.Next()) != nullptr) while ((actor = it.Next()) != nullptr)
{ {
actor->SetTranslation(trname); actor->SetTranslation(trname);
@ -9005,7 +9004,7 @@ scriptwait:
if (STACK(7) != 0) if (STACK(7) != 0)
{ {
FActorIterator iterator (STACK(7)); auto iterator = level.GetActorIterator(STACK(7));
AActor *actor; AActor *actor;
while ( (actor = iterator.Next ()) ) while ( (actor = iterator.Next ()) )
@ -9035,7 +9034,7 @@ scriptwait:
lookup = level.Behaviors.LookupString (STACK(2)); lookup = level.Behaviors.LookupString (STACK(2));
if (lookup != NULL) if (lookup != NULL)
{ {
FActorIterator iterator (STACK(3)); auto iterator = level.GetActorIterator(STACK(3));
AActor *spot; AActor *spot;
while ( (spot = iterator.Next ()) ) while ( (spot = iterator.Next ()) )
@ -9116,7 +9115,7 @@ scriptwait:
} }
else else
{ {
FActorIterator it(STACK(1)); auto it = level.GetActorIterator(STACK(1));
AActor *actor; AActor *actor;
for (actor = it.Next(); actor != NULL; actor = it.Next()) for (actor = it.Next(); actor != NULL; actor = it.Next())
{ {
@ -9144,7 +9143,7 @@ scriptwait:
} }
else else
{ {
FActorIterator it(STACK(3)); auto it = level.GetActorIterator(STACK(3));
AActor *actor; AActor *actor;
for (actor = it.Next(); actor != NULL; actor = it.Next()) for (actor = it.Next(); actor != NULL; actor = it.Next())
{ {
@ -9181,7 +9180,7 @@ scriptwait:
} }
else else
{ {
FActorIterator it(STACK(3)); auto it = level.GetActorIterator(STACK(3));
AActor *actor; AActor *actor;
for (actor = it.Next(); actor != NULL; actor = it.Next()) for (actor = it.Next(); actor != NULL; actor = it.Next())
{ {
@ -9229,7 +9228,7 @@ scriptwait:
} }
else else
{ {
FActorIterator it(STACK(2)); auto it = level.GetActorIterator(STACK(2));
AActor *actor; AActor *actor;
for (actor = it.Next(); actor != NULL; actor = it.Next()) for (actor = it.Next(); actor != NULL; actor = it.Next())
{ {
@ -9801,7 +9800,7 @@ scriptwait:
} }
else else
{ {
FActorIterator it (STACK(3)); auto it = level.GetActorIterator(STACK(3));
camera = it.Next (); camera = it.Next ();
} }
@ -9854,7 +9853,7 @@ scriptwait:
} }
else else
{ {
FActorIterator iterator (STACK(3)); auto iterator = level.GetActorIterator(STACK(3));
AActor *actor; AActor *actor;
int count = 0; int count = 0;
@ -10025,7 +10024,7 @@ scriptwait:
} }
else else
{ {
FActorIterator iterator (tag); auto iterator = level.GetActorIterator(tag);
AActor *actor; AActor *actor;
while ( (actor = iterator.Next ()) ) while ( (actor = iterator.Next ()) )
@ -10051,7 +10050,7 @@ scriptwait:
} }
else else
{ {
FActorIterator iterator (tag); auto iterator = level.GetActorIterator(tag);
AActor *actor; AActor *actor;
while ( (actor = iterator.Next ()) ) while ( (actor = iterator.Next ()) )

View File

@ -1339,7 +1339,7 @@ int P_LookForTID (AActor *actor, INTBOOL allaround, FLookExParams *params)
actor->LastLookActor = nullptr; actor->LastLookActor = nullptr;
} }
FActorIterator iterator (actor->TIDtoHate, actor->LastLookActor); auto iterator = level.GetActorIterator(actor->TIDtoHate, actor->LastLookActor);
int c = (pr_look3() & 31) + 7; // Look for between 7 and 38 hatees at a time int c = (pr_look3() & 31) + 7; // Look for between 7 and 38 hatees at a time
while ((other = iterator.Next()) != actor->LastLookActor) while ((other = iterator.Next()) != actor->LastLookActor)
{ {
@ -1760,7 +1760,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Look)
// [RH] Set goal now if appropriate // [RH] Set goal now if appropriate
if (self->special == Thing_SetGoal && self->args[0] == 0) if (self->special == Thing_SetGoal && self->args[0] == 0)
{ {
NActorIterator iterator (NAME_PatrolPoint, self->args[1]); auto iterator = level.GetActorIterator(NAME_PatrolPoint, self->args[1]);
self->special = 0; self->special = 0;
self->goal = iterator.Next (); self->goal = iterator.Next ();
self->reactiontime = self->args[2] * TICRATE + level.maptime; self->reactiontime = self->args[2] * TICRATE + level.maptime;
@ -1889,7 +1889,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LookEx)
// [RH] Set goal now if appropriate // [RH] Set goal now if appropriate
if (self->special == Thing_SetGoal && self->args[0] == 0) if (self->special == Thing_SetGoal && self->args[0] == 0)
{ {
NActorIterator iterator(NAME_PatrolPoint, self->args[1]); auto iterator = level.GetActorIterator(NAME_PatrolPoint, self->args[1]);
self->special = 0; self->special = 0;
self->goal = iterator.Next (); self->goal = iterator.Next ();
self->reactiontime = self->args[2] * TICRATE + level.maptime; self->reactiontime = self->args[2] * TICRATE + level.maptime;
@ -2372,8 +2372,8 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi
if (result) if (result)
{ {
// reached the goal // reached the goal
NActorIterator iterator (NAME_PatrolPoint, actor->goal->args[0]); auto iterator = level.GetActorIterator(NAME_PatrolPoint, actor->goal->args[0]);
NActorIterator specit (NAME_PatrolSpecial, actor->goal->tid); auto specit = level.GetActorIterator(NAME_PatrolSpecial, actor->goal->tid);
AActor *spec; AActor *spec;
// Execute the specials of any PatrolSpecials with the same TID // Execute the specials of any PatrolSpecials with the same TID

View File

@ -171,7 +171,7 @@ FUNC(LS_Polyobj_MoveTo)
FUNC(LS_Polyobj_MoveToSpot) FUNC(LS_Polyobj_MoveToSpot)
// Polyobj_MoveToSpot (po, speed, tid) // Polyobj_MoveToSpot (po, speed, tid)
{ {
FActorIterator iterator (arg2); auto iterator = Level->GetActorIterator(arg2);
AActor *spot = iterator.Next(); AActor *spot = iterator.Next();
if (spot == NULL) return false; if (spot == NULL) return false;
return EV_MovePolyTo (Level, ln, arg0, SPEED(arg1), spot->Pos(), false); return EV_MovePolyTo (Level, ln, arg0, SPEED(arg1), spot->Pos(), false);
@ -222,7 +222,7 @@ FUNC(LS_Polyobj_OR_MoveTo)
FUNC(LS_Polyobj_OR_MoveToSpot) FUNC(LS_Polyobj_OR_MoveToSpot)
// Polyobj_OR_MoveToSpot (po, speed, tid) // Polyobj_OR_MoveToSpot (po, speed, tid)
{ {
FActorIterator iterator (arg2); auto iterator = Level->GetActorIterator(arg2);
AActor *spot = iterator.Next(); AActor *spot = iterator.Next();
if (spot == NULL) return false; if (spot == NULL) return false;
return EV_MovePolyTo (Level, ln, arg0, SPEED(arg1), spot->Pos(), true); return EV_MovePolyTo (Level, ln, arg0, SPEED(arg1), spot->Pos(), true);
@ -1210,7 +1210,7 @@ FUNC(LS_ThrustThing)
{ {
if (arg3 != 0) if (arg3 != 0)
{ {
FActorIterator iterator (arg3); auto iterator = Level->GetActorIterator(arg3);
while ((it = iterator.Next()) != NULL) while ((it = iterator.Next()) != NULL)
{ {
ThrustThingHelper (it, BYTEANGLE(arg0), arg1, arg2); ThrustThingHelper (it, BYTEANGLE(arg0), arg1, arg2);
@ -1241,7 +1241,7 @@ FUNC(LS_ThrustThingZ) // [BC]
if (arg0 != 0) if (arg0 != 0)
{ {
FActorIterator iterator (arg0); auto iterator = Level->GetActorIterator(arg0);
while ( (victim = iterator.Next ()) ) while ( (victim = iterator.Next ()) )
{ {
@ -1281,7 +1281,7 @@ FUNC(LS_Thing_SetSpecial) // [BC]
else else
{ {
AActor *actor; AActor *actor;
FActorIterator iterator (arg0); auto iterator = Level->GetActorIterator(arg0);
while ( (actor = iterator.Next ()) ) while ( (actor = iterator.Next ()) )
{ {
@ -1308,7 +1308,7 @@ FUNC(LS_Thing_ChangeTID)
} }
else else
{ {
FActorIterator iterator (arg0); auto iterator = Level->GetActorIterator(arg0);
AActor *actor, *next; AActor *actor, *next;
next = iterator.Next (); next = iterator.Next ();
@ -1424,7 +1424,7 @@ FUNC(LS_Thing_Activate)
if (arg0 != 0) if (arg0 != 0)
{ {
AActor *actor; AActor *actor;
FActorIterator iterator (arg0); auto iterator = Level->GetActorIterator(arg0);
int count = 0; int count = 0;
actor = iterator.Next (); actor = iterator.Next ();
@ -1454,7 +1454,7 @@ FUNC(LS_Thing_Deactivate)
if (arg0 != 0) if (arg0 != 0)
{ {
AActor *actor; AActor *actor;
FActorIterator iterator (arg0); auto iterator = Level->GetActorIterator(arg0);
int count = 0; int count = 0;
actor = iterator.Next (); actor = iterator.Next ();
@ -1483,7 +1483,7 @@ FUNC(LS_Thing_Remove)
{ {
if (arg0 != 0) if (arg0 != 0)
{ {
FActorIterator iterator (arg0); auto iterator = Level->GetActorIterator(arg0);
AActor *actor; AActor *actor;
actor = iterator.Next (); actor = iterator.Next ();
@ -1527,7 +1527,7 @@ FUNC(LS_Thing_Destroy)
} }
else else
{ {
FActorIterator iterator (arg0); auto iterator = Level->GetActorIterator(arg0);
actor = iterator.Next (); actor = iterator.Next ();
while (actor) while (actor)
@ -1565,9 +1565,9 @@ FUNC(LS_Thing_ProjectileGravity)
FUNC(LS_Thing_Hate) FUNC(LS_Thing_Hate)
// Thing_Hate (hater, hatee, group/"xray"?) // Thing_Hate (hater, hatee, group/"xray"?)
{ {
FActorIterator haterIt (arg0); AActor *hater, *hatee = nullptr;
AActor *hater, *hatee = NULL; auto haterIt = Level->GetActorIterator(arg0);
FActorIterator hateeIt (arg1); auto hateeIt = Level->GetActorIterator(arg1);
bool nothingToHate = false; bool nothingToHate = false;
if (arg1 != 0) if (arg1 != 0)
@ -1768,7 +1768,7 @@ FUNC(LS_Thing_Raise)
} }
else else
{ {
FActorIterator iterator (arg0); auto iterator = Level->GetActorIterator(arg0);
while ( (target = iterator.Next ()) ) while ( (target = iterator.Next ()) )
{ {
@ -1795,7 +1795,7 @@ FUNC(LS_Thing_Stop)
} }
else else
{ {
FActorIterator iterator (arg0); auto iterator = Level->GetActorIterator(arg0);
while ( (target = iterator.Next ()) ) while ( (target = iterator.Next ()) )
{ {
@ -1811,8 +1811,8 @@ FUNC(LS_Thing_Stop)
FUNC(LS_Thing_SetGoal) FUNC(LS_Thing_SetGoal)
// Thing_SetGoal (tid, goal, delay, chasegoal) // Thing_SetGoal (tid, goal, delay, chasegoal)
{ {
FActorIterator selfiterator (arg0); auto selfiterator = Level->GetActorIterator(arg0);
NActorIterator goaliterator (NAME_PatrolPoint, arg1); auto goaliterator = Level->GetActorIterator(NAME_PatrolPoint, arg1);
AActor *self; AActor *self;
AActor *goal = goaliterator.Next (); AActor *goal = goaliterator.Next ();
bool ok = false; bool ok = false;
@ -1861,7 +1861,7 @@ enum
FUNC(LS_Thing_SetTranslation) FUNC(LS_Thing_SetTranslation)
// Thing_SetTranslation (tid, range) // Thing_SetTranslation (tid, range)
{ {
FActorIterator iterator (arg0); auto iterator = Level->GetActorIterator(arg0);
int range; int range;
AActor *target; AActor *target;
bool ok = false; bool ok = false;
@ -2278,7 +2278,7 @@ FUNC(LS_Sector_SetLink)
{ {
if (arg0 != 0) // control tag == 0 is for static initialization and must not be handled here if (arg0 != 0) // control tag == 0 is for static initialization and must not be handled here
{ {
int control = level.FindFirstSectorFromTag(arg0); int control = Level->FindFirstSectorFromTag(arg0);
if (control >= 0) if (control >= 0)
{ {
return P_AddSectorLinks(&Level->sectors[control], arg1, arg2, arg3); return P_AddSectorLinks(&Level->sectors[control], arg1, arg2, arg3);
@ -2822,7 +2822,7 @@ FUNC(LS_ChangeCamera)
AActor *camera; AActor *camera;
if (arg0 != 0) if (arg0 != 0)
{ {
FActorIterator iterator (arg0); auto iterator = Level->GetActorIterator(arg0);
camera = iterator.Next (); camera = iterator.Next ();
} }
else else
@ -3159,7 +3159,7 @@ FUNC(LS_NoiseAlert)
} }
else else
{ {
FActorIterator iter (arg0); auto iter = Level->GetActorIterator(arg0);
target = iter.Next(); target = iter.Next();
} }
@ -3173,7 +3173,7 @@ FUNC(LS_NoiseAlert)
} }
else else
{ {
FActorIterator iter (arg1); auto iter = Level->GetActorIterator(arg1);
emitter = iter.Next(); emitter = iter.Next();
} }
@ -3333,7 +3333,7 @@ FUNC(LS_GlassBreak)
FUNC(LS_StartConversation) FUNC(LS_StartConversation)
// StartConversation (tid, facetalker) // StartConversation (tid, facetalker)
{ {
FActorIterator iterator (arg0); auto iterator = Level->GetActorIterator(arg0);
AActor *target = iterator.Next(); AActor *target = iterator.Next();
@ -3384,7 +3384,7 @@ FUNC(LS_Thing_SetConversation)
if (arg0 != 0) if (arg0 != 0)
{ {
FActorIterator iterator (arg0); auto iterator = Level->GetActorIterator(arg0);
while ((it = iterator.Next()) != NULL) while ((it = iterator.Next()) != NULL)
{ {
it->ConversationRoot = dlg_index; it->ConversationRoot = dlg_index;

View File

@ -250,7 +250,7 @@ static AActor *SelectTeleDest (int tid, int tag, bool norandom)
if (tid != 0) if (tid != 0)
{ {
NActorIterator iterator (NAME_TeleportDest, tid); auto iterator = level.GetActorIterator(NAME_TeleportDest, tid);
int count = 0; int count = 0;
while ( (searcher = iterator.Next ()) ) while ( (searcher = iterator.Next ()) )
{ {
@ -268,12 +268,12 @@ static AActor *SelectTeleDest (int tid, int tag, bool norandom)
if (tag == 0) if (tag == 0)
{ {
// Try to find a matching map spot (fixes Hexen MAP10) // Try to find a matching map spot (fixes Hexen MAP10)
NActorIterator it2 (NAME_MapSpot, tid); auto it2 = level.GetActorIterator(NAME_MapSpot, tid);
searcher = it2.Next (); searcher = it2.Next ();
if (searcher == NULL) if (searcher == nullptr)
{ {
// Try to find a matching non-blocking spot of any type (fixes Caldera MAP13) // Try to find a matching non-blocking spot of any type (fixes Caldera MAP13)
FActorIterator it3 (tid); auto it3 = level.GetActorIterator(tid);
searcher = it3.Next (); searcher = it3.Next ();
while (searcher != NULL && (searcher->flags & MF_SOLID)) while (searcher != NULL && (searcher->flags & MF_SOLID))
{ {
@ -607,7 +607,7 @@ bool EV_TeleportOther (int other_tid, int dest_tid, bool fog)
if (other_tid != 0 && dest_tid != 0) if (other_tid != 0 && dest_tid != 0)
{ {
AActor *victim; AActor *victim;
FActorIterator iterator (other_tid); auto iterator = level.GetActorIterator(other_tid);
while ( (victim = iterator.Next ()) ) while ( (victim = iterator.Next ()) )
{ {
@ -642,7 +642,7 @@ bool EV_TeleportGroup (int group_tid, AActor *victim, int source_tid, int dest_t
{ {
AActor *sourceOrigin, *destOrigin; AActor *sourceOrigin, *destOrigin;
{ {
FActorIterator iterator (source_tid); auto iterator = level.GetActorIterator(source_tid);
sourceOrigin = iterator.Next (); sourceOrigin = iterator.Next ();
} }
if (sourceOrigin == NULL) if (sourceOrigin == NULL)
@ -651,7 +651,7 @@ bool EV_TeleportGroup (int group_tid, AActor *victim, int source_tid, int dest_t
} }
{ {
NActorIterator iterator (NAME_TeleportDest, dest_tid); auto iterator = level.GetActorIterator(NAME_TeleportDest, dest_tid);
destOrigin = iterator.Next (); destOrigin = iterator.Next ();
} }
if (destOrigin == NULL) if (destOrigin == NULL)
@ -669,7 +669,7 @@ bool EV_TeleportGroup (int group_tid, AActor *victim, int source_tid, int dest_t
} }
else else
{ {
FActorIterator iterator (group_tid); auto iterator = level.GetActorIterator(group_tid);
// For each actor with tid matching arg0, move it to the same // For each actor with tid matching arg0, move it to the same
// position relative to destOrigin as it is relative to sourceOrigin // position relative to destOrigin as it is relative to sourceOrigin
@ -697,7 +697,7 @@ bool EV_TeleportSector (int tag, int source_tid, int dest_tid, bool fog, int gro
{ {
AActor *sourceOrigin, *destOrigin; AActor *sourceOrigin, *destOrigin;
{ {
FActorIterator iterator (source_tid); auto iterator = level.GetActorIterator(source_tid);
sourceOrigin = iterator.Next (); sourceOrigin = iterator.Next ();
} }
if (sourceOrigin == NULL) if (sourceOrigin == NULL)
@ -705,7 +705,7 @@ bool EV_TeleportSector (int tag, int source_tid, int dest_tid, bool fog, int gro
return false; return false;
} }
{ {
NActorIterator iterator (NAME_TeleportDest, dest_tid); auto iterator = level.GetActorIterator(NAME_TeleportDest, dest_tid);
destOrigin = iterator.Next (); destOrigin = iterator.Next ();
} }
if (destOrigin == NULL) if (destOrigin == NULL)

View File

@ -57,7 +57,7 @@ bool P_Thing_Spawn (int tid, AActor *source, int type, DAngle angle, bool fog, i
int rtn = 0; int rtn = 0;
PClassActor *kind; PClassActor *kind;
AActor *spot, *mobj; AActor *spot, *mobj;
FActorIterator iterator (tid); auto iterator = level.GetActorIterator(tid);
kind = P_GetSpawnableType(type); kind = P_GetSpawnableType(type);
@ -150,10 +150,10 @@ bool P_Thing_Move (int tid, AActor *source, int mapspot, bool fog)
if (tid != 0) if (tid != 0)
{ {
FActorIterator iterator1(tid); auto iterator1 = level.GetActorIterator(tid);
source = iterator1.Next(); source = iterator1.Next();
} }
FActorIterator iterator2 (mapspot); auto iterator2 = level.GetActorIterator(mapspot);
target = iterator2.Next (); target = iterator2.Next ();
if (source != NULL && target != NULL) if (source != NULL && target != NULL)
@ -263,7 +263,7 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_nam
int rtn = 0; int rtn = 0;
PClassActor *kind; PClassActor *kind;
AActor *spot, *mobj, *targ = forcedest; AActor *spot, *mobj, *targ = forcedest;
FActorIterator iterator (tid); auto iterator = level.GetActorIterator(tid);
int defflags3; int defflags3;
if (type_name == NULL) if (type_name == NULL)
@ -297,7 +297,7 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_nam
} }
while (spot != NULL) while (spot != NULL)
{ {
FActorIterator tit (dest); auto tit = level.GetActorIterator(dest);
if (dest == 0 || (targ = tit.Next())) if (dest == 0 || (targ = tit.Next()))
{ {
@ -396,7 +396,7 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_nam
int P_Thing_Damage (int tid, AActor *whofor0, int amount, FName type) int P_Thing_Damage (int tid, AActor *whofor0, int amount, FName type)
{ {
FActorIterator iterator (tid); auto iterator = level.GetActorIterator(tid);
int count = 0; int count = 0;
AActor *actor; AActor *actor;