1.5: Fuckin' UE5... #38

Manually merged
williamjcm merged 126 commits from one-point-five into master 2024-07-22 11:06:13 +02:00
12 changed files with 22 additions and 22 deletions
Showing only changes of commit 07cbaefeac - Show all commits

View file

@ -25,7 +25,7 @@
class MagnumLogBuffer : public std::stringbuf { class MagnumLogBuffer : public std::stringbuf {
public: public:
explicit MagnumLogBuffer(EntryType type); explicit MagnumLogBuffer(EntryType type);
~MagnumLogBuffer(); ~MagnumLogBuffer() override;
private: private:
int sync() override; int sync() override;

View file

@ -23,9 +23,9 @@ using namespace Corrade;
using namespace Containers::Literals; using namespace Containers::Literals;
struct StoryProgressPoint { struct StoryProgressPoint {
std::int32_t id; std::int32_t id{};
Containers::StringView chapter; Containers::StringView chapter = nullptr;
Containers::StringView point; Containers::StringView point = nullptr;
Containers::StringView after = nullptr; Containers::StringView after = nullptr;
}; };

View file

@ -185,7 +185,7 @@ Mass::writeArmourPart(ArmourSlot slot) {
auto decals_array = part_prop->at<ArrayProperty>(MASS_ARMOUR_DECALS); auto decals_array = part_prop->at<ArrayProperty>(MASS_ARMOUR_DECALS);
writeDecals(part.decals, decals_array); writeDecals(part.decals, decals_array);
if(part.accessories.size() != 0) { if(!part.accessories.isEmpty()) {
auto accs_array = part_prop->at<ArrayProperty>(MASS_ARMOUR_ACCESSORIES); auto accs_array = part_prop->at<ArrayProperty>(MASS_ARMOUR_ACCESSORIES);
writeAccessories(part.accessories, accs_array); writeAccessories(part.accessories, accs_array);
} }

View file

@ -269,7 +269,7 @@ Profile::setMaterial(MaterialID id, std::int32_t amount) {
} }
auto predicate = [&id](UnrealPropertyBase::ptr& prop){ auto predicate = [&id](UnrealPropertyBase::ptr& prop){
auto res_prop = static_cast<ResourceItemValue*>(prop.get()); auto res_prop = dynamic_cast<ResourceItemValue*>(prop.get());
return res_prop->id == id; return res_prop->id == id;
}; };
@ -286,7 +286,7 @@ Profile::setMaterial(MaterialID id, std::int32_t amount) {
arrayAppend(mats_prop->items, std::move(prop)); arrayAppend(mats_prop->items, std::move(prop));
} }
else { else {
res_prop = static_cast<ResourceItemValue*>(it->get()); res_prop = dynamic_cast<ResourceItemValue*>(it->get());
} }
res_prop->quantity = amount; res_prop->quantity = amount;
@ -308,10 +308,10 @@ Profile::getResource(Containers::StringView container, MaterialID id) {
} }
auto predicate = [&id](UnrealPropertyBase::ptr& prop){ auto predicate = [&id](UnrealPropertyBase::ptr& prop){
auto res_prop = static_cast<ResourceItemValue*>(prop.get()); auto res_prop = dynamic_cast<ResourceItemValue*>(prop.get());
return res_prop->id == id; return res_prop->id == id;
}; };
auto it = std::find_if(mats_prop->items.begin(), mats_prop->items.end(), predicate); auto it = std::find_if(mats_prop->items.begin(), mats_prop->items.end(), predicate);
return it != mats_prop->items.end() ? static_cast<ResourceItemValue*>(it->get())->quantity : 0; return it != mats_prop->items.end() ? dynamic_cast<ResourceItemValue*>(it->get())->quantity : 0;
} }

View file

