]> git.localhorst.tv Git - l2e.git/commitdiff
don't alloc memory for inline literals
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 11 Oct 2012 19:44:42 +0000 (21:44 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 11 Oct 2012 19:44:42 +0000 (21:44 +0200)
those are copied into their destination and never ever linked anywhere else anyway

src/loader/Interpreter.cpp

index 5da1ff35a194f194606c573be575d797643e5486..e8d4ec9ff5be63fae56efcde0e3eef8ead5c8867 100644 (file)
@@ -295,6 +295,13 @@ void Interpreter::ReadObject(int typeId, int id, char *object, const PropertyLis
                                } else {
                                        throw Error("aggregate type fields must be referenced");
                                }
+                       } else if (i->second->IsLiteral() && !fd.IsReferenced()) {
+                               // inline literals
+                               if (i->second->GetLiteral().IsObject()) {
+                                       ReadObject(fd.TypeId(), -1, dest, *i->second->GetLiteral().GetProperties());
+                               } else {
+                                       ReadLiteral(fd.TypeId(), -1, dest, i->second->GetLiteral());
+                               }
                        } else {
                                char *src(reinterpret_cast<char *>(GetObject(fd.TypeId(), *i->second)));
                                if (fd.TypeId() == TypeDescription::GetTypeId("Image")) {