diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-01-23 15:17:53 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-01-23 15:17:53 +0100 |
commit | 045ae230340b664dd6f5df37142d5ca89b50c9b6 (patch) | |
tree | c76a0f985b0aa30f7462c85f1e20c2d8595cef2c /serialize/savegame.cpp | |
parent | c554cdbc0cf894ccc6c330e0743649a4bdb34658 (diff) |
c
Diffstat (limited to 'serialize/savegame.cpp')
-rw-r--r-- | serialize/savegame.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/serialize/savegame.cpp b/serialize/savegame.cpp index a71118e8..10febf0a 100644 --- a/serialize/savegame.cpp +++ b/serialize/savegame.cpp @@ -221,6 +221,12 @@ struct visitor_ setter(obj, flags & bits); } + enum object_flags : uint8_t { + flag_active = 1 << 0, + flag_closing = 1 << 1, + flag_interactive = 1 << 2, + }; + template<typename F> void visit(generic_scenery& s, F&& f) { constexpr struct { @@ -228,11 +234,11 @@ struct visitor_ bool(*getter)(const generic_scenery&); void(*setter)(generic_scenery&, bool); } pairs[] = { - { 1 << 0, + { flag_active, [](const auto& sc) { return !!sc.active; }, [](auto& sc, bool value) { sc.active = value; } }, - { 1 << 2, + { flag_interactive, [](const auto& sc) { return !!sc.interactive; }, [](auto& sc, bool value) { sc.interactive = value; } }, @@ -253,15 +259,15 @@ struct visitor_ bool(*getter)(const door_scenery&); void(*setter)(door_scenery&, bool); } pairs[] = { - { 1 << 0, + { flag_active, [](const auto& sc) { return !!sc.active; }, [](auto& sc, bool value) { sc.active = value; } }, - { 1 << 1, + { flag_closing, [](const auto& sc) { return !!sc.closing; }, [](auto& sc, bool value) { sc.closing = value; } }, - { 1 << 2, + { flag_interactive, [](const auto& sc) { return !!sc.interactive; }, [](auto& sc, bool value) { sc.interactive = value; } }, |