summaryrefslogtreecommitdiffhomepage
path: root/serialize/scenery.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'serialize/scenery.cpp')
-rw-r--r--serialize/scenery.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/serialize/scenery.cpp b/serialize/scenery.cpp
index 8519fd49..820c67af 100644
--- a/serialize/scenery.cpp
+++ b/serialize/scenery.cpp
@@ -13,6 +13,7 @@
namespace {
using namespace floormat;
+using namespace std::string_literals;
constexpr struct {
scenery_type value = scenery_type::none;
@@ -85,24 +86,24 @@ void adl_serializer<scenery_proto>::to_json(json& j, const scenery_proto& f)
fm_assert(f.atlas);
const scenery_proto default_scenery;
if (f.type != default_scenery.type)
- j["type"] = f.type;
- j["atlas-name"] = f.atlas->name();
+ j["type"s] = f.type;
+ j["atlas-name"s] = f.atlas->name();
if (f.frame != default_scenery.frame)
- j["frame"] = f.frame;
+ j["frame"s] = f.frame;
if (f.r != default_scenery.r)
- j["rotation"] = f.r;
+ j["rotation"s] = f.r;
if (f.pass != default_scenery.pass)
- j["pass-mode"] = f.pass;
+ j["pass-mode"s] = f.pass;
if (f.active != default_scenery.active)
- j["active"] = f.active;
+ j["active"s] = f.active;
if (f.interactive != default_scenery.interactive)
- j["interactive"] = f.interactive;
+ j["interactive"s] = f.interactive;
if (f.offset != default_scenery.offset)
- j["offset"] = Vector2i(f.offset);
+ j["offset"s] = Vector2i(f.offset);
if (f.bbox_offset != default_scenery.bbox_offset)
- j["bbox-offset"] = Vector2i(f.bbox_offset);
+ j["bbox-offset"s] = Vector2i(f.bbox_offset);
if (f.bbox_size != default_scenery.bbox_size)
- j["bbox-size"] = Vector2ui(f.bbox_size);
+ j["bbox-size"s] = Vector2ui(f.bbox_size);
}
void adl_serializer<scenery_proto>::from_json(const json& j, scenery_proto& f)
@@ -114,7 +115,7 @@ void adl_serializer<scenery_proto>::from_json(const json& j, scenery_proto& f)
value = j[s];
};
- StringView atlas_name = j["atlas-name"];
+ StringView atlas_name = j["atlas-name"s];
fm_soft_assert(!atlas_name.isEmpty());
f = {};
f.atlas = loader.anim_atlas(atlas_name, loader_::SCENERY_PATH);
@@ -169,17 +170,17 @@ void adl_serializer<serialized_scenery>::to_json(json& j, const serialized_scene
fm_soft_assert(val.proto.atlas);
j = val.proto;
const auto name = !val.name.isEmpty() ? StringView{val.name} : val.proto.atlas->name();
- j["name"] = name;
- j["description"] = val.descr;
+ j["name"s] = name;
+ j["description"s] = val.descr;
}
void adl_serializer<serialized_scenery>::from_json(const json& j, serialized_scenery& val)
{
val = {};
val.proto = j;
- val.name = j["name"];
- if (j.contains("description"))
- val.descr = j["description"];
+ val.name = j["name"s];
+ if (j.contains("description"s))
+ val.descr = j["description"s];
}
} // namespace nlohmann