- replaced all TThinkerIterators except one that probably won't be relevant anymore as things progress.

This commit is contained in:
Christoph Oelckers 2019-01-30 00:27:05 +01:00
parent 4ad327d7e0
commit 78b7b64237
10 changed files with 30 additions and 28 deletions

View file

@ -1422,8 +1422,6 @@ public:
int ApplyDamageFactor(FName damagetype, int damage) const;
int GetModifiedDamage(FName damagetype, int damage, bool passive);
void DeleteAttachedLights();
static void DeleteAllAttachedLights();
static void RecreateAllAttachedLights();
bool isFrozen();
bool hasmodel;

View file

@ -945,7 +945,8 @@ static void PrintFilteredActorList(const ActorTypeChecker IsActorType, const cha
}
}
}
TThinkerIterator<AActor> it;
// This only works on the primary level.
auto it = currentUILevel->GetThinkerIterator<AActor>();
while ( (mo = it.Next()) )
{

View file

@ -2080,12 +2080,12 @@ uint8_t *FDynamicBuffer::GetData (int *len)
}
static int RemoveClass(const PClass *cls)
static int RemoveClass(FLevelLocals *Level, const PClass *cls)
{
AActor *actor;
int removecount = 0;
bool player = false;
TThinkerIterator<AActor> iterator(cls);
auto iterator = Level->GetThinkerIterator<AActor>(cls->TypeName);
while ((actor = iterator.Next()))
{
if (actor->IsA(cls))
@ -2581,11 +2581,11 @@ void Net_DoCommand (int type, uint8_t **stream, int player)
PClassActor *cls = PClass::FindActor(s);
if (cls != NULL && cls->IsDescendantOf(RUNTIME_CLASS(AActor)))
{
removecount = RemoveClass(cls);
removecount = RemoveClass(&level, cls);
const PClass *cls_rep = cls->GetReplacement();
if (cls != cls_rep)
{
removecount += RemoveClass(cls_rep);
removecount += RemoveClass(&leve, cls_rep);
}
Printf("Removed %d actors of type %s.\n", removecount, s);
}

View file

@ -232,6 +232,9 @@ public:
void SecretExitLevel(int position);
void DoLoadLevel(const FString &nextmapname, int position, bool autosave, bool newGame);
void DeleteAllAttachedLights();
void RecreateAllAttachedLights();
private:
// Work data for CollectConnectedGroups.

View file

@ -54,8 +54,6 @@ struct SpreadInfo
TArray<side_t *> SpreadStack;
};
static int ImpactCount;
CVAR (Bool, cl_spreaddecals, true, CVAR_ARCHIVE)
IMPLEMENT_CLASS(DBaseDecal, false, true)
@ -652,18 +650,16 @@ DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, double ix, doubl
CCMD (countdecals)
{
Printf ("%d impact decals\n", ImpactCount);
}
for (auto Level : AllLevels())
{
auto iterator = Level->GetThinkerIterator<DImpactDecal>(NAME_None, STAT_AUTODECAL);
int count = 0;
CCMD (countdecalsreal)
{
TThinkerIterator<DImpactDecal> iterator (STAT_AUTODECAL);
int count = 0;
while (iterator.Next())
count++;
while (iterator.Next())
count++;
Printf ("Counted %d impact decals\n", count);
Printf("%s: Counted %d impact decals\n", Level->MapName.GetChars(), count);
}
}
CCMD (spray)

View file

@ -71,8 +71,11 @@ static FRandom randLight;
CUSTOM_CVAR (Bool, gl_lights, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
if (self) AActor::RecreateAllAttachedLights();
else AActor::DeleteAllAttachedLights();
for (auto Level : AllLevels())
{
if (self) Level->RecreateAllAttachedLights();
else Level->DeleteAllAttachedLights();
}
}
CVAR (Bool, gl_attachedlights, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
@ -833,9 +836,9 @@ void AActor::DeleteAttachedLights()
//
//==========================================================================
void AActor::DeleteAllAttachedLights()
void FLevelLocals::DeleteAllAttachedLights()
{
TThinkerIterator<AActor> it;
auto it = GetThinkerIterator<AActor>();
AActor * a;
while ((a=it.Next()))
@ -850,9 +853,9 @@ void AActor::DeleteAllAttachedLights()
//
//==========================================================================
void AActor::RecreateAllAttachedLights()
void FLevelLocals::RecreateAllAttachedLights()
{
TThinkerIterator<AActor> it;
auto it = GetThinkerIterator<AActor>();
AActor * a;
while ((a=it.Next()))

View file

@ -116,7 +116,6 @@ void FGLRenderer::Initialize(int width, int height)
FGLRenderer::~FGLRenderer()
{
FlushModels();
AActor::DeleteAllAttachedLights();
TexMan.FlushAll();
if (mShaderManager != nullptr) delete mShaderManager;
if (mSamplerManager != nullptr) delete mSamplerManager;

View file

@ -2213,6 +2213,7 @@ bool FBehavior::Init(FLevelLocals *Level, int lumpnum, FileReader * fr, int len)
uint8_t *object;
int i;
this->Level = Level;
LumpNum = lumpnum;
// Now that everything is set up, record this module as being among the loaded modules.
@ -3270,7 +3271,7 @@ void FBehavior::StartTypedScripts (uint16_t type, AActor *activator, bool always
ptr = &Scripts[i];
if (ptr->Type == type)
{
DLevelScript *runningScript = P_GetScriptGoing (&level, activator, NULL, ptr->Number,
DLevelScript *runningScript = P_GetScriptGoing (Level, activator, NULL, ptr->Number,
ptr, this, &arg1, 1, always ? ACS_ALWAYS : 0);
if (nullptr != runningScript && runNow)
{

View file

@ -387,6 +387,7 @@ private:
ACSFormat Format;
FLevelLocals *Level;
int LumpNum;
uint8_t *Data;
int DataSize;

View file

@ -329,7 +329,7 @@ void P_RunEffects (FLevelLocals *Level)
int pnum = players[consoleplayer].camera->Sector->Index() * Level->sectors.Size();
AActor *actor;
TThinkerIterator<AActor> iterator;
auto iterator = Level->GetThinkerIterator<AActor>();
while ( (actor = iterator.Next ()) )
{