From 92f2d5f6028a34d3d6e9879ad51374a3fb1ce770 Mon Sep 17 00:00:00 2001 From: lufebe16 Date: Fri, 27 Sep 2019 11:24:03 +0200 Subject: [PATCH] fixed2: allow game restore to accept older storage format. --- pysollib/game/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pysollib/game/__init__.py b/pysollib/game/__init__.py index f2865449..129b81d5 100644 --- a/pysollib/game/__init__.py +++ b/pysollib/game/__init__.py @@ -3135,7 +3135,14 @@ class Game(object): def pload(t=None, p=p): obj = p.load() if isinstance(t, type): - assert isinstance(obj, t), err_txt + if not isinstance(obj, t): + # accept old storage format in case: + if (t == GameMoves + or t == GameGlobalStatsStruct + or t == GameStatsStruct): + assert isinstance(obj, Struct), err_txt + else: + assert False, err_txt return obj def validate(v, txt):