]> git.localhorst.tv Git - l2e.git/blobdiff - src/loader/Interpreter.cpp
added constructors for described types
[l2e.git] / src / loader / Interpreter.cpp
index 42fb1216d18e207d4e20c843fd2856a0dde15bc4..f9f57bfb55f1fa32a4432b12b5cda29bfc586fe8 100644 (file)
@@ -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<PropertyList *> list(i->second->GetLiteral().GetPropertyLists());
                                for (vector<PropertyList *>::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()) {