diff options
| author | Mel <einebeere@gmail.com> | 2023-07-08 03:25:44 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2023-07-08 03:25:44 +0200 |
| commit | fe2baedc760c2f29e2c720f6b1132a2de33c5430 (patch) | |
| tree | dfbe1c72a17805a3cab6e0d47433e9021890c9ca /src/World/Chunk.hpp | |
| parent | 41fbca10f6c6cdd9c1623f1347e7ecb40f5e7f59 (diff) | |
| download | meowcraft-fe2baedc760c2f29e2c720f6b1132a2de33c5430.tar.zst meowcraft-fe2baedc760c2f29e2c720f6b1132a2de33c5430.zip | |
Use own size types
Diffstat (limited to 'src/World/Chunk.hpp')
| -rw-r--r-- | src/World/Chunk.hpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/World/Chunk.hpp b/src/World/Chunk.hpp index b3eb06f..bc44137 100644 --- a/src/World/Chunk.hpp +++ b/src/World/Chunk.hpp @@ -1,6 +1,6 @@ #pragma once -#include <cstdint> +#include "../Common/Sizes.hpp" #include "BiomeType.hpp" #include "BlockType.hpp" #include "../GFX/Mesh.hpp" @@ -10,22 +10,22 @@ namespace MC::World { class Chunk { public: - static constexpr uint32_t Width = 16; - static constexpr uint32_t Height = 128; + static constexpr U32 Width = 16; + static constexpr U32 Height = 128; - Chunk(int64_t x, int64_t y) + Chunk(I64 x, I64 y) : m_blocks{Width * Height * Width, {BlockType::Air}}, - m_position{(float)x * Width, 0.0f, (float)y * Width} {} + m_position{(Real)x * Width, 0.0f, (Real)y * Width} {} struct BlockData { BlockType type; - bool empty() const { return type == BlockType::Air; } + Bool empty() const { return type == BlockType::Air; } }; - void set(uint32_t x, uint32_t y, uint32_t z, BlockData data); - BlockData get(uint32_t x, uint32_t y, uint32_t z) const; - bool is_empty(uint32_t x, uint32_t y, uint32_t z) const; + void set(U32 x, U32 y, U32 z, BlockData data); + BlockData get(U32 x, U32 y, U32 z) const; + Bool is_empty(U32 x, U32 y, U32 z) const; struct Details { Matrix<Width, Width> landmass_values{}; @@ -41,9 +41,9 @@ public: Vector<3> position() const; - static bool is_valid_position(uint32_t x, uint32_t y, uint32_t z); + static Bool is_valid_position(U32 x, U32 y, U32 z); private: - static uint64_t pos(uint32_t x, uint32_t y, uint32_t z); + static U64 pos(U32 x, U32 y, U32 z); Vector<3> m_position; std::vector<BlockData> m_blocks; |
