From 1ae0459c47ad9b27765336a73f039c578ef9e503 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 8 Dec 2022 13:46:55 +0100 Subject: serialize: die on tile atlas reuse with wrong pass flag --- serialize/tile-atlas.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/serialize/tile-atlas.cpp b/serialize/tile-atlas.cpp index 6a51da4c..cb58d1b4 100644 --- a/serialize/tile-atlas.cpp +++ b/serialize/tile-atlas.cpp @@ -4,6 +4,7 @@ #include "serialize/magnum-vector2i.hpp" #include "loader/loader.hpp" #include "serialize/pass-mode.hpp" +#include #include #include #include @@ -50,6 +51,12 @@ void adl_serializer>::from_json(const json& j, std:: if (j.contains("pass-mode")) p = {InPlaceInit, j["pass-mode"]}; val = loader.tile_atlas(x.name, x.size, p); + if (auto p2 = val->pass_mode(); p && p2 != p) + { + int m = p2 ? int(*p2) : -1; + const auto name = val->name(); + fm_throw("atlas {} wrong pass mode {} should be {}"_cf, std::string_view{name.data(), name.size()}, m, std::uint8_t(*p)); + } } } -- cgit v1.2.3