diff options
-rw-r--r-- | loader/wall-atlas.cpp | 13 | ||||
-rw-r--r-- | src/chunk-walls.cpp | 2 | ||||
-rw-r--r-- | src/wall-atlas.cpp | 2 | ||||
-rw-r--r-- | test/wall-atlas.cpp | 6 |
4 files changed, 11 insertions, 12 deletions
diff --git a/loader/wall-atlas.cpp b/loader/wall-atlas.cpp index 23eb6e53..30afe3d9 100644 --- a/loader/wall-atlas.cpp +++ b/loader/wall-atlas.cpp @@ -56,17 +56,16 @@ const wall_info& loader_impl::make_invalid_wall_atlas() return *invalid_wall_atlas; constexpr auto name = "<invalid>"_s; - constexpr auto size = Vector3ui{iTILE_SIZE}; - constexpr auto frame_size = Vector2ui{size.x(), size.z()}; + constexpr auto frame_size = Vector2ui{iTILE_SIZE.x(), iTILE_SIZE.z()}; auto a = std::make_shared<class wall_atlas>( wall_atlas_def { - {.name = name, .depth = 8}, - { {{}, frame_size},}, - { { {.index = 0, .count = 1, .pixel_size = frame_size, } } }, - {{ {.val = 0}, {}, {}, {} }}, + Wall::Info{.name = name, .depth = 8}, + {{ {}, frame_size}, }, + {{ {.index = 0, .count = 1, .pixel_size = frame_size, } }}, + {{ {.val = 0}, {}, }}, {1u}, - }, name, make_error_texture()); + }, name, make_error_texture()); invalid_wall_atlas = Pointer<wall_info>{InPlaceInit, wall_info{ .name = name, .atlas = a } }; return *invalid_wall_atlas; } diff --git a/src/chunk-walls.cpp b/src/chunk-walls.cpp index 20539372..01cc39b6 100644 --- a/src/chunk-walls.cpp +++ b/src/chunk-walls.cpp @@ -131,6 +131,8 @@ constexpr Quads::quad get_quad(Direction_ D, Group_ G, float depth) }}; } } + std::unreachable(); + fm_abort("invalid wall_atlas group '%d'", (int)G); } // ----------------------- diff --git a/src/wall-atlas.cpp b/src/wall-atlas.cpp index d0fe6210..3b2ff9d7 100644 --- a/src/wall-atlas.cpp +++ b/src/wall-atlas.cpp @@ -58,6 +58,8 @@ wall_atlas::wall_atlas(wall_atlas_def def, String path, const ImageView2D& img) _image_size{get_image_size(img)}, _direction_map{def.direction_map} { + fm_soft_assert(!def.frames.empty()); + { bool found = false; for (auto [dir_name, dir] : wall_atlas::directions) diff --git a/test/wall-atlas.cpp b/test/wall-atlas.cpp index a130c35f..14196b8c 100644 --- a/test/wall-atlas.cpp +++ b/test/wall-atlas.cpp @@ -47,21 +47,17 @@ void test_read_groups(StringView filename) auto info = read_info_header(jroot); fm_assert(info.name == "foo"_s); fm_assert(info.depth == 42); + fm_assert(info.passability == pass_mode::shoot_through); fm_assert(jroot["depth"] == 42); fm_assert( jroot.contains("n") ); - fm_assert(!jroot.contains("e") ); - fm_assert(!jroot.contains("s") ); fm_assert( jroot.contains("w") ); fm_assert(jroot["n"].is_object() && !jroot["n"].empty()); fm_assert(jroot["w"].is_object() && !jroot["w"].empty()); fm_assert(is_direction_defined(read_direction_metadata(jroot, Direction_::N))); - fm_assert(!is_direction_defined(read_direction_metadata(jroot, Direction_::E))); - fm_assert(!is_direction_defined(read_direction_metadata(jroot, Direction_::S))); const auto dir = read_direction_metadata(jroot, Direction_::W); fm_assert(is_direction_defined(dir)); - fm_assert(dir.passability == pass_mode::shoot_through); fm_assert(dir.wall.pixel_size == Vector2ui{} ); fm_assert(dir.overlay.default_tint == false ); fm_assert(dir.wall.mirrored == false ); |