@ -235,7 +235,7 @@ ProfileManager::refreshBackups() {
auto files_view = files->exceptSuffix(files->end() - std::remove_if(files->begin(), files->end(), predicate)); auto files_view = files->exceptSuffix(files->end() - std::remove_if(files->begin(), files->end(), predicate));
int error_code = 0; int error_code = 0;
zip_t* zip = nullptr; zip_t* zip;
for(Containers::StringView file : files_view) { for(Containers::StringView file : files_view) {
Backup backup; Backup backup;
backup.filename = file; backup.filename = file;
@ -324,7 +324,7 @@ ProfileManager::restoreBackup(std::size_t index) {
auto error_format = "Extraction of file {} failed: {}"_s; auto error_format = "Extraction of file {} failed: {}"_s;
int error_code = 0; int error_code = 0;
zip_t* zip = nullptr; zip_t* zip;
zip = zip_open(Utility::Path::join(_backupsDirectory, backup.filename).data(), ZIP_RDONLY, &error_code); zip = zip_open(Utility::Path::join(_backupsDirectory, backup.filename).data(), ZIP_RDONLY, &error_code);
if(zip == nullptr) { if(zip == nullptr) {
@ -358,8 +358,8 @@ ProfileManager::restoreBackup(std::size_t index) {
Containers::StaticArray<8192, char> buf{ValueInit}; Containers::StaticArray<8192, char> buf{ValueInit};
auto bytes_read = 0l; std::int64_t bytes_read;
while((bytes_read = zip_fread(zf, buf.data(), buf.size())) > 0) { while((bytes_read = zip_fread(zf, buf.data(), buf.size())) > 0ll) {
if(std::fwrite(buf.data(), sizeof(char), bytes_read, out) < static_cast<std::size_t>(bytes_read)) { if(std::fwrite(buf.data(), sizeof(char), bytes_read, out) < static_cast<std::size_t>(bytes_read)) {
_lastError = Utility::format(error_format.data(), file, "not enough bytes written."); _lastError = Utility::format(error_format.data(), file, "not enough bytes written.");
LOG_ERROR(_lastError); LOG_ERROR(_lastError);

View file

@ -134,7 +134,7 @@ SaveTool::drawMassViewer() {
ImGui::EndTabItem(); ImGui::EndTabItem();
} }
if(_currentMass->globalStyles().size() != 0 && ImGui::BeginTabItem("Global styles")) { if(!_currentMass->globalStyles().isEmpty() && ImGui::BeginTabItem("Global styles")) {
drawGlobalStyles(); drawGlobalStyles();
ImGui::EndTabItem(); ImGui::EndTabItem();
} }

View file

@ -134,7 +134,7 @@ SaveTool::drawArmour() {
ImGui::PopID(); ImGui::PopID();
if(part.accessories.size() != 0) { if(!part.accessories.isEmpty()) {
ImGui::Separator(); ImGui::Separator();
ImGui::PushID("Accessory"); ImGui::PushID("Accessory");

View file

@ -542,7 +542,7 @@ SaveTool::drawWeaponEditor(Weapon& weapon) {
ImGui::PopID(); ImGui::PopID();
if(part.accessories.size() != 0) { if(!part.accessories.isEmpty()) {
ImGui::Separator(); ImGui::Separator();
ImGui::PushID("Accessory"); ImGui::PushID("Accessory");

View file

@ -126,7 +126,7 @@ BinaryWriter::writeDouble(double value) {
bool bool
BinaryWriter::writeArray(Containers::ArrayView<const char> array) { BinaryWriter::writeArray(Containers::ArrayView<const char> array) {
if(array.size() == 0) { if(array.isEmpty()) {
return false; return false;
} }

View file

@ -198,6 +198,8 @@ StructProperty::ptr
StructSerialiser::readStructValue(Containers::StringView name, Containers::StringView type, std::size_t value_length, StructSerialiser::readStructValue(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryReader& reader, PropertySerialiser& serialiser)
{ {
static_cast<void>(value_length);
auto st_prop = Containers::pointer<GenericStructProperty>(); auto st_prop = Containers::pointer<GenericStructProperty>();
st_prop->structType = type; st_prop->structType = type;

View file

@ -50,7 +50,7 @@ TextPropertySerialiser::deserialiseProperty(Containers::StringView name, Contain
return nullptr; return nullptr;
} }
auto interval = reader.position() - start_position; std::int64_t interval;
do { do {
Containers::String str; Containers::String str;

View file

@ -114,10 +114,8 @@ UESaveFile::saveToFile() {
return false; return false;
} }
for(std::size_t i = 0; i < _customFormatData.size(); i++) { for(auto& i : _customFormatData) {
if(!writer.writeStaticArray(Containers::StaticArrayView<16, const char>{_customFormatData[i].id}) || if(!writer.writeStaticArray<16>(staticArrayView(i.id)) || !writer.writeUint32(i.value)) {
!writer.writeUint32(_customFormatData[i].value))
{
_lastError = "Couldn't write the custom format data."_s; _lastError = "Couldn't write the custom format data."_s;
LOG_ERROR(_lastError); LOG_ERROR(_lastError);
return false; return false;