diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-12-02 14:44:32 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-12-02 14:46:59 +0100 |
commit | 889d2c0c0933cf2fd9e068b1d2b79eb936b29b58 (patch) | |
tree | cfc5f5b6e417c28482734645a69e0d49388fa5b3 /serialize/scenery.cpp | |
parent | 8dbf450e34121358992e48212ae22cb7f5fc92f9 (diff) |
src, serialize: work on pass mode
1. add one more value to the enum
2. serialize it properly in binary
3. serialize it as string in json
Diffstat (limited to 'serialize/scenery.cpp')
-rw-r--r-- | serialize/scenery.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/serialize/scenery.cpp b/serialize/scenery.cpp index 7b402945..ccc80270 100644 --- a/serialize/scenery.cpp +++ b/serialize/scenery.cpp @@ -4,6 +4,7 @@ #include "loader/loader.hpp" #include "serialize/corrade-string.hpp" #include "loader/scenery.hpp" +#include "serialize/pass-mode.hpp" #include <Corrade/Containers/StringStlView.h> #include <nlohmann/json.hpp> @@ -85,8 +86,7 @@ void adl_serializer<scenery_proto>::to_json(json& j, const scenery_proto& val) j["atlas-name"] = val.atlas->name(); j["frame"] = f.frame; j["rotation"] = f.r; - j["passable"] = f.passable; - j["blocks-view"] = f.blocks_view; + j["pass-mode"] = f.passability; j["active"] = f.active; j["interactive"] = f.interactive; } @@ -108,17 +108,16 @@ void adl_serializer<scenery_proto>::from_json(const json& j, scenery_proto& val) auto type = scenery_type::generic; get("type", type); auto r = val.atlas->first_rotation(); get("rotation", r); - auto frame = f.frame; get("frame", frame); - bool passable = f.passable; get("passable", passable); - bool blocks_view = f.blocks_view; get("blocks-view", blocks_view); - bool active = f.active; get("active", active); + auto frame = f.frame; get("frame", frame); + pass_mode pass = f.passability; get("pass-mode", pass); + bool active = f.active; get("active", active); switch (type) { default: fm_abort("unhandled scenery type '%u'", (unsigned)type); case scenery_type::generic: - f = { scenery::generic, *val.atlas, r, frame, passable, blocks_view, active }; + f = { scenery::generic, *val.atlas, r, frame, pass, active }; break; case scenery_type::door: f = { scenery::door, *val.atlas, r, false }; |