Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
sthalik committed Dec 23, 2023
1 parent a737d0c commit ae9cc05
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion editor/imgui-raii.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion editor/scenery-editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion editor/scenery-editor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class scenery_editor final
struct scenery_ final {
String name, descr;
scenery_proto proto;
operator bool() const noexcept;
explicit operator bool() const noexcept;
};

scenery_editor() noexcept;
Expand Down
2 changes: 1 addition & 1 deletion src/chunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/scenery.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/tile-image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>;
Expand Down
3 changes: 2 additions & 1 deletion src/wall-atlas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions test/wall-atlas2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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

0 comments on commit ae9cc05

Please sign in to comment.