mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-10 12:54:50 -04:00
Fix default constructor parent zeroing shenanigans in actor creation
This commit is contained in:
@@ -13,9 +13,22 @@
|
||||
#include "m_Do/m_Do_hostIO.h"
|
||||
#include "dusk/endian_ssystem.h"
|
||||
|
||||
#if !__MWERKS__
|
||||
// Modern compilers will zero the parent struct in default constructors.
|
||||
// So instead of adding default constructors to everything,
|
||||
// we'll just save & restore that data.
|
||||
#define fopAcM_ct_placement(ptr, ClassName) \
|
||||
fopAc_ac_c copy; \
|
||||
memcpy(©, ptr, sizeof(fopAc_ac_c)); \
|
||||
new (ptr) ClassName() ; \
|
||||
memcpy(ptr, ©, sizeof(fopAc_ac_c));
|
||||
#else
|
||||
#define fopAcM_ct_placement(ptr, ClassName) new (ptr) ClassName()
|
||||
#endif
|
||||
|
||||
#define fopAcM_ct(ptr, ClassName) \
|
||||
if (!fopAcM_CheckCondition(ptr, fopAcCnd_INIT_e)) { \
|
||||
new (ptr) ClassName(); \
|
||||
fopAcM_ct_placement(ptr, ClassName); \
|
||||
fopAcM_OnCondition(ptr, fopAcCnd_INIT_e); \
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user