summaryrefslogtreecommitdiffhomepage
path: root/src
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 /src
parenta737d0cea5ca8bdcd3f9cfc38e29f8a15992ca3e (diff)
a
Diffstat (limited to 'src')
-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
4 files changed, 6 insertions, 5 deletions
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;