MapPropertySerialiser: add support for demo props.

This commit is contained in:
Guillaume Jacquemin 2021-09-22 19:35:16 +02:00
parent 2e1949ed5d
commit f500e982e6
1 changed files with 17 additions and 8 deletions

View File

@ -58,7 +58,7 @@ auto MapPropertySerialiser::deserialiseProperty(const std::string& name, const s
for(UnsignedInt i = 0; i < count; i++) {
MapProperty::KeyValuePair pair;
if(prop->keyType == "IntProperty") {
if(prop->keyType == "IntProperty" || prop->keyType == "StrProperty") {
pair.key = serialiser.readItem(reader, prop->keyType, -1, name);
if(pair.key == nullptr) {
return nullptr;
@ -69,16 +69,25 @@ auto MapPropertySerialiser::deserialiseProperty(const std::string& name, const s
}
UnrealPropertyBase::ptr value_item;
while((value_item = serialiser.read(reader)) != nullptr) {
arrayAppend(pair.values, std::move(value_item));
if(prop->valueType == "StructProperty") {
while((value_item = serialiser.read(reader)) != nullptr) {
arrayAppend(pair.values, std::move(value_item));
if(pair.values.back()->name == "None" &&
pair.values.back()->propertyType == "NoneProperty" &&
dynamic_cast<NoneProperty*>(pair.values.back().get()) != nullptr)
{
break;
if(pair.values.back()->name == "None" &&
pair.values.back()->propertyType == "NoneProperty" &&
dynamic_cast<NoneProperty*>(pair.values.back().get()) != nullptr)
{
break;
}
}
}
else if(prop->valueType == "ByteProperty") {
if((value_item = serialiser.readItem(reader, prop->valueType, -1, name)) == nullptr) {
return nullptr;
}
arrayAppend(pair.values, std::move(value_item));
}
arrayAppend(prop->map, std::move(pair));
}