mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fix type of default map visibility setting.
The UI sets these to the proper enum types; only the default is wrong. Fix the default and clean up the associated code. Note that this does minorly break save compatibility and alters default behavior, since previously we were ignoring the default option. Ignoring the default looks unintentional since there is no explicit "don't force this option" setting in the UI. Existing saves can be fixed simply by changing this option to something else and then back.
This commit is contained in:
parent
29d3b5dfc6
commit
2557383946
@ -1,6 +1,8 @@
|
|||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Dict, Optional
|
from typing import Dict, Optional
|
||||||
|
|
||||||
|
from dcs.forcedoptions import ForcedOptions
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Settings:
|
class Settings:
|
||||||
@ -15,7 +17,7 @@ class Settings:
|
|||||||
player_skill: str = "Good"
|
player_skill: str = "Good"
|
||||||
enemy_skill: str = "Average"
|
enemy_skill: str = "Average"
|
||||||
enemy_vehicle_skill: str = "Average"
|
enemy_vehicle_skill: str = "Average"
|
||||||
map_coalition_visibility: str = "All Units"
|
map_coalition_visibility: ForcedOptions.Views = ForcedOptions.Views.All
|
||||||
labels: str = "Full"
|
labels: str = "Full"
|
||||||
only_player_takeoff: bool = True # Legacy parameter do not use
|
only_player_takeoff: bool = True # Legacy parameter do not use
|
||||||
night_disabled: bool = False
|
night_disabled: bool = False
|
||||||
|
|||||||
@ -1,17 +1,14 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
from enum import IntEnum
|
from enum import IntEnum
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from dcs.mission import Mission
|
from dcs.mission import Mission
|
||||||
from dcs.forcedoptions import ForcedOptions
|
|
||||||
|
|
||||||
from .conflictgen import *
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from game.game import Game
|
from game.game import Game
|
||||||
|
|
||||||
|
|
||||||
class Labels(IntEnum):
|
class Labels(IntEnum):
|
||||||
Off = 0
|
Off = 0
|
||||||
Full = 1
|
Full = 1
|
||||||
@ -20,28 +17,18 @@ class Labels(IntEnum):
|
|||||||
|
|
||||||
|
|
||||||
class ForcedOptionsGenerator:
|
class ForcedOptionsGenerator:
|
||||||
def __init__(self, mission: Mission, game: Game):
|
def __init__(self, mission: Mission, game: Game) -> None:
|
||||||
self.mission = mission
|
self.mission = mission
|
||||||
self.game = game
|
self.game = game
|
||||||
|
|
||||||
def _set_options_view(self):
|
def _set_options_view(self) -> None:
|
||||||
|
self.mission.forced_options.options_view = self.game.settings.map_coalition_visibility
|
||||||
|
|
||||||
if self.game.settings.map_coalition_visibility == ForcedOptions.Views.All:
|
def _set_external_views(self) -> None:
|
||||||
self.mission.forced_options.options_view = ForcedOptions.Views.All
|
|
||||||
elif self.game.settings.map_coalition_visibility == ForcedOptions.Views.Allies:
|
|
||||||
self.mission.forced_options.options_view = ForcedOptions.Views.Allies
|
|
||||||
elif self.game.settings.map_coalition_visibility == ForcedOptions.Views.OnlyAllies:
|
|
||||||
self.mission.forced_options.options_view = ForcedOptions.Views.OnlyAllies
|
|
||||||
elif self.game.settings.map_coalition_visibility == ForcedOptions.Views.MyAircraft:
|
|
||||||
self.mission.forced_options.options_view = ForcedOptions.Views.MyAircraft
|
|
||||||
elif self.game.settings.map_coalition_visibility == ForcedOptions.Views.OnlyMap:
|
|
||||||
self.mission.forced_options.options_view = ForcedOptions.Views.OnlyMap
|
|
||||||
|
|
||||||
def _set_external_views(self):
|
|
||||||
if not self.game.settings.external_views_allowed:
|
if not self.game.settings.external_views_allowed:
|
||||||
self.mission.forced_options.external_views = self.game.settings.external_views_allowed
|
self.mission.forced_options.external_views = self.game.settings.external_views_allowed
|
||||||
|
|
||||||
def _set_labels(self):
|
def _set_labels(self) -> None:
|
||||||
if self.game.settings.labels == "Abbreviated":
|
if self.game.settings.labels == "Abbreviated":
|
||||||
self.mission.forced_options.labels = int(Labels.Abbreviated)
|
self.mission.forced_options.labels = int(Labels.Abbreviated)
|
||||||
elif self.game.settings.labels == "Dot Only":
|
elif self.game.settings.labels == "Dot Only":
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user