fix: no blocks data conversion if no data loss detected
This commit is contained in:
parent
bc05716772
commit
024dccb135
@ -3,6 +3,7 @@ menu.missing-content=Missing Content!
|
||||
world.convert-request=Content indices have changed! Convert world files?
|
||||
world.upgrade-request=World format is outdated! Convert world files?
|
||||
world.convert-with-loss=Convert world with data loss?
|
||||
world.convert-block-layouts=Blocks fields have changes! Convert world files?
|
||||
pack.remove-confirm=Do you want to erase all pack(s) content from the world forever?
|
||||
error.pack-not-found=Could not to find pack
|
||||
error.dependency-not-found=Dependency pack is not found
|
||||
|
||||
@ -48,6 +48,7 @@ world.Create World=Создать Мир
|
||||
world.convert-request=Есть изменения в индексах! Конвертировать мир?
|
||||
world.upgrade-request=Формат мира устарел! Конвертировать мир?
|
||||
world.convert-with-loss=Конвертировать мир с потерями?
|
||||
world.convert-block-layouts=Есть изменения в полях блоков! Конвертировать мир?
|
||||
world.delete-confirm=Удалить мир безвозвратно?
|
||||
|
||||
# Настройки
|
||||
|
||||
@ -81,6 +81,9 @@ std::shared_ptr<ContentReport> ContentReport::create(
|
||||
);
|
||||
}
|
||||
}
|
||||
if (layout != *def->dataStruct) {
|
||||
report->dataLayoutsUpdated = true;
|
||||
}
|
||||
report->blocksDataLayouts[name] = std::move(layout);
|
||||
}
|
||||
|
||||
@ -89,7 +92,7 @@ std::shared_ptr<ContentReport> ContentReport::create(
|
||||
if (report->isUpgradeRequired() ||
|
||||
report->hasContentReorder() ||
|
||||
report->hasMissingContent() ||
|
||||
report->hasDataLoss()) {
|
||||
report->hasUpdatedLayouts()) {
|
||||
return report;
|
||||
} else {
|
||||
return nullptr;
|
||||
|
||||
@ -128,6 +128,8 @@ public:
|
||||
std::vector<ContentIssue> issues;
|
||||
std::vector<std::string> dataLoss;
|
||||
|
||||
bool dataLayoutsUpdated = false;
|
||||
|
||||
ContentReport(
|
||||
const ContentIndices* indices,
|
||||
size_t blocks,
|
||||
@ -144,6 +146,9 @@ public:
|
||||
inline const std::vector<std::string>& getDataLoss() const {
|
||||
return dataLoss;
|
||||
}
|
||||
inline bool hasUpdatedLayouts() {
|
||||
return dataLayoutsUpdated;
|
||||
}
|
||||
|
||||
inline bool hasContentReorder() const {
|
||||
return blocks.hasContentReorder() || items.hasContentReorder();
|
||||
|
||||
@ -273,6 +273,9 @@ size_t StructLayout::setUnicode(
|
||||
size_t size = util::crop_utf8(text, field.elements);
|
||||
auto ptr = reinterpret_cast<char*>(dst + field.offset);
|
||||
std::memcpy(ptr, value.data(), size);
|
||||
if (size < field.elements) {
|
||||
ptr[size] = '\0';
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
@ -80,6 +80,9 @@ void show_convert_request(
|
||||
};
|
||||
|
||||
std::wstring message = L"world.convert-request";
|
||||
if (report->hasUpdatedLayouts()) {
|
||||
message = L"world.convert-block-layouts";
|
||||
}
|
||||
if (report->isUpgradeRequired()) {
|
||||
message = L"world.upgrade-request";
|
||||
} else if (report->hasDataLoss()) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user