diff options
| author | untodesu <kirill@untode.su> | 2025-09-11 15:48:53 +0500 |
|---|---|---|
| committer | untodesu <kirill@untode.su> | 2025-09-11 15:48:53 +0500 |
| commit | d0fbd68055e3f4a796330cc8acc6c0954b5327ff (patch) | |
| tree | e581014ea02711efa5e71f00f9862e5bca58f2ed /game/shared/world/feature.cc | |
| parent | cbd823aa2154a956e7da4319eecbf7afc10441ae (diff) | |
| download | voxelius-d0fbd68055e3f4a796330cc8acc6c0954b5327ff.tar.bz2 voxelius-d0fbd68055e3f4a796330cc8acc6c0954b5327ff.zip | |
Run clang-format across the project
Diffstat (limited to 'game/shared/world/feature.cc')
| -rw-r--r-- | game/shared/world/feature.cc | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/game/shared/world/feature.cc b/game/shared/world/feature.cc index cbdc183..4212043 100644 --- a/game/shared/world/feature.cc +++ b/game/shared/world/feature.cc @@ -1,53 +1,53 @@ -#include "shared/pch.hh" - -#include "shared/world/feature.hh" - -#include "shared/world/chunk.hh" -#include "shared/world/dimension.hh" -#include "shared/world/voxel_storage.hh" - -#include "shared/coord.hh" - -void world::Feature::place(const voxel_pos& vpos, Dimension* dimension) const -{ - for(const auto [rpos, voxel, overwrite] : (*this)) { - auto it_vpos = vpos + rpos; - auto it_cpos = coord::to_chunk(it_vpos); - - if(auto chunk = dimension->create_chunk(it_cpos)) { - auto it_lpos = coord::to_local(it_vpos); - auto it_index = coord::to_index(it_lpos); - - if(chunk->get_voxel(it_index) && !overwrite) { - // There is something in the way - // and the called intentionally requested - // we do not force feature to overwrite voxels - continue; - } - - chunk->set_voxel(voxel, it_index); - } - } -} - -void world::Feature::place(const voxel_pos& vpos, const chunk_pos& cpos, VoxelStorage& voxels) const -{ - for(const auto [rpos, voxel, overwrite] : (*this)) { - auto it_vpos = vpos + rpos; - auto it_cpos = coord::to_chunk(it_vpos); - - if(it_cpos == cpos) { - auto it_lpos = coord::to_local(it_vpos); - auto it_index = coord::to_index(it_lpos); - - if(voxels[it_index] && !overwrite) { - // There is something in the way - // and the called intentionally requested - // we do not force feature to overwrite voxels - continue; - } - - voxels[it_index] = voxel; - } - } -} +#include "shared/pch.hh"
+
+#include "shared/world/feature.hh"
+
+#include "shared/world/chunk.hh"
+#include "shared/world/dimension.hh"
+#include "shared/world/voxel_storage.hh"
+
+#include "shared/coord.hh"
+
+void world::Feature::place(const voxel_pos& vpos, Dimension* dimension) const
+{
+ for(const auto [rpos, voxel, overwrite] : (*this)) {
+ auto it_vpos = vpos + rpos;
+ auto it_cpos = coord::to_chunk(it_vpos);
+
+ if(auto chunk = dimension->create_chunk(it_cpos)) {
+ auto it_lpos = coord::to_local(it_vpos);
+ auto it_index = coord::to_index(it_lpos);
+
+ if(chunk->get_voxel(it_index) && !overwrite) {
+ // There is something in the way
+ // and the called intentionally requested
+ // we do not force feature to overwrite voxels
+ continue;
+ }
+
+ chunk->set_voxel(voxel, it_index);
+ }
+ }
+}
+
+void world::Feature::place(const voxel_pos& vpos, const chunk_pos& cpos, VoxelStorage& voxels) const
+{
+ for(const auto [rpos, voxel, overwrite] : (*this)) {
+ auto it_vpos = vpos + rpos;
+ auto it_cpos = coord::to_chunk(it_vpos);
+
+ if(it_cpos == cpos) {
+ auto it_lpos = coord::to_local(it_vpos);
+ auto it_index = coord::to_index(it_lpos);
+
+ if(voxels[it_index] && !overwrite) {
+ // There is something in the way
+ // and the called intentionally requested
+ // we do not force feature to overwrite voxels
+ continue;
+ }
+
+ voxels[it_index] = voxel;
+ }
+ }
+}
|
