summaryrefslogtreecommitdiffhomepage
path: root/loader/vobj.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-01-13 04:48:59 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-01-13 05:05:16 +0100
commit7cec20e4f295ea2f92613b0231a765d710c2411a (patch)
treedb693feb5e5b80da75a09263242a1d89f6f2f770 /loader/vobj.cpp
parente75f99e22197008bd8a2e6df70c5b7554698300e (diff)
dw
Diffstat (limited to 'loader/vobj.cpp')
-rw-r--r--loader/vobj.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/loader/vobj.cpp b/loader/vobj.cpp
index db277410..ca6a2e63 100644
--- a/loader/vobj.cpp
+++ b/loader/vobj.cpp
@@ -16,9 +16,17 @@ struct vobj {
};
} // namespace floormat::loader_detail
+namespace nlohmann {
+
using floormat::loader_detail::vobj;
-void nlohmann::adl_serializer<vobj>::to_json(json& j, const vobj& val)
+template<>
+struct adl_serializer<vobj> {
+ static void to_json(json& j, const vobj& val);
+ static void from_json(const json& j, vobj& val);
+};
+
+void adl_serializer<vobj>::to_json(json& j, const vobj& val)
{
j["name"] = val.name;
if (val.descr)
@@ -26,7 +34,7 @@ void nlohmann::adl_serializer<vobj>::to_json(json& j, const vobj& val)
j["image"] = val.image_filename;
}
-void nlohmann::adl_serializer<vobj>::from_json(const json& j, vobj& val)
+void adl_serializer<vobj>::from_json(const json& j, vobj& val)
{
val.name = j["name"];
if (j.contains("description"))
@@ -36,6 +44,8 @@ void nlohmann::adl_serializer<vobj>::from_json(const json& j, vobj& val)
val.image_filename = j["image"];
}
+} // namespace nlohmann
+
namespace floormat::loader_detail {
std::shared_ptr<class anim_atlas> loader_impl::make_vobj_anim_atlas(StringView name, StringView image_filename)