diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-09-16 12:35:27 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-09-16 12:35:52 +0200 |
commit | 4bb0637fe81d79bba0de34f72caa632d1da03424 (patch) | |
tree | 009f827aae4cba9171fdc19e3fa8ba0a02ed1c9b | |
parent | 44125b422bb75b9a14dc83d01325e9b1ef968bf6 (diff) |
loader: fix tile atlas pass mode being ignored
-rw-r--r-- | loader/atlas.cpp | 4 | ||||
-rw-r--r-- | test/serializer.cpp | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/loader/atlas.cpp b/loader/atlas.cpp index 0a06f065..ede9f8ec 100644 --- a/loader/atlas.cpp +++ b/loader/atlas.cpp @@ -34,7 +34,11 @@ namespace floormat::loader_detail { std::shared_ptr<tile_atlas> loader_impl::tile_atlas(StringView name, Vector2ub size, Optional<pass_mode> pass) noexcept(false) { if (auto it = tile_atlas_map.find(name); it != tile_atlas_map.end()) + { + if (pass) + fm_assert(it->second->pass_mode() == pass); return it->second; + } fm_soft_assert(check_atlas_name(name)); diff --git a/test/serializer.cpp b/test/serializer.cpp index dd2d090d..5fd55b3e 100644 --- a/test/serializer.cpp +++ b/test/serializer.cpp @@ -17,8 +17,7 @@ chunk& test_app::make_test_chunk(world& w, chunk_coords_ ch) { chunk& c = w[ch]; c.mark_modified(); - auto metal1 = loader.tile_atlas("metal1", {2, 2}, pass_mode::pass), - metal2 = loader.tile_atlas("metal2", {2, 2}, pass_mode::blocked), + auto metal2 = loader.tile_atlas("metal2", {2, 2}, pass_mode::blocked), tiles = loader.tile_atlas("tiles", {8, 5}, pass_mode::pass); constexpr auto N = TILE_MAX_DIM; for (auto [x, k, pt] : c) @@ -28,9 +27,9 @@ chunk& test_app::make_test_chunk(world& w, chunk_coords_ ch) control_panel = loader.scenery("control panel (wall) 1"); control_panel.r = rotation::W; constexpr auto K = N/2; - c[{K, K }].wall_north() = { metal1, 0 }; + c[{K, K }].wall_north() = { metal2, 0 }; c[{K, K }].wall_west() = { metal2, 0 }; - c[{K, K+1}].wall_north() = { metal1, 0 }; + c[{K, K+1}].wall_north() = { metal2, 0 }; c[{K+1, K }].wall_west() = { metal2, 0 }; w.make_object<scenery>(w.make_id(), {ch, {3, 4}}, table); w.make_object<scenery>(w.make_id(), {ch, {K, K+1}}, control_panel); |