From b83f0bb15cf60f018bded68920a423e6918c1d6f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 9 Apr 2024 20:08:46 +0200 Subject: serialize/save: rewrite to remove scenery's variant Now it can use inheritance. Tests pass. --- serialize/savegame.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'serialize') diff --git a/serialize/savegame.cpp b/serialize/savegame.cpp index 5808dc65..29766269 100644 --- a/serialize/savegame.cpp +++ b/serialize/savegame.cpp @@ -222,11 +222,14 @@ struct visitor_ visit(obj.delta, f); else { - fm_assert(IsWriter); - auto delta_ = uint16_t(obj.delta >> 16); - visit(delta_, f); - if constexpr(IsWriter) + if constexpr(!IsWriter) + { + auto delta_ = uint16_t(obj.delta >> 16); + visit(delta_, f); non_const_(obj.delta) = delta_ * 65536u; + } + else + fm_assert(false); } visit(obj.frame, f); visit(obj.r, f); -- cgit v1.2.3