X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Floader%2FInterpreter.cpp;h=f9f57bfb55f1fa32a4432b12b5cda29bfc586fe8;hb=40233fc8eea1c80e6c57a004dfe7e55dabf06edb;hp=ddcc8528b95183e33bc25c8ca4e822cc9316ca19;hpb=ac3755adc509404528ef7de58695bf8e3bfb7dcd;p=l2e.git diff --git a/src/loader/Interpreter.cpp b/src/loader/Interpreter.cpp index ddcc852..f9f57bf 100644 --- a/src/loader/Interpreter.cpp +++ b/src/loader/Interpreter.cpp @@ -175,6 +175,7 @@ void *Interpreter::GetObject(int typeId, const Value &v) { int typeId(TypeDescription::GetTypeId(v.GetLiteral().GetTypeName())); const TypeDescription &td(TypeDescription::Get(typeId)); char *object(new char[td.Size()]); + td.Construct(object); int id(values[typeId].size()); values[typeId].push_back(object); ReadObject(typeId, id, object, *v.GetLiteral().GetProperties()); @@ -250,6 +251,7 @@ void *Interpreter::GetObject(int typeId, const Value &v) { const TypeDescription &td(TypeDescription::Get(typeId)); id = values[typeId].size(); char *object(new char[td.Size()]); + td.Construct(object); ReadObject(typeId, id, object, *v.GetLiteral().GetProperties()); } break; @@ -268,6 +270,7 @@ void Interpreter::ReadObject(const Definition &dfn) { const TypeDescription &td(TypeDescription::Get(typeId)); int id(values[typeId].size()); char *object(new char[td.Size()]); + td.Construct(object); values[typeId].push_back(object); ReadObject(typeId, id, object, *dfn.GetProperties()); parsedDefinitions.insert(make_pair(dfn.Identifier(), ParsedDefinition(&dfn, typeId, id))); @@ -290,6 +293,7 @@ void Interpreter::ReadObject(int typeId, int id, char *object, const PropertyLis char *iter(aggregate); vector list(i->second->GetLiteral().GetPropertyLists()); for (vector::const_iterator j(list.begin()), end(list.end()); j != end; ++j, iter += fieldType.Size()) { + fieldType.Construct(iter); ReadObject(fieldType.TypeId(), -1, iter, **j); } if (fd.IsReferenced()) { @@ -344,9 +348,10 @@ void Interpreter::CreateTypeDescriptions() { td.SetSize(sizeof(int)); } { + int stringId(TypeDescription::GetTypeId("String")); TypeDescription &td(TypeDescription::CreateOrGet("Path")); td.SetSize(1); - td.AddSupertype(TypeDescription::GetTypeId("String"), 0); + td.AddSupertype(stringId, 0); } { TypeDescription &td(TypeDescription::CreateOrGet("String"));