- give thinkers a 'level' member and change linking to the chain to happen outside the constructor.

This commit is contained in:
Christoph Oelckers 2019-01-27 01:49:20 +01:00
commit 8323524014
43 changed files with 201 additions and 228 deletions

View file

@ -70,8 +70,8 @@ void FThinkerList::AddTail(DThinker *thinker)
assert(!(thinker->ObjectFlags & OF_EuthanizeMe));
if (Sentinel == NULL)
{
Sentinel = Create<DThinker>(DThinker::NO_LINK);
Sentinel->ObjectFlags |= OF_Sentinel;
Sentinel = Create<DThinker>();
Sentinel->ObjectFlags = OF_Sentinel;
Sentinel->NextThinker = Sentinel;
Sentinel->PrevThinker = Sentinel;
GC::WriteBarrier(Sentinel);
@ -232,21 +232,10 @@ void DThinker::SerializeThinkers(FSerializer &arc, bool hubLoad)
//
//==========================================================================
DThinker::DThinker (int statnum) throw()
DThinker::DThinker () throw()
{
NextThinker = NULL;
PrevThinker = NULL;
if (bSerialOverride)
{ // The serializer will insert us into the right list
return;
}
ObjectFlags |= OF_JustSpawned;
if ((unsigned)statnum > MAX_STATNUM)
{
statnum = MAX_STATNUM;
}
FreshThinkers[statnum].AddTail (this);
NextThinker = nullptr;
PrevThinker = nullptr;
}
DThinker::DThinker(no_link_type foo) throw()
@ -270,6 +259,12 @@ void DThinker::OnDestroy ()
Super::OnDestroy();
}
void DThinker::Serialize(FSerializer &arc)
{
Super::Serialize(arc);
arc("level", Level);
}
//==========================================================================
//
//