X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Floader%2FInterpreter.cpp;h=8b9b56a2098eb9ae9a6a4002020f4973fdfa6675;hb=3a30342daecdb9ee050ab20fcb50819a599d6343;hp=5da1ff35a194f194606c573be575d797643e5486;hpb=754442d4502b743a46831055484c3fa9fa621ec2;p=l2e.git diff --git a/src/loader/Interpreter.cpp b/src/loader/Interpreter.cpp index 5da1ff3..8b9b56a 100644 --- a/src/loader/Interpreter.cpp +++ b/src/loader/Interpreter.cpp @@ -142,6 +142,8 @@ void Interpreter::ReadLiteral(int typeId, int id, char *object, const Literal &l std::memcpy(object, literal.GetString().c_str(), literal.GetString().size()); object[literal.GetString().size()] = '\0'; break; + case Literal::SCRIPT: + throw Error("script compiler not implemented"); case Literal::STRING: std::memcpy(object, literal.GetString().c_str(), literal.GetString().size()); object[literal.GetString().size()] = '\0'; @@ -151,7 +153,6 @@ void Interpreter::ReadLiteral(int typeId, int id, char *object, const Literal &l break; case Literal::OBJECT: throw Error("illogical branch: read literal object as non-object literal"); - break; } } @@ -213,6 +214,8 @@ void *Interpreter::GetObject(int typeId, const Value &v) { values[typeId].push_back(str); } break; + case Literal::SCRIPT: + throw Error("script compiler not implemented"); case Literal::STRING: { typeId = TypeDescription::GetTypeId("String"); @@ -295,6 +298,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")) {