mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Save-compat improvements
This commit is contained in:
parent
4c9dba2fe5
commit
807bb16ddf
@ -199,8 +199,14 @@ class Migrator:
|
||||
for c in self.game.coalitions:
|
||||
if isinstance(c.faction.country, str):
|
||||
c.faction.country = countries_by_name[c.faction.country]()
|
||||
if isinstance(c.faction.aircraft, list):
|
||||
if getattr(c.faction, "aircraft", None) and isinstance(
|
||||
c.faction.aircraft, list
|
||||
):
|
||||
c.faction.aircraft = set(c.faction.aircraft)
|
||||
elif getattr(c.faction, "aircrafts", None) and isinstance(
|
||||
c.faction.aircrafts, list
|
||||
):
|
||||
c.faction.aircraft = set(c.faction.aircrafts)
|
||||
if isinstance(c.faction.awacs, list):
|
||||
c.faction.awacs = set(c.faction.awacs)
|
||||
if isinstance(c.faction.tankers, list):
|
||||
|
||||
@ -120,6 +120,13 @@ class MigrationUnpickler(pickle.Unpickler):
|
||||
except AttributeError:
|
||||
alternate = name.split('.')[:-1] + [name.split('.')[-1][0].lower() + name.split('.')[-1][1:]]
|
||||
name = '.'.join(alternate)
|
||||
try:
|
||||
return super().find_class(module, name)
|
||||
except AttributeError:
|
||||
if "dcs.terrain" in module and "airports" not in module:
|
||||
module = f"{module}.airports"
|
||||
else:
|
||||
raise
|
||||
return super().find_class(module, name)
|
||||
# fmt: on
|
||||
|
||||
|
||||
@ -368,7 +368,8 @@ class QLiberationWindow(QMainWindow):
|
||||
try:
|
||||
Migrator(game, is_liberation)
|
||||
return game
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
logging.exception(e)
|
||||
self.incompatible_save_popup(path)
|
||||
else:
|
||||
self.incompatible_save_popup(path)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user