StructSerialiser: fix serialisation of array'd structs.
Not all of them are generic structs, after all.
This commit is contained in:
parent
b8b156a724
commit
d3d065c945
1 changed files with 12 additions and 4 deletions
|
@ -55,13 +55,19 @@ auto StructSerialiser::deserialise(const std::string& name, const std::string& t
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for(UnsignedInt i = 0; i < count; i++) {
|
for(UnsignedInt i = 0; i < count; i++) {
|
||||||
auto prop = readStructValue(name, item_type, value_length, reader, serialiser);
|
auto prop = Containers::pointer<UnrealPropertyBase>();
|
||||||
|
|
||||||
|
prop = serialiser.readItem(reader, item_type, UnsignedLong(-1), name);
|
||||||
|
|
||||||
|
if(!prop) {
|
||||||
|
prop = readStructValue(name, item_type, value_length, reader, serialiser);
|
||||||
|
}
|
||||||
|
|
||||||
if(!prop) {
|
if(!prop) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
prop->structGuid = guid;
|
static_cast<StructProperty*>(prop.get())->structGuid = guid;
|
||||||
|
|
||||||
arrayAppend(array, std::move(prop));
|
arrayAppend(array, std::move(prop));
|
||||||
}
|
}
|
||||||
|
@ -131,10 +137,12 @@ auto StructSerialiser::serialise(Containers::ArrayView<UnrealPropertyBase::ptr>
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!serialiser.writeItem(prop, struct_prop->structType, bytes_written_here, writer)) {
|
||||||
if(!writeStructValue(struct_prop, bytes_written_here, writer, serialiser)) {
|
if(!writeStructValue(struct_prop, bytes_written_here, writer, serialiser)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UnsignedLong vl_stop = writer.arrayPosition() - vl_start;
|
UnsignedLong vl_stop = writer.arrayPosition() - vl_start;
|
||||||
writer.writeValueToArrayAt(vl_stop, vl_pos);
|
writer.writeValueToArrayAt(vl_stop, vl_pos);
|
||||||
|
|
Loading…
Reference in a new issue