fix compiler warnings (GCC + Clang)

This commit is contained in:
MihailRis
2025-03-20 22:04:29 +03:00
parent 6c3d2d0907
commit 3d22de761f
50 changed files with 80 additions and 103 deletions
+1 -2
View File
@@ -21,8 +21,7 @@ Level::Level(
const Content& content,
EngineSettings& settings
)
: settings(settings),
world(std::move(worldPtr)),
: world(std::move(worldPtr)),
content(content),
chunks(std::make_unique<GlobalChunks>(*this)),
physics(std::make_unique<PhysicsSolver>(glm::vec3(0, -22.6f, 0))),
-1
View File
@@ -20,7 +20,6 @@ struct EngineSettings;
/// @brief A level, contains chunks and objects
class Level {
const EngineSettings& settings;
std::unique_ptr<World> world;
public:
const Content& content;
+2 -4
View File
@@ -54,7 +54,6 @@ void WorldConverter::addRegionsTasks(
}
void WorldConverter::createUpgradeTasks() {
const auto& regions = wfile->getRegions();
for (auto& issue : report->getIssues()) {
if (issue.issueType != ContentIssueType::REGION_FORMAT_UPDATE) {
continue;
@@ -83,7 +82,6 @@ void WorldConverter::createConvertTasks() {
}
};
const auto& regions = wfile->getRegions();
for (auto& issue : report->getIssues()) {
switch (issue.issueType) {
case ContentIssueType::BLOCK_DATA_LAYOUTS_UPDATE:
@@ -97,13 +95,13 @@ void WorldConverter::createConvertTasks() {
}
}
tasks.push(ConvertTask {ConvertTaskType::PLAYER, wfile->getPlayerFile()});
tasks.push(ConvertTask {
ConvertTaskType::PLAYER, wfile->getPlayerFile(), 0, 0, {}});
}
void WorldConverter::createBlockFieldsConvertTasks() {
// blocks data conversion requires correct block indices
// so it must be done AFTER voxels conversion
const auto& regions = wfile->getRegions();
for (auto& issue : report->getIssues()) {
switch (issue.issueType) {
case ContentIssueType::BLOCK_DATA_LAYOUTS_UPDATE:
+1 -2
View File
@@ -43,7 +43,7 @@ util::Buffer<ubyte> compatibility::convert_region_2to3(
const util::Buffer<ubyte>& src, RegionLayerIndex layer
) {
const size_t REGION_CHUNKS = 1024;
const size_t HEADER_SIZE = 10;
// const size_t HEADER_SIZE = 10;
const size_t OFFSET_TABLE_SIZE = REGION_CHUNKS * sizeof(uint32_t);
const ubyte COMPRESS_NONE = 0;
const ubyte COMPRESS_EXTRLE8 = 1;
@@ -61,7 +61,6 @@ util::Buffer<ubyte> compatibility::convert_region_2to3(
}
uint32_t offsets[REGION_CHUNKS] {};
size_t chunkIndex = 0;
auto tablePtr = reinterpret_cast<const uint32_t*>(
ptr + src.size() - OFFSET_TABLE_SIZE
+1 -1
View File
@@ -8,7 +8,7 @@
VoxelStructure::VoxelStructure(
VoxelStructureMeta meta,
std::unique_ptr<VoxelFragment> structure
) : fragments({std::move(structure)}), meta(std::move(meta)) {}
) : meta(std::move(meta)), fragments({std::move(structure)}) {}
GeneratorDef::GeneratorDef(std::string name)
: name(std::move(name)), caption(util::id_to_caption(name)) {
+5 -1
View File
@@ -437,7 +437,6 @@ void WorldGenerator::generate(voxel* voxels, int chunkX, int chunkZ) {
std::memset(voxels, 0, sizeof(voxel) * CHUNK_VOL);
const auto& indices = content.getIndices()->blocks;
const auto& biomes = prototype.biomes.get();
for (uint z = 0; z < CHUNK_D; z++) {
for (uint x = 0; x < CHUNK_W; x++) {
@@ -456,6 +455,7 @@ void WorldGenerator::generate(voxel* voxels, int chunkX, int chunkZ) {
generatePlacements(prototype, voxels, chunkX, chunkZ);
generatePlants(prototype, values, voxels, chunkX, chunkZ, biomes);
[[maybe_unused]] const auto& indices = content.getIndices()->blocks;
for (uint i = 0; i < CHUNK_VOL; i++) {
blockid_t& id = voxels[i].id;
if (id == BLOCK_STRUCT_AIR) {
@@ -609,3 +609,7 @@ WorldGenDebugInfo WorldGenerator::createDebugInfo() const {
std::move(values)
};
}
uint64_t WorldGenerator::getSeed() const {
return seed;
}
+2
View File
@@ -134,4 +134,6 @@ public:
void generate(voxel* voxels, int x, int z);
WorldGenDebugInfo createDebugInfo() const;
uint64_t getSeed() const;
};