ZoneCodeGenerator: Fix LoadTempPtr method doing insertpointer and allocating in the wrong order

This commit is contained in:
Jan 2019-12-18 15:26:12 +01:00
parent 92e84e69f9
commit a7936c9eaa

View File

@ -176,18 +176,15 @@ void $LoaderClassName(context.Asset)$::LoadPtr_$structure.Type.Name$(const bool
if(*$TypePtrVarName(structure.Type)$ != nullptr) if(*$TypePtrVarName(structure.Type)$ != nullptr)
{ {
$if(structure.Block.IsTemp)$
if(*$TypePtrVarName(structure.Type)$ == PTR_FOLLOWING || *$TypePtrVarName(structure.Type)$ == PTR_INSERT) if(*$TypePtrVarName(structure.Type)$ == PTR_FOLLOWING || *$TypePtrVarName(structure.Type)$ == PTR_INSERT)
$else$
if(*$TypePtrVarName(structure.Type)$ == PTR_FOLLOWING)
$endif$
{ {
$structure.Type.FullName$** toInsert = nullptr; $structure.Type.FullName$* ptr = *$TypePtrVarName(structure.Type)$;
if(*$TypePtrVarName(structure.Type)$ == PTR_INSERT)
toInsert = m_stream->InsertPointer<$structure.Type.FullName$>();
*$TypePtrVarName(structure.Type)$ = m_stream->Alloc<$structure.Type.FullName$>(alignof($structure.Type.FullName$)); *$TypePtrVarName(structure.Type)$ = m_stream->Alloc<$structure.Type.FullName$>(alignof($structure.Type.FullName$));
$structure.Type.FullName$** toInsert = nullptr;
if(ptr == PTR_INSERT)
toInsert = m_stream->InsertPointer<$structure.Type.FullName$>();
$if(!structure.IsLeaf)$ $if(!structure.IsLeaf)$
$TypeVarName(structure.Type)$ = *$TypePtrVarName(structure.Type)$; $TypeVarName(structure.Type)$ = *$TypePtrVarName(structure.Type)$;
Load_$structure.Type.Name$(true); Load_$structure.Type.Name$(true);