From 7867213a01fcabb1f05b1836c2ca59dc3bb2132f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 11 Jan 2024 13:54:53 +0100 Subject: rename tile_atlas -> ground_atlas --- serialize/tile-atlas.cpp | 58 ------------------------------------------------ 1 file changed, 58 deletions(-) delete mode 100644 serialize/tile-atlas.cpp (limited to 'serialize/tile-atlas.cpp') diff --git a/serialize/tile-atlas.cpp b/serialize/tile-atlas.cpp deleted file mode 100644 index 88385339..00000000 --- a/serialize/tile-atlas.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "src/tile-atlas.hpp" -#include "serialize/tile-atlas.hpp" -#include "serialize/corrade-string.hpp" -#include "serialize/magnum-vector.hpp" -#include "loader/loader.hpp" -#include "serialize/pass-mode.hpp" -#include "compat/exception.hpp" -#include -#include -#include - -using namespace floormat; - -namespace { - -struct proxy { - StringView name; - Vector2ub size; - pass_mode passability; -}; - -NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(proxy, name, size) - -} // namespace - -namespace nlohmann { - -void adl_serializer>::to_json(json& j, const std::shared_ptr& x) -{ - using nlohmann::to_json; - if (!x) - j = nullptr; - else - to_json(j, proxy{x->name(), x->num_tiles2(), x->pass_mode()}); -} - -void adl_serializer>::from_json(const json& j, std::shared_ptr& val) -{ - if (j.is_null()) - val = nullptr; - else - { - using nlohmann::from_json; - proxy x; - from_json(j, x); - pass_mode p = tile_atlas::default_pass_mode; - if (j.contains("pass-mode")) - p = j["pass-mode"]; - val = loader.tile_atlas(x.name, x.size, p); - if (auto p2 = val->pass_mode(); p2 != p) - { - const auto name = val->name(); - fm_throw("atlas {} wrong pass mode {} should be {}"_cf, name, uint8_t(p2), uint8_t(p)); - } - } -} - -} // namespace nlohmann -- cgit v1.2.3