Drop save compat hacks.

The CAS flight plan tweaks break save compat in a way that's not as easy
to fix. Accept it and drop the existing hacks since they won't be useful
any more.
This commit is contained in:
Dan Albert
2023-08-10 00:33:38 -07:00
parent cb3bf56d84
commit 3f0b565b82
6 changed files with 1 additions and 40 deletions

View File

@@ -12,7 +12,6 @@ from .flightmembers import FlightMembers
from .flightroster import FlightRoster
from .flightstate import FlightState, Navigating, Uninitialized
from .flightstate.killed import Killed
from ..savecompat import has_save_compat_for
from ..sidc import (
Entity,
SidcDescribable,
@@ -108,14 +107,9 @@ class Flight(SidcDescribable):
del state["state"]
return state
@has_save_compat_for(9)
def __setstate__(self, state: dict[str, Any]) -> None:
state["state"] = Uninitialized(self, state["squadron"].settings)
if "use_same_loadout_for_all_members" not in state:
state["use_same_loadout_for_all_members"] = True
self.__dict__.update(state)
if isinstance(self.roster, FlightRoster):
self.roster = FlightMembers.from_roster(self, self.roster)
@property
def blue(self) -> bool:

View File

@@ -1,10 +1,9 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING
from game.ato.loadouts import Loadout
from game.lasercodes import LaserCode
from game.savecompat import has_save_compat_for
if TYPE_CHECKING:
from game.squadrons import Pilot
@@ -19,14 +18,6 @@ class FlightMember:
self.weapon_laser_code: LaserCode | None = None
self.properties: dict[str, bool | float | int] = {}
@has_save_compat_for(9)
def __setstate__(self, state: dict[str, Any]) -> None:
if "tgp_laser_code" not in state:
state["tgp_laser_code"] = None
if "weapon_laser_code" not in state:
state["weapon_laser_code"] = None
self.__dict__.update(state)
def assign_tgp_laser_code(self, code: LaserCode) -> None:
if self.tgp_laser_code is not None:
raise RuntimeError(