summaryrefslogtreecommitdiffstats
path: root/game/shared
diff options
context:
space:
mode:
authoruntodesu <kirill@untode.su>2025-07-01 03:23:05 +0500
committeruntodesu <kirill@untode.su>2025-07-01 03:23:05 +0500
commit6dc5194895b6bd61d19bf5c95021471784084325 (patch)
tree705c35b3a671a09fc52b406dca81e7761729ded6 /game/shared
parent44d91043f268d93dd08e99c5855bd29f85dd61a7 (diff)
downloadvoxelius-6dc5194895b6bd61d19bf5c95021471784084325.tar.bz2
voxelius-6dc5194895b6bd61d19bf5c95021471784084325.zip
I forgot to set these to true in .clang-format
https://files.catbox.moe/909rig.gif
Diffstat (limited to 'game/shared')
-rw-r--r--game/shared/entity/collision.cc12
-rw-r--r--game/shared/entity/stasis.cc3
-rw-r--r--game/shared/game.cc6
-rw-r--r--game/shared/splash.cc3
-rw-r--r--game/shared/threading.cc6
-rw-r--r--game/shared/world/chunk.cc3
-rw-r--r--game/shared/world/dimension.cc9
-rw-r--r--game/shared/world/item_registry.cc9
-rw-r--r--game/shared/world/ray_dda.cc18
-rw-r--r--game/shared/world/voxel_registry.cc12
10 files changed, 54 insertions, 27 deletions
diff --git a/game/shared/entity/collision.cc b/game/shared/entity/collision.cc
index 190f6e7..454e96a 100644
--- a/game/shared/entity/collision.cc
+++ b/game/shared/entity/collision.cc
@@ -49,7 +49,8 @@ static int vgrid_collide(const world::Dimension* dimension, int d, entity::Colli
ddir = local_pos::value_type(+1);
dmin = lpos_min[d];
dmax = lpos_max[d];
- } else {
+ }
+ else {
ddir = local_pos::value_type(-1);
dmin = lpos_max[d];
dmax = lpos_min[d];
@@ -115,7 +116,8 @@ static int vgrid_collide(const world::Dimension* dimension, int d, entity::Colli
if(move_distance > threshold) {
velocity.value[d] *= -latch_values[d];
- } else {
+ }
+ else {
velocity.value[d] = 0.0f;
}
@@ -154,10 +156,12 @@ void entity::Collision::fixed_update(world::Dimension* dimension)
if(dimension->entities.any_of<entity::Gravity>(entity)) {
if(vertical_move == math::sign<int>(dimension->get_gravity())) {
dimension->entities.emplace_or_replace<entity::Grounded>(entity, entity::Grounded { surface });
- } else {
+ }
+ else {
dimension->entities.remove<entity::Grounded>(entity);
}
- } else {
+ }
+ else {
// The entity cannot be grounded because the component
// setup of said entity should not let it comprehend the
// concept of resting on the ground (it flies around)
diff --git a/game/shared/entity/stasis.cc b/game/shared/entity/stasis.cc
index 10e2e0c..68d8e9d 100644
--- a/game/shared/entity/stasis.cc
+++ b/game/shared/entity/stasis.cc
@@ -12,7 +12,8 @@ void entity::Stasis::fixed_update(world::Dimension* dimension)
for(auto [entity, transform] : view.each()) {
if(dimension->find_chunk(transform.chunk)) {
dimension->entities.remove<entity::Stasis>(entity);
- } else {
+ }
+ else {
dimension->entities.emplace_or_replace<entity::Stasis>(entity);
}
}
diff --git a/game/shared/game.cc b/game/shared/game.cc
index f383397..62eaf13 100644
--- a/game/shared/game.cc
+++ b/game/shared/game.cc
@@ -65,9 +65,11 @@ void shared_game::init(int argc, char** argv)
if(io::cmdline::contains("quiet")) {
logger->set_level(spdlog::level::warn);
- } else if(io::cmdline::contains("verbose")) {
+ }
+ else if(io::cmdline::contains("verbose")) {
logger->set_level(spdlog::level::trace);
- } else {
+ }
+ else {
logger->set_level(default_loglevel);
}
diff --git a/game/shared/splash.cc b/game/shared/splash.cc
index 0cd5f50..1ff3e8f 100644
--- a/game/shared/splash.cc
+++ b/game/shared/splash.cc
@@ -35,7 +35,8 @@ static void splash_init_filename(const char* filename)
while(std::getline(stream, line))
splash_lines.push_back(sanitize_line(line));
splash_random.seed(std::random_device()());
- } else {
+ }
+ else {
splash_lines.push_back(std::format("{}: {}", filename, PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())));
splash_random.seed(std::random_device()());
}
diff --git a/game/shared/threading.cc b/game/shared/threading.cc
index 82bcad7..ae3b3ea 100644
--- a/game/shared/threading.cc
+++ b/game/shared/threading.cc
@@ -42,10 +42,12 @@ void threading::init(void)
// Use the maximum available number of concurrent
// hardware threads provided by the implementation
thread_pool_size = num_concurrent_threads;
- } else {
+ }
+ else {
if(num_concurrent_threads) {
thread_pool_size = math::clamp<unsigned int>(std::strtoul(argument, nullptr, 10), 1U, num_concurrent_threads);
- } else {
+ }
+ else {
thread_pool_size = math::max<unsigned int>(std::strtoul(argument, nullptr, 10), 1U);
}
}
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<ChunkComponent>(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;
}
}