Compare commits
3 commits
de07b760d0
...
10becfdc31
Author | SHA1 | Date | |
---|---|---|---|
10becfdc31 | |||
f286ec0633 | |||
ce29d6174c |
4 changed files with 21 additions and 20 deletions
|
@ -134,7 +134,7 @@ auto PropertySerialiser::readSet(BinaryReader& reader, const std::string& item_t
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for(UnsignedInt i = 0; i < count; i++) {
|
for(UnsignedInt i = 0; i < count; i++) {
|
||||||
auto item = readItem(reader, item_type, -1, "");
|
auto item = readItem(reader, item_type, UnsignedLong(-1), "");
|
||||||
arrayAppend(array, std::move(item));
|
arrayAppend(array, std::move(item));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,8 @@ struct GenericStructProperty : public StructProperty {
|
||||||
using ptr = Containers::Pointer<GenericStructProperty>;
|
using ptr = Containers::Pointer<GenericStructProperty>;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
auto at(const std::string& name) -> T* {
|
std::enable_if_t<std::is_base_of<UnrealPropertyBase, T>::value, T*>
|
||||||
|
at(const std::string& name) {
|
||||||
for(auto& item : properties) {
|
for(auto& item : properties) {
|
||||||
if(item->name == name) {
|
if(item->name == name) {
|
||||||
return static_cast<T*>(item.get());
|
return static_cast<T*>(item.get());
|
||||||
|
|
|
@ -43,15 +43,6 @@ auto UESaveFile::reloadData() -> bool {
|
||||||
return valid();
|
return valid();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto UESaveFile::at(const std::string& name) -> UnrealPropertyBase* {
|
|
||||||
for(auto& prop : _properties) {
|
|
||||||
if(*(prop->name) == name) {
|
|
||||||
return prop.get();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto UESaveFile::props() -> Containers::ArrayView<UnrealPropertyBase::ptr> {
|
auto UESaveFile::props() -> Containers::ArrayView<UnrealPropertyBase::ptr> {
|
||||||
return _properties;
|
return _properties;
|
||||||
}
|
}
|
||||||
|
@ -63,13 +54,13 @@ auto UESaveFile::saveToFile() -> bool {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!writer.writeStaticArray(staticArrayView(_magicBytes)) ||
|
if(!writer.writeArray(arrayView(_magicBytes)) ||
|
||||||
!writer.writeUnsignedInt(_saveVersion) ||
|
!writer.writeUnsignedInt(_saveVersion) ||
|
||||||
!writer.writeUnsignedInt(_packageVersion) ||
|
!writer.writeUnsignedInt(_packageVersion) ||
|
||||||
!writer.writeUnsignedShort(_engineVersion.major) ||
|
!writer.writeUnsignedShort(_engineVersion.major) ||
|
||||||
!writer.writeUnsignedShort(_engineVersion.minor) ||
|
!writer.writeUnsignedShort(_engineVersion.minor) ||
|
||||||
!writer.writeUnsignedShort(_engineVersion.patch) ||
|
!writer.writeUnsignedShort(_engineVersion.patch) ||
|
||||||
!writer.writeUnsignedInt(_engineVersion.build) ||
|
!writer.writeUnsignedInt(_engineVersion.build) ||
|
||||||
!writer.writeUEString(_engineVersion.buildId))
|
!writer.writeUEString(_engineVersion.buildId))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -40,7 +40,16 @@ class UESaveFile {
|
||||||
|
|
||||||
auto reloadData() -> bool;
|
auto reloadData() -> bool;
|
||||||
|
|
||||||
auto at(const std::string& name) -> UnrealPropertyBase*;
|
template<typename T>
|
||||||
|
std::enable_if_t<std::is_base_of<UnrealPropertyBase, T>::value, T*>
|
||||||
|
at(const std::string& name) {
|
||||||
|
for(auto& prop : _properties) {
|
||||||
|
if(prop->name == name) {
|
||||||
|
return static_cast<T*>(prop.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
auto props() -> Containers::ArrayView<UnrealPropertyBase::ptr>;
|
auto props() -> Containers::ArrayView<UnrealPropertyBase::ptr>;
|
||||||
|
|
||||||
|
@ -54,7 +63,7 @@ class UESaveFile {
|
||||||
|
|
||||||
std::string _filepath;
|
std::string _filepath;
|
||||||
|
|
||||||
const Containers::StaticArray<4, char> _magicBytes{'G', 'V', 'A', 'S'};
|
Containers::StaticArray<4, char> _magicBytes{'G', 'V', 'A', 'S'};
|
||||||
|
|
||||||
UnsignedInt _saveVersion = 0;
|
UnsignedInt _saveVersion = 0;
|
||||||
UnsignedInt _packageVersion = 0;
|
UnsignedInt _packageVersion = 0;
|
||||||
|
|
Loading…
Reference in a new issue