diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-11-08 12:05:15 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-11-08 12:05:15 +0100 |
commit | e70bd100853827b9bafb21103f78ebaa74a2af20 (patch) | |
tree | 5071853cf9774acc23be9b9da203148dd3a0c43c /serialize/scenery.cpp | |
parent | 0ab80a1322dd63ec30abc4170d69aa55a028a8fc (diff) |
apparently we can have nice things
Diffstat (limited to 'serialize/scenery.cpp')
-rw-r--r-- | serialize/scenery.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/serialize/scenery.cpp b/serialize/scenery.cpp index 820c67af..2994d778 100644 --- a/serialize/scenery.cpp +++ b/serialize/scenery.cpp @@ -13,7 +13,7 @@ namespace { using namespace floormat; -using namespace std::string_literals; +using namespace std::string_view_literals; constexpr struct { scenery_type value = scenery_type::none; @@ -86,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"s] = f.type; - j["atlas-name"s] = f.atlas->name(); + j["type"sv] = f.type; + j["atlas-name"sv] = f.atlas->name(); if (f.frame != default_scenery.frame) - j["frame"s] = f.frame; + j["frame"sv] = f.frame; if (f.r != default_scenery.r) - j["rotation"s] = f.r; + j["rotation"sv] = f.r; if (f.pass != default_scenery.pass) - j["pass-mode"s] = f.pass; + j["pass-mode"sv] = f.pass; if (f.active != default_scenery.active) - j["active"s] = f.active; + j["active"sv] = f.active; if (f.interactive != default_scenery.interactive) - j["interactive"s] = f.interactive; + j["interactive"sv] = f.interactive; if (f.offset != default_scenery.offset) - j["offset"s] = Vector2i(f.offset); + j["offset"sv] = Vector2i(f.offset); if (f.bbox_offset != default_scenery.bbox_offset) - j["bbox-offset"s] = Vector2i(f.bbox_offset); + j["bbox-offset"sv] = Vector2i(f.bbox_offset); if (f.bbox_size != default_scenery.bbox_size) - j["bbox-size"s] = Vector2ui(f.bbox_size); + j["bbox-size"sv] = Vector2ui(f.bbox_size); } void adl_serializer<scenery_proto>::from_json(const json& j, scenery_proto& f) @@ -115,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"s]; + StringView atlas_name = j["atlas-name"sv]; fm_soft_assert(!atlas_name.isEmpty()); f = {}; f.atlas = loader.anim_atlas(atlas_name, loader_::SCENERY_PATH); @@ -170,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"s] = name; - j["description"s] = val.descr; + j["name"sv] = name; + j["description"sv] = val.descr; } void adl_serializer<serialized_scenery>::from_json(const json& j, serialized_scenery& val) { val = {}; val.proto = j; - val.name = j["name"s]; - if (j.contains("description"s)) - val.descr = j["description"s]; + val.name = j["name"sv]; + if (j.contains("description"sv)) + val.descr = j["description"sv]; } } // namespace nlohmann |