Wrap json loaded in revertible objects.

This is intended to improve compatibility with older games that might
use .iteritems and similar methods.
This commit is contained in:
Tom Rothamel
2025-02-12 23:21:48 -05:00
parent 6c948bf046
commit 8a21aa55dc
+10 -1
View File
@@ -898,6 +898,15 @@ def cycle_saves(name, count):
unknown = renpy.object.Sentinel("unknown")
def wrap_json(d):
if isinstance(d, list):
return [ wrap_json(i) for i in d ]
if isinstance(d, dict):
return renpy.revertable.RevertableDict({ k : wrap_json(v) for k, v in d.items() })
else:
return d
class Cache(object):
"""
This represents cached information about a save slot.
@@ -933,7 +942,7 @@ class Cache(object):
if rv is unknown:
rv = self.json = location.json(self.slotname)
return rv
return wrap_json(rv)
def get_screenshot(self):