From ae9cc0570ad7bd7a879bea1447b12fa9284b569c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 23 Dec 2023 12:17:12 +0100 Subject: a --- src/chunk.cpp | 2 +- src/scenery.hpp | 2 +- src/tile-image.hpp | 4 ++-- src/wall-atlas.cpp | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/chunk.cpp b/src/chunk.cpp index 2222b40a..17fe1b49 100644 --- a/src/chunk.cpp +++ b/src/chunk.cpp @@ -28,7 +28,7 @@ bool chunk::empty(bool force) const noexcept for (auto i = 0uz; i < TILE_COUNT; i++) if (!_objects.empty() || _ground && _ground->_ground_atlases[i] || - _walls && _walls->atlases[i]) + _walls && (_walls->atlases[i*2+0] || _walls->atlases[i*2+1])) return _maybe_empty = false; if (!_objects.empty()) return false; diff --git a/src/scenery.hpp b/src/scenery.hpp index 9135b548..05b0683a 100644 --- a/src/scenery.hpp +++ b/src/scenery.hpp @@ -31,7 +31,7 @@ struct scenery_proto : object_proto ~scenery_proto() noexcept override; scenery_proto& operator=(const scenery_proto&); bool operator==(const object_proto& proto) const override; - operator bool() const; + explicit operator bool() const; }; struct scenery final : object diff --git a/src/tile-image.hpp b/src/tile-image.hpp index 8b2c94e5..50cf0a33 100644 --- a/src/tile-image.hpp +++ b/src/tile-image.hpp @@ -15,7 +15,7 @@ struct image_proto_ variant_t variant = 0; bool operator==(const image_proto_& b) const noexcept; - operator bool() const noexcept; + explicit operator bool() const noexcept; }; template @@ -28,7 +28,7 @@ struct image_ref_ final image_ref_(const image_ref_&) noexcept; image_ref_& operator=(const Proto& proto) noexcept; operator Proto() const noexcept; - operator bool() const noexcept; + explicit operator bool() const noexcept; }; using tile_image_proto = image_proto_; diff --git a/src/wall-atlas.cpp b/src/wall-atlas.cpp index 90d5dfe7..b56a845b 100644 --- a/src/wall-atlas.cpp +++ b/src/wall-atlas.cpp @@ -47,7 +47,7 @@ void resolve_wall_rotations(std::vector& array, const std::arra dir_name, group_name, direction_index_to_name(G.from_rotation)); const auto& D2 = array[DAI2.val]; const auto& G2 = D2.*ptr; - if (!G2.is_defined) + if (!G2.is_defined || G2.from_rotation != (uint8_t)-1) fm_throw("from_rotation for '{}/{}' points to empty group '{}/{}'"_cf, dir_name, group_name, direction_index_to_name(G.from_rotation), group_name); G.from_rotation = DAI2.val; @@ -127,6 +127,7 @@ wall_atlas::wall_atlas(wall_atlas_def def, String path, const ImageView2D& img) const auto& G = D->*gmemb; fm_soft_assert(G.is_defined == !!G.count); fm_soft_assert(G.is_defined == (G.index != (uint32_t)-1)); + fm_soft_assert(G.from_rotation == (uint8_t)-1 || G.is_defined); if (!G.is_defined) continue; found = true; -- cgit v1.2.3