diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-01 21:32:10 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-01 21:32:10 +0100 |
commit | d7c63cc5cc224df11b95bfd7d36b16f803575bdb (patch) | |
tree | 99f42d2a3444e0860d0504d0eaf2c13d507ee3e6 | |
parent | af9e9e64a8dea21868cf3474cda6b8a85ac05442 (diff) |
use variant typedef and default value consistently
-rw-r--r-- | src/chunk.hpp | 2 | ||||
-rw-r--r-- | src/tile-image.cpp | 2 | ||||
-rw-r--r-- | src/tile-image.hpp | 6 | ||||
-rw-r--r-- | src/tile.hpp | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/src/chunk.hpp b/src/chunk.hpp index fa3f6979..8ea6a6dd 100644 --- a/src/chunk.hpp +++ b/src/chunk.hpp @@ -37,7 +37,7 @@ struct chunk final private: std::array<std::shared_ptr<tile_atlas>, TILE_COUNT> _ground_atlases, _wall_north_atlases, _wall_west_atlases; - std::array<std::uint16_t, TILE_COUNT> _ground_variants = {}, _wall_north_variants = {}, _wall_west_variants = {}; + std::array<variant_t, TILE_COUNT> _ground_variants = {}, _wall_north_variants = {}, _wall_west_variants = {}; std::bitset<TILE_COUNT*2> _passability = {}; mutable bool _maybe_empty = true; }; diff --git a/src/tile-image.cpp b/src/tile-image.cpp index 5d9d9f11..b10effe4 100644 --- a/src/tile-image.cpp +++ b/src/tile-image.cpp @@ -9,7 +9,7 @@ bool operator==(const tile_image_proto& a, const tile_image_proto& b) noexcept tile_image_proto::operator bool() const noexcept { return atlas != nullptr; } -tile_image_ref::tile_image_ref(std::shared_ptr<tile_atlas>& atlas, std::uint16_t& variant) noexcept : +tile_image_ref::tile_image_ref(std::shared_ptr<tile_atlas>& atlas, variant_t& variant) noexcept : atlas{atlas}, variant{variant} { } diff --git a/src/tile-image.hpp b/src/tile-image.hpp index 5a13e13f..deaa568b 100644 --- a/src/tile-image.hpp +++ b/src/tile-image.hpp @@ -11,7 +11,7 @@ using variant_t = std::uint16_t; struct tile_image_proto final { std::shared_ptr<tile_atlas> atlas; - variant_t variant = (std::uint16_t)-1; + variant_t variant = 0; friend bool operator==(const tile_image_proto& a, const tile_image_proto& b) noexcept; operator bool() const noexcept; @@ -20,9 +20,9 @@ struct tile_image_proto final struct tile_image_ref final { std::shared_ptr<tile_atlas>& atlas; - std::uint16_t& variant; + variant_t& variant; - tile_image_ref(std::shared_ptr<tile_atlas>& atlas, std::uint16_t& variant) noexcept; + tile_image_ref(std::shared_ptr<tile_atlas>& atlas, variant_t& variant) noexcept; tile_image_ref(const tile_image_ref&) noexcept; tile_image_ref(tile_image_ref&&) noexcept; tile_image_ref& operator=(const tile_image_proto& tile_proto) noexcept; diff --git a/src/tile.hpp b/src/tile.hpp index 8061035f..ab55ca11 100644 --- a/src/tile.hpp +++ b/src/tile.hpp @@ -24,7 +24,7 @@ private: struct tile_proto final { std::shared_ptr<tile_atlas> ground_atlas, wall_north_atlas, wall_west_atlas; - std::uint16_t ground_variant = 0xffff, wall_north_variant = 0xffff, wall_west_variant = 0xffff; + variant_t ground_variant = 0, wall_north_variant = 0, wall_west_variant = 0; pass_mode pass_mode = pass_mode::pass_shoot_through; tile_image_proto ground_image() const noexcept; |