summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-12-23 12:17:12 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-12-23 12:17:12 +0100
commitae9cc0570ad7bd7a879bea1447b12fa9284b569c (patch)
treed112ccc202f04b3d100652504ed8aaf39ed068da
parenta737d0cea5ca8bdcd3f9cfc38e29f8a15992ca3e (diff)
a
-rw-r--r--editor/imgui-raii.hpp2
-rw-r--r--editor/scenery-editor.cpp2
-rw-r--r--editor/scenery-editor.hpp2
-rw-r--r--src/chunk.cpp2
-rw-r--r--src/scenery.hpp2
-rw-r--r--src/tile-image.hpp4
-rw-r--r--src/wall-atlas.cpp3
-rw-r--r--test/wall-atlas2.cpp2
8 files changed, 9 insertions, 10 deletions
diff --git a/editor/imgui-raii.hpp b/editor/imgui-raii.hpp
index 3a18f84f..7f65e63a 100644
--- a/editor/imgui-raii.hpp
+++ b/editor/imgui-raii.hpp
@@ -17,7 +17,7 @@ struct raii_wrapper final
raii_wrapper& operator=(const raii_wrapper&) = delete;
raii_wrapper& operator=(raii_wrapper&&) noexcept;
raii_wrapper(raii_wrapper&& other) noexcept;
- operator bool() const noexcept;
+ explicit operator bool() const noexcept;
private:
F dtor = nullptr;
diff --git a/editor/scenery-editor.cpp b/editor/scenery-editor.cpp
index b1871221..40742c8a 100644
--- a/editor/scenery-editor.cpp
+++ b/editor/scenery-editor.cpp
@@ -14,7 +14,7 @@ using rotation_t = std::underlying_type_t<enum rotation>;
scenery_editor::scenery_::operator bool() const noexcept
{
- return proto;
+ return !!proto;
}
scenery_editor::scenery_editor() noexcept
diff --git a/editor/scenery-editor.hpp b/editor/scenery-editor.hpp
index 8a48373f..999e9e15 100644
--- a/editor/scenery-editor.hpp
+++ b/editor/scenery-editor.hpp
@@ -17,7 +17,7 @@ public:
struct scenery_ final {
String name, descr;
scenery_proto proto;
- operator bool() const noexcept;
+ explicit operator bool() const noexcept;
};
scenery_editor() noexcept;
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_<Atlas>& b) const noexcept;
- operator bool() const noexcept;
+ explicit operator bool() const noexcept;
};
template<typename Atlas, typename Proto>
@@ -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_<tile_atlas>;
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<Wall::Direction>& 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;
diff --git a/test/wall-atlas2.cpp b/test/wall-atlas2.cpp
index b95b1761..7c64166c 100644
--- a/test/wall-atlas2.cpp
+++ b/test/wall-atlas2.cpp
@@ -11,7 +11,6 @@ void test_app::test_wall_atlas2()
{
using enum Wall::Direction_;
- Debug{} << "test_wall2: start";
static constexpr auto name = "concrete1"_s;
auto& a = *loader.wall_atlas(name, false);
fm_assert(a.name() == name);
@@ -24,7 +23,6 @@ void test_app::test_wall_atlas2()
fm_assert(a.frames(N, Wall::Group_::wall).size() >= 3);
fm_assert(a.group(N, Wall::Group_::top)->is_defined);
fm_assert(a.frames(N, Wall::Group_::wall)[0].size == Vector2ui(Vector2i{iTILE_SIZE.x(), iTILE_SIZE.z()}));
- Debug{} << "test_wall2: end";
}
} // namespace floormat