mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 20:21:26 +00:00
- fixed initialization of classes so that AllActorClasses only gets initialized when the game knows what is an actor and what is not.
This could result in lost states for weapons because the weapon class did not get added to the array.
This commit is contained in:
parent
c3f9b4a5ee
commit
694b48423a
2 changed files with 14 additions and 6 deletions
|
@ -220,6 +220,14 @@ void PClass::StaticInit ()
|
|||
{
|
||||
((ClassReg *)*probe)->RegisterClass ();
|
||||
}
|
||||
probe.Reset();
|
||||
for(auto cls : AllClasses)
|
||||
{
|
||||
if (cls->IsDescendantOf(RUNTIME_CLASS(AActor)))
|
||||
{
|
||||
PClassActor::AllActorClasses.Push(static_cast<PClassActor*>(cls));
|
||||
}
|
||||
}
|
||||
|
||||
// Keep built-in classes in consistant order. I did this before, though
|
||||
// I'm not sure if this is really necessary to maintain any sort of sync.
|
||||
|
@ -344,7 +352,7 @@ PClass *ClassReg::RegisterClass()
|
|||
PClass *cls = new PClass;
|
||||
|
||||
SetupClass(cls);
|
||||
cls->InsertIntoHash();
|
||||
cls->InsertIntoHash(true);
|
||||
if (ParentType != nullptr)
|
||||
{
|
||||
cls->ParentClass = ParentType->RegisterClass();
|
||||
|
@ -379,7 +387,7 @@ void ClassReg::SetupClass(PClass *cls)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void PClass::InsertIntoHash ()
|
||||
void PClass::InsertIntoHash (bool native)
|
||||
{
|
||||
auto k = ClassMap.CheckKey(TypeName);
|
||||
if (k != nullptr)
|
||||
|
@ -390,7 +398,7 @@ void PClass::InsertIntoHash ()
|
|||
{
|
||||
ClassMap[TypeName] = this;
|
||||
}
|
||||
if (IsDescendantOf(RUNTIME_CLASS(AActor)))
|
||||
if (!native && IsDescendantOf(RUNTIME_CLASS(AActor)))
|
||||
{
|
||||
PClassActor::AllActorClasses.Push(static_cast<PClassActor*>(this));
|
||||
}
|
||||
|
@ -690,7 +698,7 @@ PClass *PClass::CreateDerivedClass(FName name, unsigned int size)
|
|||
|
||||
if (!notnew)
|
||||
{
|
||||
type->InsertIntoHash();
|
||||
type->InsertIntoHash(false);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
@ -759,7 +767,7 @@ PClass *PClass::FindClassTentative(FName name)
|
|||
Derive(type, name);
|
||||
type->Size = TentativeClass;
|
||||
|
||||
type->InsertIntoHash();
|
||||
type->InsertIntoHash(false);
|
||||
return type;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
// The rest are all functions and static data ----------------
|
||||
PClass();
|
||||
~PClass();
|
||||
void InsertIntoHash();
|
||||
void InsertIntoHash(bool native);
|
||||
DObject *CreateNew();
|
||||
PClass *CreateDerivedClass(FName name, unsigned int size);
|
||||
|
||||
|
|
Loading…
Reference in a new issue