From 412e3b43a7bae9a288b7bad03d7b092bbd1ec455 Mon Sep 17 00:00:00 2001 From: Joe R Date: Tue, 1 Jun 2021 18:50:03 -0400 Subject: [PATCH] Fix for conflict in random number sources when restarting loaded game. --- pysollib/game/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pysollib/game/__init__.py b/pysollib/game/__init__.py index 57ef56c8..9d7ae26a 100644 --- a/pysollib/game/__init__.py +++ b/pysollib/game/__init__.py @@ -1966,8 +1966,8 @@ class Game(object): def changed(self, restart=False): if self.gstats.updated < 0: return 0 # already won or lost - if self.gstats.loaded > 0: - return 0 # loaded games account for no stats + # if self.gstats.loaded > 0: + # return 0 # loaded games account for no stats if not restart: if self.gstats.restarted > 0: return 1 # game was restarted - always ask @@ -3263,7 +3263,8 @@ class Game(object): initial_seed = random__int2str(pload(int)) game.random = construct_random(initial_seed) state = pload() - if not (isinstance(game.random, random2.Random) and + if (game.random is not None and + not isinstance(game.random, random2.Random) and isinstance(state, int)): game.random.setstate(state) # if not hasattr(game.random, "origin"):