set_save adjustments for older DB savegames

This commit is contained in:
Berserker66 2020-07-22 12:02:09 +02:00
parent 78c85cce14
commit 35e2b2d20d
1 changed files with 7 additions and 3 deletions

View File

@ -212,11 +212,15 @@ class Context(Node):
def set_save(self, savedata: dict):
rom_names = savedata["rom_names"] # convert from TrackerList to List in case of ponyorm
if {rom: other for rom, other in rom_names} != self.rom_names:
adjusted = {rom: (team, slot) for (rom, (team, slot)) in rom_names} # old format, ponyorm friendly
try:
adjusted = {rom: other for rom, other in rom_names}
except TypeError:
adjusted = {tuple(rom): (team, slot) for (rom, (team, slot)) in rom_names} # old format, ponyorm friendly
if self.rom_names != adjusted:
logging.warning('Save file mismatch, will start a new game')
else:
if adjusted != self.rom_names:
logging.warning('Save file mismatch, will start a new game')
return
received_items = {tuple(k): [ReceivedItem(*i) for i in v] for k, v in savedata["received_items"]}