From d0fbd68055e3f4a796330cc8acc6c0954b5327ff Mon Sep 17 00:00:00 2001 From: untodesu Date: Thu, 11 Sep 2025 15:48:53 +0500 Subject: Run clang-format across the project --- game/shared/world/dimension.hh | 200 ++++++++++++++++++++--------------------- 1 file changed, 100 insertions(+), 100 deletions(-) (limited to 'game/shared/world/dimension.hh') diff --git a/game/shared/world/dimension.hh b/game/shared/world/dimension.hh index 8b6691d..bf9bfe1 100644 --- a/game/shared/world/dimension.hh +++ b/game/shared/world/dimension.hh @@ -1,100 +1,100 @@ -#pragma once - -#include "shared/const.hh" -#include "shared/types.hh" - -namespace io -{ -class ConfigMap; -} // namespace io - -namespace world -{ -class Chunk; -class VoxelStorage; -} // namespace world - -namespace world -{ -using dimension_entropy_map = std::array; -using dimension_height_map = std::array; -} // namespace world - -namespace world -{ -class Dimension { -public: - explicit Dimension(std::string_view name, float gravity); - virtual ~Dimension(void); - - std::string_view get_name(void) const; - float get_gravity(void) const; - -public: - Chunk* create_chunk(const chunk_pos& cpos); - Chunk* find_chunk(entt::entity entity) const; - Chunk* find_chunk(const chunk_pos& cpos) const; - - void remove_chunk(entt::entity entity); - void remove_chunk(const chunk_pos& cpos); - void remove_chunk(Chunk* chunk); - -public: - voxel_id get_voxel(const voxel_pos& vpos) const; - voxel_id get_voxel(const chunk_pos& cpos, const local_pos& lpos) const; - - bool set_voxel(voxel_id voxel, const voxel_pos& vpos); - bool set_voxel(voxel_id voxel, const chunk_pos& cpos, const local_pos& lpos); - -public: - virtual void init(io::ConfigMap& config); - virtual void init_late(std::uint64_t global_seed); - virtual bool generate(const chunk_pos& cpos, VoxelStorage& voxels); - -public: - entt::registry chunks; - entt::registry entities; - -private: - std::string m_name; - emhash8::HashMap m_chunkmap; - float m_gravity; -}; -} // namespace world - -namespace world -{ -struct ChunkComponent final { - chunk_pos cpos; - Chunk* chunk; -}; -} // namespace world - -namespace world -{ -struct ChunkCreateEvent final { - Dimension* dimension; - chunk_pos cpos; - Chunk* chunk; -}; - -struct ChunkDestroyEvent final { - Dimension* dimension; - chunk_pos cpos; - Chunk* chunk; -}; - -struct ChunkUpdateEvent final { - Dimension* dimension; - chunk_pos cpos; - Chunk* chunk; -}; - -struct VoxelSetEvent final { - Dimension* dimension; - chunk_pos cpos; - local_pos lpos; - voxel_id voxel; - Chunk* chunk; -}; -} // namespace world +#pragma once + +#include "shared/const.hh" +#include "shared/types.hh" + +namespace io +{ +class ConfigMap; +} // namespace io + +namespace world +{ +class Chunk; +class VoxelStorage; +} // namespace world + +namespace world +{ +using dimension_entropy_map = std::array; +using dimension_height_map = std::array; +} // namespace world + +namespace world +{ +class Dimension { +public: + explicit Dimension(std::string_view name, float gravity); + virtual ~Dimension(void); + + std::string_view get_name(void) const; + float get_gravity(void) const; + +public: + Chunk* create_chunk(const chunk_pos& cpos); + Chunk* find_chunk(entt::entity entity) const; + Chunk* find_chunk(const chunk_pos& cpos) const; + + void remove_chunk(entt::entity entity); + void remove_chunk(const chunk_pos& cpos); + void remove_chunk(Chunk* chunk); + +public: + voxel_id get_voxel(const voxel_pos& vpos) const; + voxel_id get_voxel(const chunk_pos& cpos, const local_pos& lpos) const; + + bool set_voxel(voxel_id voxel, const voxel_pos& vpos); + bool set_voxel(voxel_id voxel, const chunk_pos& cpos, const local_pos& lpos); + +public: + virtual void init(io::ConfigMap& config); + virtual void init_late(std::uint64_t global_seed); + virtual bool generate(const chunk_pos& cpos, VoxelStorage& voxels); + +public: + entt::registry chunks; + entt::registry entities; + +private: + std::string m_name; + emhash8::HashMap m_chunkmap; + float m_gravity; +}; +} // namespace world + +namespace world +{ +struct ChunkComponent final { + chunk_pos cpos; + Chunk* chunk; +}; +} // namespace world + +namespace world +{ +struct ChunkCreateEvent final { + Dimension* dimension; + chunk_pos cpos; + Chunk* chunk; +}; + +struct ChunkDestroyEvent final { + Dimension* dimension; + chunk_pos cpos; + Chunk* chunk; +}; + +struct ChunkUpdateEvent final { + Dimension* dimension; + chunk_pos cpos; + Chunk* chunk; +}; + +struct VoxelSetEvent final { + Dimension* dimension; + chunk_pos cpos; + local_pos lpos; + voxel_id voxel; + Chunk* chunk; +}; +} // namespace world -- cgit