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 {
public:
explicit MagnumLogBuffer(EntryType type);
~MagnumLogBuffer();
~MagnumLogBuffer() override;
private:
int sync() override;

View file

@ -23,9 +23,9 @@ using namespace Corrade;
using namespace Containers::Literals;
struct StoryProgressPoint {
std::int32_t id;
Containers::StringView chapter;
Containers::StringView point;
std::int32_t id{};
Containers::StringView chapter = nullptr;
Containers::StringView point = 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);
writeDecals(part.decals, decals_array);
if(part.accessories.size() != 0) {
if(!part.accessories.isEmpty()) {
auto accs_array = part_prop->at<ArrayProperty>(MASS_ARMOUR_ACCESSORIES);
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 res_prop = static_cast<ResourceItemValue*>(prop.get());
auto res_prop = dynamic_cast<ResourceItemValue*>(prop.get());
return res_prop->id == id;
};
@ -286,7 +286,7 @@ Profile::setMaterial(MaterialID id, std::int32_t amount) {
arrayAppend(mats_prop->items, std::move(prop));
}
else {
res_prop = static_cast<ResourceItemValue*>(it->get());
res_prop = dynamic_cast<ResourceItemValue*>(it->get());
}
res_prop->quantity = amount;
@ -308,10 +308,10 @@ Profile::getResource(Containers::StringView container, MaterialID id) {
}
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;
};
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));
int error_code = 0;
zip_t* zip = nullptr;
zip_t* zip;
for(Containers::StringView file : files_view) {
Backup backup;
backup.filename = file;
@ -324,7 +324,7 @@ ProfileManager::restoreBackup(std::size_t index) {
auto error_format = "Extraction of file {} failed: {}"_s;
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);
if(zip == nullptr) {
@ -358,8 +358,8 @@ ProfileManager::restoreBackup(std::size_t index) {
Containers::StaticArray<8192, char> buf{ValueInit};
auto bytes_read = 0l;
while((bytes_read = zip_fread(zf, buf.data(), buf.size())) > 0) {
std::int64_t bytes_read;
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)) {
_lastError = Utility::format(error_format.data(), file, "not enough bytes written.");
LOG_ERROR(_lastError);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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