summaryrefslogtreecommitdiffhomepage
path: root/serialize
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-11-08 07:27:28 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-11-08 07:27:28 +0100
commite81718fa2b2fae048161742bb81f8a76daf0436f (patch)
tree5469cabe98df2a9e855448e6abc8c396aa31f74b /serialize
parentd4e88ab969b891fbdce75e190b4bac97268a1f08 (diff)
a
Diffstat (limited to 'serialize')
-rw-r--r--serialize/wall-atlas.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/serialize/wall-atlas.cpp b/serialize/wall-atlas.cpp
index 44620246..6f29026d 100644
--- a/serialize/wall-atlas.cpp
+++ b/serialize/wall-atlas.cpp
@@ -92,7 +92,12 @@ Direction read_direction_metadata(const json& jroot, Direction_ dir)
Info read_info_header(const json& jroot)
{
- Info val { std::string(jroot["name"s]), jroot["depth"] };
+ fm_soft_assert(jroot.contains(("name"s)));
+ fm_soft_assert(jroot.contains(("depth")));
+ Info val = {std::string{jroot["name"s]}, {}, jroot["depth"s]};
+ fm_soft_assert(val.depth > 0);
+ if (jroot.contains("description"s))
+ val.description = std::string{jroot["description"s]};
return val;
}
@@ -113,6 +118,14 @@ void write_group_metadata(json& jgroup, const Group& val)
jgroup["default-tint"s] = val.default_tint;
}
+void write_info_header(json& jroot, const Info& info)
+{
+ jroot["name"s] = info.name;
+ if (info.description)
+ jroot["description"s] = info.description;
+ jroot["depth"s] = info.depth;
+}
+
} // namespace floormat::Wall::detail
namespace nlohmann {