mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
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:
@@ -35,7 +35,6 @@ from game.radio.channels import (
|
||||
ViperChannelNamer,
|
||||
WarthogChannelNamer,
|
||||
)
|
||||
from game.savecompat import has_save_compat_for
|
||||
from game.utils import (
|
||||
Distance,
|
||||
ImperialUnits,
|
||||
@@ -348,12 +347,7 @@ class AircraftType(UnitType[Type[FlyingType]]):
|
||||
def task_priority(self, task: FlightType) -> int:
|
||||
return self.task_priorities[task]
|
||||
|
||||
@has_save_compat_for(9)
|
||||
def __setstate__(self, state: dict[str, Any]) -> None:
|
||||
# Save compat: the `name` field has been renamed `variant_id`.
|
||||
if "name" in state:
|
||||
state["variant_id"] = state.pop("name")
|
||||
|
||||
# Update any existing models with new data on load.
|
||||
updated = AircraftType.named(state["variant_id"])
|
||||
state.update(updated.__dict__)
|
||||
|
||||
@@ -11,7 +11,6 @@ from dcs.vehicles import vehicle_map
|
||||
|
||||
from game.data.units import UnitClass
|
||||
from game.dcs.unittype import UnitType
|
||||
from game.savecompat import has_save_compat_for
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -65,12 +64,7 @@ class GroundUnitType(UnitType[Type[VehicleType]]):
|
||||
dict[type[VehicleType], list[GroundUnitType]]
|
||||
] = defaultdict(list)
|
||||
|
||||
@has_save_compat_for(9)
|
||||
def __setstate__(self, state: dict[str, Any]) -> None:
|
||||
# Save compat: the `name` field has been renamed `variant_id`.
|
||||
if "name" in state:
|
||||
state["variant_id"] = state.pop("name")
|
||||
|
||||
# Update any existing models with new data on load.
|
||||
updated = GroundUnitType.named(state["variant_id"])
|
||||
state.update(updated.__dict__)
|
||||
|
||||
@@ -10,7 +10,6 @@ from dcs.unittype import ShipType
|
||||
|
||||
from game.data.units import UnitClass
|
||||
from game.dcs.unittype import UnitType
|
||||
from game.savecompat import has_save_compat_for
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -20,12 +19,7 @@ class ShipUnitType(UnitType[Type[ShipType]]):
|
||||
list
|
||||
)
|
||||
|
||||
@has_save_compat_for(9)
|
||||
def __setstate__(self, state: dict[str, Any]) -> None:
|
||||
# Save compat: the `name` field has been renamed `variant_id`.
|
||||
if "name" in state:
|
||||
state["variant_id"] = state.pop("name")
|
||||
|
||||
# Update any existing models with new data on load.
|
||||
updated = ShipUnitType.named(state["variant_id"])
|
||||
state.update(updated.__dict__)
|
||||
|
||||
Reference in New Issue
Block a user