From a7936c9eaa44c2472a6c87782f6986558f4de573 Mon Sep 17 00:00:00 2001 From: Jan Date: Wed, 18 Dec 2019 15:26:12 +0100 Subject: [PATCH] ZoneCodeGenerator: Fix LoadTempPtr method doing insertpointer and allocating in the wrong order --- .../Generating/Templates/ZoneLoad.stg | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/ZoneCodeGenerator/Generating/Templates/ZoneLoad.stg b/src/ZoneCodeGenerator/Generating/Templates/ZoneLoad.stg index d71c9d47..f43ea7fa 100644 --- a/src/ZoneCodeGenerator/Generating/Templates/ZoneLoad.stg +++ b/src/ZoneCodeGenerator/Generating/Templates/ZoneLoad.stg @@ -176,17 +176,14 @@ void $LoaderClassName(context.Asset)$::LoadPtr_$structure.Type.Name$(const bool if(*$TypePtrVarName(structure.Type)$ != nullptr) { - $if(structure.Block.IsTemp)$ if(*$TypePtrVarName(structure.Type)$ == PTR_FOLLOWING || *$TypePtrVarName(structure.Type)$ == PTR_INSERT) - $else$ - if(*$TypePtrVarName(structure.Type)$ == PTR_FOLLOWING) - $endif$ { - $structure.Type.FullName$** toInsert = nullptr; - if(*$TypePtrVarName(structure.Type)$ == PTR_INSERT) - toInsert = m_stream->InsertPointer<$structure.Type.FullName$>(); - + $structure.Type.FullName$* ptr = *$TypePtrVarName(structure.Type)$; *$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)$ $TypeVarName(structure.Type)$ = *$TypePtrVarName(structure.Type)$;