mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-31 13:50:48 +00:00
- removed PClassType and PClassClass.
All non-actors now use PClass exclusively as their type descriptor. Getting rid of these two classes already removes a lot of obtuse code from the type system, but there's still three more classes to go before a major cleanup can be undertaken.
This commit is contained in:
parent
e3d07bddab
commit
3cddcc8524
3 changed files with 1 additions and 81 deletions
|
@ -95,8 +95,6 @@ enum
|
||||||
CLASSREG_PClassActor,
|
CLASSREG_PClassActor,
|
||||||
CLASSREG_PClassInventory,
|
CLASSREG_PClassInventory,
|
||||||
CLASSREG_PClassPlayerPawn,
|
CLASSREG_PClassPlayerPawn,
|
||||||
CLASSREG_PClassType,
|
|
||||||
CLASSREG_PClassClass,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ClassReg
|
struct ClassReg
|
||||||
|
|
|
@ -151,34 +151,6 @@ void DumpTypeTable()
|
||||||
Printf("Buckets of len %d: %d (%.2f%%)\n", j, lens[j], j!=0?double(lens[j])/used*100:-1.0);
|
Printf("Buckets of len %d: %d (%.2f%%)\n", j, lens[j], j!=0?double(lens[j])/used*100:-1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PClassType *************************************************************/
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PClassType, false, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// PClassType Constructor
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
PClassType::PClassType()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/* PClassClass ************************************************************/
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PClassClass, false, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// PClassClass Constructor
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
PClassClass::PClassClass()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/* PType ******************************************************************/
|
/* PType ******************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PType, true, true)
|
IMPLEMENT_CLASS(PType, true, true)
|
||||||
|
@ -3014,28 +2986,19 @@ void PClass::StaticShutdown ()
|
||||||
//
|
//
|
||||||
// PClass :: StaticBootstrap STATIC
|
// PClass :: StaticBootstrap STATIC
|
||||||
//
|
//
|
||||||
// PClass and PClassClass have intermingling dependencies on their
|
|
||||||
// definitions. To sort this out, we explicitly define them before
|
|
||||||
// proceeding with the RegisterClass loop in StaticInit().
|
|
||||||
//
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void PClass::StaticBootstrap()
|
void PClass::StaticBootstrap()
|
||||||
{
|
{
|
||||||
PClassClass *clscls = new PClassClass;
|
PClass *cls = new PClass;
|
||||||
PClassClass::RegistrationInfo.SetupClass(clscls);
|
|
||||||
|
|
||||||
PClassClass *cls = new PClassClass;
|
|
||||||
PClass::RegistrationInfo.SetupClass(cls);
|
PClass::RegistrationInfo.SetupClass(cls);
|
||||||
|
|
||||||
// The PClassClass constructor initialized these to nullptr, because the
|
// The PClassClass constructor initialized these to nullptr, because the
|
||||||
// PClass metadata had not been created yet. Now it has, so we know what
|
// PClass metadata had not been created yet. Now it has, so we know what
|
||||||
// they should be and can insert them into the type table successfully.
|
// they should be and can insert them into the type table successfully.
|
||||||
clscls->InsertIntoHash();
|
|
||||||
cls->InsertIntoHash();
|
cls->InsertIntoHash();
|
||||||
|
|
||||||
// Create parent objects before we go so that these definitions are complete.
|
// Create parent objects before we go so that these definitions are complete.
|
||||||
clscls->ParentClass = PClassType::RegistrationInfo.ParentType->RegisterClass();
|
|
||||||
cls->ParentClass = PClass::RegistrationInfo.ParentType->RegisterClass();
|
cls->ParentClass = PClass::RegistrationInfo.ParentType->RegisterClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3095,8 +3058,6 @@ PClass *ClassReg::RegisterClass()
|
||||||
&PClassActor::RegistrationInfo,
|
&PClassActor::RegistrationInfo,
|
||||||
&PClassInventory::RegistrationInfo,
|
&PClassInventory::RegistrationInfo,
|
||||||
&PClassPlayerPawn::RegistrationInfo,
|
&PClassPlayerPawn::RegistrationInfo,
|
||||||
&PClassType::RegistrationInfo,
|
|
||||||
&PClassClass::RegistrationInfo,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Skip classes that have already been registered
|
// Skip classes that have already been registered
|
||||||
|
|
|
@ -199,22 +199,13 @@ public:
|
||||||
// Prototype *+ *+
|
// Prototype *+ *+
|
||||||
|
|
||||||
struct ZCC_ExprConstant;
|
struct ZCC_ExprConstant;
|
||||||
class PClassType;
|
|
||||||
class PType : public PTypeBase
|
class PType : public PTypeBase
|
||||||
{
|
{
|
||||||
//DECLARE_ABSTRACT_CLASS_WITH_META(PType, DObject, PClassType);
|
|
||||||
// We need to unravel the _WITH_META macro, since PClassType isn't defined yet,
|
|
||||||
// and we can't define it until we've defined PClass. But we can't define that
|
|
||||||
// without defining PType.
|
|
||||||
DECLARE_ABSTRACT_CLASS(PType, PTypeBase)
|
DECLARE_ABSTRACT_CLASS(PType, PTypeBase)
|
||||||
HAS_OBJECT_POINTERS;
|
HAS_OBJECT_POINTERS;
|
||||||
protected:
|
protected:
|
||||||
enum { MetaClassNum = CLASSREG_PClassType };
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef PClassType MetaClass;
|
|
||||||
MetaClass *GetClass() const;
|
|
||||||
|
|
||||||
PClass *TypeTableType; // The type to use for hashing into the type table
|
PClass *TypeTableType; // The type to use for hashing into the type table
|
||||||
unsigned int Size; // this type's size
|
unsigned int Size; // this type's size
|
||||||
unsigned int Align; // this type's preferred alignment
|
unsigned int Align; // this type's preferred alignment
|
||||||
|
@ -777,22 +768,17 @@ enum
|
||||||
TentativeClass = UINT_MAX,
|
TentativeClass = UINT_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
class PClassClass;
|
|
||||||
class PClass : public PNativeStruct
|
class PClass : public PNativeStruct
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PClass, PNativeStruct);
|
DECLARE_CLASS(PClass, PNativeStruct);
|
||||||
HAS_OBJECT_POINTERS;
|
HAS_OBJECT_POINTERS;
|
||||||
protected:
|
protected:
|
||||||
// We unravel _WITH_META here just as we did for PType.
|
// We unravel _WITH_META here just as we did for PType.
|
||||||
enum { MetaClassNum = CLASSREG_PClassClass };
|
|
||||||
TArray<FTypeAndOffset> SpecialInits;
|
TArray<FTypeAndOffset> SpecialInits;
|
||||||
void Derive(PClass *newclass, FName name);
|
void Derive(PClass *newclass, FName name);
|
||||||
void InitializeSpecials(void *addr, void *defaults) const;
|
void InitializeSpecials(void *addr, void *defaults) const;
|
||||||
void SetSuper();
|
void SetSuper();
|
||||||
public:
|
public:
|
||||||
typedef PClassClass MetaClass;
|
|
||||||
MetaClass *GetClass() const;
|
|
||||||
|
|
||||||
void WriteValue(FSerializer &ar, const char *key,const void *addr) const override;
|
void WriteValue(FSerializer &ar, const char *key,const void *addr) const override;
|
||||||
void WriteAllFields(FSerializer &ar, const void *addr) const;
|
void WriteAllFields(FSerializer &ar, const void *addr) const;
|
||||||
bool ReadValue(FSerializer &ar, const char *key,void *addr) const override;
|
bool ReadValue(FSerializer &ar, const char *key,void *addr) const override;
|
||||||
|
@ -870,31 +856,6 @@ public:
|
||||||
static bool bVMOperational;
|
static bool bVMOperational;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PClassType : public PClass
|
|
||||||
{
|
|
||||||
DECLARE_CLASS(PClassType, PClass);
|
|
||||||
protected:
|
|
||||||
public:
|
|
||||||
PClassType();
|
|
||||||
};
|
|
||||||
|
|
||||||
inline PType::MetaClass *PType::GetClass() const
|
|
||||||
{
|
|
||||||
return static_cast<MetaClass *>(DObject::GetClass());
|
|
||||||
}
|
|
||||||
|
|
||||||
class PClassClass : public PClassType
|
|
||||||
{
|
|
||||||
DECLARE_CLASS(PClassClass, PClassType);
|
|
||||||
public:
|
|
||||||
PClassClass();
|
|
||||||
};
|
|
||||||
|
|
||||||
inline PClass::MetaClass *PClass::GetClass() const
|
|
||||||
{
|
|
||||||
return static_cast<MetaClass *>(DObject::GetClass());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Type tables --------------------------------------------------------------
|
// Type tables --------------------------------------------------------------
|
||||||
|
|
||||||
struct FTypeTable
|
struct FTypeTable
|
||||||
|
|
Loading…
Reference in a new issue