mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-13 07:57:58 +00:00
Don't waste time looking for variables to (de)init in native classes
This commit is contained in:
parent
c346ac6143
commit
6f60253590
1 changed files with 17 additions and 5 deletions
|
@ -3396,16 +3396,20 @@ DObject *PClass::CreateNew() const
|
||||||
//
|
//
|
||||||
// PClass :: InitializeSpecials
|
// PClass :: InitializeSpecials
|
||||||
//
|
//
|
||||||
// Initialize special fields of a newly-created instance (e.g. strings).
|
// Initialize special fields (e.g. strings) of a newly-created instance.
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void PClass::InitializeSpecials(void *addr) const
|
void PClass::InitializeSpecials(void *addr) const
|
||||||
{
|
{
|
||||||
if (ParentClass != NULL)
|
// Once we reach a native class, we can stop going up the family tree,
|
||||||
|
// since native classes handle initialization natively.
|
||||||
|
if (!bRuntimeClass)
|
||||||
{
|
{
|
||||||
ParentClass->InitializeSpecials(addr);
|
return;
|
||||||
}
|
}
|
||||||
|
assert(ParentClass != NULL);
|
||||||
|
ParentClass->InitializeSpecials(addr);
|
||||||
for (auto tao : SpecialInits)
|
for (auto tao : SpecialInits)
|
||||||
{
|
{
|
||||||
tao.first->InitializeValue((BYTE*)addr + tao.second, Defaults + tao.second);
|
tao.first->InitializeValue((BYTE*)addr + tao.second, Defaults + tao.second);
|
||||||
|
@ -3416,19 +3420,27 @@ void PClass::InitializeSpecials(void *addr) const
|
||||||
//
|
//
|
||||||
// PClass :: DestroySpecials
|
// PClass :: DestroySpecials
|
||||||
//
|
//
|
||||||
|
// Destroy special fields (e.g. strings) of an instance that is about to be
|
||||||
|
// deleted.
|
||||||
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void PClass::DestroySpecials(void *addr) const
|
void PClass::DestroySpecials(void *addr) const
|
||||||
{
|
{
|
||||||
if (ParentClass != NULL)
|
// Once we reach a native class, we can stop going up the family tree,
|
||||||
|
// since native classes handle deinitialization natively.
|
||||||
|
if (!bRuntimeClass)
|
||||||
{
|
{
|
||||||
ParentClass->DestroySpecials(addr);
|
return;
|
||||||
}
|
}
|
||||||
|
assert(ParentClass != NULL);
|
||||||
|
ParentClass->DestroySpecials(addr);
|
||||||
for (auto tao : SpecialInits)
|
for (auto tao : SpecialInits)
|
||||||
{
|
{
|
||||||
tao.first->DestroyValue((BYTE *)addr + tao.second);
|
tao.first->DestroyValue((BYTE *)addr + tao.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PClass :: Derive
|
// PClass :: Derive
|
||||||
|
|
Loading…
Reference in a new issue