summaryrefslogtreecommitdiffhomepage
path: root/serialize/wall-atlas.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'serialize/wall-atlas.cpp')
-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 {