mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- better USER clearing.
This commit is contained in:
parent
8fee2b3ed7
commit
9bae2295cc
2 changed files with 9 additions and 6 deletions
|
@ -1134,14 +1134,17 @@ using ROTATORp = ROTATOR*;
|
|||
|
||||
struct USER
|
||||
{
|
||||
// These are for easy zero-init of USERs without having to be on the lookout for non-trivial members.
|
||||
void* operator new(size_t alloc)
|
||||
// C++'s default init rules suck, so we have to help it out a bit to do what we need (i.e. setting all POD members to 0.
|
||||
USER()
|
||||
{
|
||||
return M_Calloc(alloc, 1);
|
||||
memset(&WallP, 0, sizeof(USER) - myoffsetof(USER, WallP));
|
||||
}
|
||||
void operator delete (void* mem)
|
||||
|
||||
void Clear()
|
||||
{
|
||||
M_Free(mem);
|
||||
rotator.Clear();
|
||||
WallShade.Clear();
|
||||
memset(&WallP, 0, sizeof(USER) - myoffsetof(USER, WallP));
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -284,7 +284,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, USER& w, USER* def
|
|||
if (!def)
|
||||
{
|
||||
def = &nuluser;
|
||||
if (arc.isReading()) w = {};
|
||||
if (arc.isReading()) w.Clear();
|
||||
}
|
||||
if (arc.BeginObject(keyname))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue