Compare commits
No commits in common. "10becfdc318da4ce8e42909fa5a9eb29a63a5c94" and "de07b760d04996384c704cd002eb94901ef810cf" have entirely different histories.
10becfdc31
...
de07b760d0
4 changed files with 20 additions and 21 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, UnsignedLong(-1), "");
|
||||
auto item = readItem(reader, item_type, -1, "");
|
||||
arrayAppend(array, std::move(item));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,8 +26,7 @@ struct GenericStructProperty : public StructProperty {
|
|||
using ptr = Containers::Pointer<GenericStructProperty>;
|
||||
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_base_of<UnrealPropertyBase, T>::value, T*>
|
||||
at(const std::string& name) {
|
||||
auto at(const std::string& name) -> T* {
|
||||
for(auto& item : properties) {
|
||||
if(item->name == name) {
|
||||
return static_cast<T*>(item.get());
|
||||
|
|
|
@ -43,6 +43,15 @@ 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;
|
||||
}
|
||||
|
@ -54,7 +63,7 @@ auto UESaveFile::saveToFile() -> bool {
|
|||
return false;
|
||||
}
|
||||
|
||||
if(!writer.writeArray(arrayView(_magicBytes)) ||
|
||||
if(!writer.writeStaticArray(staticArrayView(_magicBytes)) ||
|
||||
!writer.writeUnsignedInt(_saveVersion) ||
|
||||
!writer.writeUnsignedInt(_packageVersion) ||
|
||||
!writer.writeUnsignedShort(_engineVersion.major) ||
|
||||
|
|
|
@ -40,16 +40,7 @@ class UESaveFile {
|
|||
|
||||
auto reloadData() -> bool;
|
||||
|
||||
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 at(const std::string& name) -> UnrealPropertyBase*;
|
||||
|
||||
auto props() -> Containers::ArrayView<UnrealPropertyBase::ptr>;
|
||||
|
||||
|
@ -63,7 +54,7 @@ class UESaveFile {
|
|||
|
||||
std::string _filepath;
|
||||
|
||||
Containers::StaticArray<4, char> _magicBytes{'G', 'V', 'A', 'S'};
|
||||
const Containers::StaticArray<4, char> _magicBytes{'G', 'V', 'A', 'S'};
|
||||
|
||||
UnsignedInt _saveVersion = 0;
|
||||
UnsignedInt _packageVersion = 0;
|
||||
|
|
Loading…
Reference in a new issue