diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-18 23:42:07 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-18 23:42:07 +0100 |
commit | 4d9a82b720c8ce74b94f43f72ddd819ef21abbdf (patch) | |
tree | c0a5d21b8e19fbb60c286faec8e302e6f32b6679 /src/chunk.hpp | |
parent | 32b8c22828315292857e2cd9909fba620f30ff70 (diff) |
pre-declare integer types without cstddef/cstdint
Diffstat (limited to 'src/chunk.hpp')
-rw-r--r-- | src/chunk.hpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/chunk.hpp b/src/chunk.hpp index d22ce7fe..f279433e 100644 --- a/src/chunk.hpp +++ b/src/chunk.hpp @@ -1,4 +1,5 @@ #pragma once +#include "object-id.hpp" #include "tile.hpp" #include "tile-iterator.hpp" #include <type_traits> @@ -22,9 +23,9 @@ enum class collision_type : unsigned char { }; struct collision_data final { - std::uint64_t tag : 2; - std::uint64_t pass : 2; - std::uint64_t data : 60; + uint64_t tag : 2; + uint64_t pass : 2; + uint64_t data : 60; }; struct chunk final @@ -33,8 +34,8 @@ struct chunk final friend struct entity; friend struct world; - tile_ref operator[](std::size_t idx) noexcept; - tile_proto operator[](std::size_t idx) const noexcept; + tile_ref operator[](size_t idx) noexcept; + tile_proto operator[](size_t idx) const noexcept; tile_ref operator[](local_coords xy) noexcept; tile_proto operator[](local_coords xy) const noexcept; @@ -68,13 +69,13 @@ struct chunk final struct ground_mesh_tuple final { GL::Mesh& mesh; - const ArrayView<const std::uint8_t> ids; - const std::size_t size; + const ArrayView<const uint8_t> ids; + const size_t size; }; struct wall_mesh_tuple final { GL::Mesh& mesh; - const ArrayView<const std::uint16_t> ids; - const std::size_t size; + const ArrayView<const uint16_t> ids; + const size_t size; }; struct scenery_mesh_tuple final { @@ -87,12 +88,12 @@ struct chunk final float depth = -1; }; - using RTree = ::RTree<std::uint64_t, float, 2, float>; + using RTree = ::RTree<object_id, float, 2, float>; ground_mesh_tuple ensure_ground_mesh() noexcept; - tile_atlas* ground_atlas_at(std::size_t i) const noexcept; + tile_atlas* ground_atlas_at(size_t i) const noexcept; wall_mesh_tuple ensure_wall_mesh() noexcept; - tile_atlas* wall_atlas_at(std::size_t i) const noexcept; + tile_atlas* wall_atlas_at(size_t i) const noexcept; scenery_mesh_tuple ensure_scenery_mesh() noexcept; void ensure_passability() noexcept; @@ -104,15 +105,15 @@ struct chunk final void add_entity(const std::shared_ptr<entity>& e); void add_entity_unsorted(const std::shared_ptr<entity>& e); void sort_entities(); - void remove_entity(std::size_t i); + void remove_entity(size_t i); const std::vector<std::shared_ptr<entity>>& entities() const; private: std::array<std::shared_ptr<tile_atlas>, TILE_COUNT> _ground_atlases; - std::array<std::uint8_t, TILE_COUNT> ground_indexes = {}; + std::array<uint8_t, TILE_COUNT> ground_indexes = {}; std::array<variant_t, TILE_COUNT> _ground_variants = {}; std::array<std::shared_ptr<tile_atlas>, TILE_COUNT*2> _wall_atlases; - std::array<std::uint16_t, TILE_COUNT*2> wall_indexes = {}; + std::array<uint16_t, TILE_COUNT*2> wall_indexes = {}; std::array<variant_t, TILE_COUNT*2> _wall_variants = {}; std::vector<std::shared_ptr<entity>> _entities; @@ -134,7 +135,7 @@ private: struct bbox final // NOLINT(cppcoreguidelines-pro-type-member-init) { - std::uint64_t id; + object_id id; Vector2i start, end; bool operator==(const bbox& other) const noexcept; |