mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 13:01:47 +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;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// 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
|
||||
|
|
|
@ -585,7 +585,7 @@ public:
|
|||
|
||||
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();
|
||||
protected:
|
||||
|
@ -672,6 +672,7 @@ public:
|
|||
PClass *CreateDerivedClass(FName name, unsigned int size);
|
||||
unsigned int Extend(unsigned int extension, unsigned int alignment);
|
||||
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 BuildFlatPointers();
|
||||
const PClass *NativeClass() const;
|
||||
|
|
Loading…
Reference in a new issue