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 {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,8 @@ struct GenericStructProperty : public StructProperty {
|
|||
using ptr = Containers::Pointer<GenericStructProperty>;
|
||||
|
||||
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) {
|
||||
if(item->name == name) {
|
||||
return static_cast<T*>(item.get());
|
||||
|
|
|
@ -43,15 +43,6 @@ auto UESaveFile::reloadData() -> bool {
|
|||
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> {
|
||||
return _properties;
|
||||
}
|
||||
|
@ -63,7 +54,7 @@ auto UESaveFile::saveToFile() -> bool {
|
|||
return false;
|
||||
}
|
||||
|
||||
if(!writer.writeStaticArray(staticArrayView(_magicBytes)) ||
|
||||
if(!writer.writeArray(arrayView(_magicBytes)) ||
|
||||
!writer.writeUnsignedInt(_saveVersion) ||
|
||||
!writer.writeUnsignedInt(_packageVersion) ||
|
||||
!writer.writeUnsignedShort(_engineVersion.major) ||
|
||||
|
|
|
@ -40,7 +40,16 @@ class UESaveFile {
|
|||
|
||||
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>;
|
||||
|
||||
|
@ -54,7 +63,7 @@ class UESaveFile {
|
|||
|
||||
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 _packageVersion = 0;
|
||||
|
|
Loading…
Reference in a new issue