From 6dc5194895b6bd61d19bf5c95021471784084325 Mon Sep 17 00:00:00 2001 From: untodesu Date: Tue, 1 Jul 2025 03:23:05 +0500 Subject: I forgot to set these to true in .clang-format https://files.catbox.moe/909rig.gif --- game/shared/world/chunk.cc | 3 ++- game/shared/world/dimension.cc | 9 ++++++--- game/shared/world/item_registry.cc | 9 ++++++--- game/shared/world/ray_dda.cc | 18 ++++++++++++------ game/shared/world/voxel_registry.cc | 12 ++++++++---- 5 files changed, 34 insertions(+), 17 deletions(-) (limited to 'game/shared/world') diff --git a/game/shared/world/chunk.cc b/game/shared/world/chunk.cc index 24a8d06..f689fc1 100644 --- a/game/shared/world/chunk.cc +++ b/game/shared/world/chunk.cc @@ -21,7 +21,8 @@ voxel_id world::Chunk::get_voxel(const std::size_t index) const { if(index >= CHUNK_VOLUME) { return NULL_VOXEL_ID; - } else { + } + else { return m_voxels[index]; } } diff --git a/game/shared/world/dimension.cc b/game/shared/world/dimension.cc index b5cedad..3389917 100644 --- a/game/shared/world/dimension.cc +++ b/game/shared/world/dimension.cc @@ -61,7 +61,8 @@ world::Chunk* world::Dimension::find_chunk(entt::entity entity) const { if(chunks.valid(entity)) { return chunks.get(entity).chunk; - } else { + } + else { return nullptr; } } @@ -72,7 +73,8 @@ world::Chunk* world::Dimension::find_chunk(const chunk_pos& cpos) const if(it != m_chunkmap.cend()) { return it->second; - } else { + } + else { return nullptr; } } @@ -112,7 +114,8 @@ voxel_id world::Dimension::get_voxel(const voxel_pos& vpos) const if(auto chunk = find_chunk(cpos)) { return chunk->get_voxel(lpos); - } else { + } + else { return NULL_VOXEL_ID; } } diff --git a/game/shared/world/item_registry.cc b/game/shared/world/item_registry.cc index 3ec3b88..378f0f1 100644 --- a/game/shared/world/item_registry.cc +++ b/game/shared/world/item_registry.cc @@ -58,7 +58,8 @@ world::ItemInfoBuilder& world::item_registry::construct(const char* name) if(it != world::item_registry::builders.cend()) { return it->second; - } else { + } + else { return world::item_registry::builders.emplace(name, ItemInfoBuilder(name)).first->second; } } @@ -69,7 +70,8 @@ world::ItemInfo* world::item_registry::find(const char* name) if(it != world::item_registry::names.cend()) { return world::item_registry::find(it->second); - } else { + } + else { return nullptr; } } @@ -78,7 +80,8 @@ world::ItemInfo* world::item_registry::find(const item_id item) { if((item != NULL_ITEM_ID) && (item <= world::item_registry::items.size())) { return world::item_registry::items[item - 1].get(); - } else { + } + else { return nullptr; } } diff --git a/game/shared/world/ray_dda.cc b/game/shared/world/ray_dda.cc index b12fa48..9f85e6b 100644 --- a/game/shared/world/ray_dda.cc +++ b/game/shared/world/ray_dda.cc @@ -40,7 +40,8 @@ void world::RayDDA::reset( if(direction.x < 0.0f) { this->side_dist.x = this->delta_dist.x * (start_fpos.x - lpos.x); this->vstep.x = voxel_pos::value_type(-1); - } else { + } + else { this->side_dist.x = this->delta_dist.x * (lpos.x + 1.0f - start_fpos.x); this->vstep.x = voxel_pos::value_type(+1); } @@ -48,7 +49,8 @@ void world::RayDDA::reset( if(direction.y < 0.0f) { this->side_dist.y = this->delta_dist.y * (start_fpos.y - lpos.y); this->vstep.y = voxel_pos::value_type(-1); - } else { + } + else { this->side_dist.y = this->delta_dist.y * (lpos.y + 1.0f - start_fpos.y); this->vstep.y = voxel_pos::value_type(+1); } @@ -56,7 +58,8 @@ void world::RayDDA::reset( if(direction.z < 0.0f) { this->side_dist.z = this->delta_dist.z * (start_fpos.z - lpos.z); this->vstep.z = voxel_pos::value_type(-1); - } else { + } + else { this->side_dist.z = this->delta_dist.z * (lpos.z + 1.0f - start_fpos.z); this->vstep.z = voxel_pos::value_type(+1); } @@ -76,19 +79,22 @@ voxel_id world::RayDDA::step(void) distance = side_dist.x; side_dist.x += delta_dist.x; vpos.x += vstep.x; - } else { + } + else { vnormal = voxel_pos(0, -vstep.y, 0); distance = side_dist.y; side_dist.y += delta_dist.y; vpos.y += vstep.y; } - } else { + } + else { if(side_dist.z < side_dist.y) { vnormal = voxel_pos(0, 0, -vstep.z); distance = side_dist.z; side_dist.z += delta_dist.z; vpos.z += vstep.z; - } else { + } + else { vnormal = voxel_pos(0, -vstep.y, 0); distance = side_dist.y; side_dist.y += delta_dist.y; diff --git a/game/shared/world/voxel_registry.cc b/game/shared/world/voxel_registry.cc index 2a82445..8deab30 100644 --- a/game/shared/world/voxel_registry.cc +++ b/game/shared/world/voxel_registry.cc @@ -114,7 +114,8 @@ voxel_id world::VoxelInfoBuilder::build(void) const new_info->textures[i].paths = default_texture.paths; new_info->textures[i].cached_offset = SIZE_MAX; new_info->textures[i].cached_plane = SIZE_MAX; - } else { + } + else { new_info->textures[i].paths = prototype.textures[i].paths; new_info->textures[i].cached_offset = SIZE_MAX; new_info->textures[i].cached_plane = SIZE_MAX; @@ -145,7 +146,8 @@ world::VoxelInfoBuilder& world::voxel_registry::construct(const char* name, voxe if(it != world::voxel_registry::builders.cend()) { return it->second; - } else { + } + else { return world::voxel_registry::builders.emplace(name, VoxelInfoBuilder(name, type, animated, blending)).first->second; } } @@ -156,7 +158,8 @@ world::VoxelInfo* world::voxel_registry::find(const char* name) if(it != world::voxel_registry::names.cend()) { return world::voxel_registry::find(it->second); - } else { + } + else { return nullptr; } } @@ -165,7 +168,8 @@ world::VoxelInfo* world::voxel_registry::find(const voxel_id voxel) { if((voxel != NULL_VOXEL_ID) && (voxel <= world::voxel_registry::voxels.size())) { return world::voxel_registry::voxels[voxel - 1].get(); - } else { + } + else { return nullptr; } } -- cgit