mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Remove save compat hacks for saves from 7.
Save compat was broken by pydcs anyway, so these now do nothing but hide initialization bugs.
This commit is contained in:
parent
001e7dfed9
commit
59c10f5d71
@ -21,7 +21,6 @@ from .planningerror import PlanningError
|
|||||||
from ..flightwaypointtype import FlightWaypointType
|
from ..flightwaypointtype import FlightWaypointType
|
||||||
from ..starttype import StartType
|
from ..starttype import StartType
|
||||||
from ..traveltime import GroundSpeed, TravelTime
|
from ..traveltime import GroundSpeed, TravelTime
|
||||||
from ...savecompat import has_save_compat_for
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from game.dcs.aircrafttype import FuelConsumption
|
from game.dcs.aircrafttype import FuelConsumption
|
||||||
@ -65,12 +64,6 @@ class FlightPlan(ABC, Generic[LayoutT]):
|
|||||||
self.layout = layout
|
self.layout = layout
|
||||||
self.tot_offset = self.default_tot_offset()
|
self.tot_offset = self.default_tot_offset()
|
||||||
|
|
||||||
@has_save_compat_for(7)
|
|
||||||
def __setstate__(self, state: dict[str, Any]) -> None:
|
|
||||||
if "tot_offset" not in state:
|
|
||||||
state["tot_offset"] = self.default_tot_offset()
|
|
||||||
self.__dict__.update(state)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def package(self) -> Package:
|
def package(self) -> Package:
|
||||||
return self.flight.package
|
return self.flight.package
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import random
|
|||||||
from collections.abc import Iterable
|
from collections.abc import Iterable
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Optional, Sequence, TYPE_CHECKING, Any
|
from typing import Optional, Sequence, TYPE_CHECKING
|
||||||
from uuid import uuid4, UUID
|
from uuid import uuid4, UUID
|
||||||
|
|
||||||
from faker import Faker
|
from faker import Faker
|
||||||
@ -14,7 +14,6 @@ from game.ato import Flight, FlightType, Package
|
|||||||
from game.settings import AutoAtoBehavior, Settings
|
from game.settings import AutoAtoBehavior, Settings
|
||||||
from .pilot import Pilot, PilotStatus
|
from .pilot import Pilot, PilotStatus
|
||||||
from ..db.database import Database
|
from ..db.database import Database
|
||||||
from ..savecompat import has_save_compat_for
|
|
||||||
from ..utils import meters
|
from ..utils import meters
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -65,12 +64,6 @@ class Squadron:
|
|||||||
untasked_aircraft: int = field(init=False, hash=False, compare=False, default=0)
|
untasked_aircraft: int = field(init=False, hash=False, compare=False, default=0)
|
||||||
pending_deliveries: int = field(init=False, hash=False, compare=False, default=0)
|
pending_deliveries: int = field(init=False, hash=False, compare=False, default=0)
|
||||||
|
|
||||||
@has_save_compat_for(7)
|
|
||||||
def __setstate__(self, state: dict[str, Any]) -> None:
|
|
||||||
if "id" not in state:
|
|
||||||
state["id"] = uuid4()
|
|
||||||
self.__dict__.update(state)
|
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
if self.nickname is None:
|
if self.nickname is None:
|
||||||
return self.name
|
return self.name
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user