From: Daniel Karbach Date: Thu, 11 Oct 2012 19:44:42 +0000 (+0200) Subject: don't alloc memory for inline literals X-Git-Url: http://git.localhorst.tv/?a=commitdiff_plain;h=040362d489952ddc935c7130cb54d8b9166b2569;p=l2e.git don't alloc memory for inline literals those are copied into their destination and never ever linked anywhere else anyway --- diff --git a/src/loader/Interpreter.cpp b/src/loader/Interpreter.cpp index 5da1ff3..e8d4ec9 100644 --- a/src/loader/Interpreter.cpp +++ b/src/loader/Interpreter.cpp @@ -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(GetObject(fd.TypeId(), *i->second))); if (fd.TypeId() == TypeDescription::GetTypeId("Image")) {