add util::Buffer, rle::encode16, rle::decode16

This commit is contained in:
MihailRis
2024-09-03 23:33:29 +03:00
parent 728795f0f3
commit c15abfa715
7 changed files with 144 additions and 31 deletions
+5 -4
View File
@@ -61,7 +61,7 @@ void WorldConverter::createUpgradeTasks() {
if (issue.regionLayer == REGION_LAYER_VOXELS) {
addRegionsTasks(issue.regionLayer, ConvertTaskType::UPGRADE_VOXELS);
} else {
addRegionsTasks(issue.regionLayer, ConvertTaskType::UPGRADE_SIMPLE);
addRegionsTasks(issue.regionLayer, ConvertTaskType::UPGRADE_REGION);
}
}
}
@@ -159,7 +159,7 @@ std::shared_ptr<Task> WorldConverter::startTask(
return pool;
}
void WorldConverter::upgradeSimple(const fs::path& file, int x, int z) const {
void WorldConverter::upgradeRegion(const fs::path& file, int x, int z) const {
throw std::runtime_error("unsupported region format");
}
@@ -194,10 +194,11 @@ void WorldConverter::convert(const ConvertTask& task) const {
if (!fs::is_regular_file(task.file)) return;
switch (task.type) {
case ConvertTaskType::UPGRADE_SIMPLE:
upgradeSimple(task.file, task.x, task.z);
case ConvertTaskType::UPGRADE_REGION:
upgradeRegion(task.file, task.x, task.z);
break;
case ConvertTaskType::UPGRADE_VOXELS:
upgradeRegion(task.file, task.x, task.z);
upgradeVoxels(task.file, task.x, task.z);
break;
case ConvertTaskType::VOXELS:
+2 -2
View File
@@ -23,7 +23,7 @@ enum class ConvertTaskType {
/// @brief rewrite player
PLAYER,
/// @brief refresh region file version
UPGRADE_SIMPLE,
UPGRADE_REGION,
/// @brief rewrite voxels region file to new format
UPGRADE_VOXELS,
};
@@ -45,7 +45,7 @@ class WorldConverter : public Task {
uint tasksDone = 0;
bool upgradeMode;
void upgradeSimple(const fs::path& file, int x, int z) const;
void upgradeRegion(const fs::path& file, int x, int z) const;
void upgradeVoxels(const fs::path& file, int x, int z) const;
void convertPlayer(const fs::path& file) const;
void convertVoxels(const fs::path& file, int x, int z) const;