mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
Add an AddField() override to PClass that extends the default instance
This commit is contained in:
parent
3357af32e5
commit
806d9d7a95
2 changed files with 20 additions and 1 deletions
|
@ -2501,6 +2501,24 @@ unsigned int PClass::Extend(unsigned int extension, unsigned int alignment)
|
||||||
return padto;
|
return padto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// PClass :: AddField
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
PField *PClass::AddField(FName name, PType *type, DWORD flags)
|
||||||
|
{
|
||||||
|
unsigned oldsize = Size;
|
||||||
|
PField *field = Super::AddField(name, type, flags);
|
||||||
|
if (field != NULL)
|
||||||
|
{
|
||||||
|
Defaults = (BYTE *)M_Realloc(Defaults, Size);
|
||||||
|
memset(Defaults + oldsize, 0, Size - oldsize);
|
||||||
|
}
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PClass :: FindClassTentative
|
// PClass :: FindClassTentative
|
||||||
|
|
|
@ -585,7 +585,7 @@ public:
|
||||||
|
|
||||||
TArray<PField *> Fields;
|
TArray<PField *> Fields;
|
||||||
|
|
||||||
PField *AddField(FName name, PType *type, DWORD flags=0);
|
virtual PField *AddField(FName name, PType *type, DWORD flags=0);
|
||||||
|
|
||||||
size_t PropagateMark();
|
size_t PropagateMark();
|
||||||
protected:
|
protected:
|
||||||
|
@ -672,6 +672,7 @@ public:
|
||||||
PClass *CreateDerivedClass(FName name, unsigned int size);
|
PClass *CreateDerivedClass(FName name, unsigned int size);
|
||||||
unsigned int Extend(unsigned int extension, unsigned int alignment);
|
unsigned int Extend(unsigned int extension, unsigned int alignment);
|
||||||
unsigned int Extend(const PType *type) { return Extend(type->Size, type->Align); }
|
unsigned int Extend(const PType *type) { return Extend(type->Size, type->Align); }
|
||||||
|
PField *AddField(FName name, PType *type, DWORD flags=0) override;
|
||||||
void InitializeActorInfo();
|
void InitializeActorInfo();
|
||||||
void BuildFlatPointers();
|
void BuildFlatPointers();
|
||||||
const PClass *NativeClass() const;
|
const PClass *NativeClass() const;
|
||||||
|
|
Loading…
Reference in a new issue