diff options
Diffstat (limited to 'serialize')
-rw-r--r-- | serialize/tile-atlas.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
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 <string_view> #include <Corrade/Containers/Optional.h> #include <Corrade/Containers/String.h> #include <nlohmann/json.hpp> @@ -50,6 +51,12 @@ void adl_serializer<std::shared_ptr<tile_atlas>>::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)); + } } } |