mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Don't allow operating on broken runways.
Doesn't allow helos or harriers to do it either even though they should be able to because we don't currently support ground spawns, which would be needed to prevent those aircraft from using the runway. Even then, I don't know if they can be forced to *land* vertically. Fixes https://github.com/Khopa/dcs_liberation/issues/432
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
"""Combo box for selecting aircraft types."""
|
||||
from typing import Iterable
|
||||
from typing import Iterable, Type
|
||||
|
||||
from PySide2.QtWidgets import QComboBox
|
||||
|
||||
@@ -9,7 +9,7 @@ from dcs.unittype import FlyingType
|
||||
class QAircraftTypeSelector(QComboBox):
|
||||
"""Combo box for selecting among the given aircraft types."""
|
||||
|
||||
def __init__(self, aircraft_types: Iterable[FlyingType]) -> None:
|
||||
def __init__(self, aircraft_types: Iterable[Type[FlyingType]]) -> None:
|
||||
super().__init__()
|
||||
for aircraft in aircraft_types:
|
||||
self.addItem(f"{aircraft.id}", userData=aircraft)
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
"""Combo box for selecting a departure airfield."""
|
||||
from typing import Iterable
|
||||
from typing import Iterable, Type
|
||||
|
||||
from PySide2.QtWidgets import QComboBox
|
||||
from dcs.unittype import FlyingType
|
||||
|
||||
from game import db
|
||||
from game.theater.controlpoint import ControlPoint
|
||||
|
||||
|
||||
@@ -16,7 +15,7 @@ class QArrivalAirfieldSelector(QComboBox):
|
||||
"""
|
||||
|
||||
def __init__(self, destinations: Iterable[ControlPoint],
|
||||
aircraft: FlyingType, optional_text: str) -> None:
|
||||
aircraft: Type[FlyingType], optional_text: str) -> None:
|
||||
super().__init__()
|
||||
self.destinations = list(destinations)
|
||||
self.aircraft = aircraft
|
||||
@@ -33,7 +32,7 @@ class QArrivalAirfieldSelector(QComboBox):
|
||||
def rebuild_selector(self) -> None:
|
||||
self.clear()
|
||||
for destination in self.destinations:
|
||||
if destination.can_land(self.aircraft):
|
||||
if destination.can_operate(self.aircraft):
|
||||
self.addItem(destination.name, destination)
|
||||
self.model().sort(0)
|
||||
self.insertItem(0, self.optional_text, None)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""Combo box for selecting a departure airfield."""
|
||||
from typing import Iterable
|
||||
from typing import Iterable, Type
|
||||
|
||||
from PySide2.QtCore import Signal
|
||||
from PySide2.QtWidgets import QComboBox
|
||||
@@ -20,7 +20,7 @@ class QOriginAirfieldSelector(QComboBox):
|
||||
|
||||
def __init__(self, global_inventory: GlobalAircraftInventory,
|
||||
origins: Iterable[ControlPoint],
|
||||
aircraft: FlyingType) -> None:
|
||||
aircraft: Type[FlyingType]) -> None:
|
||||
super().__init__()
|
||||
self.global_inventory = global_inventory
|
||||
self.origins = list(origins)
|
||||
@@ -37,12 +37,14 @@ class QOriginAirfieldSelector(QComboBox):
|
||||
def rebuild_selector(self) -> None:
|
||||
self.clear()
|
||||
for origin in self.origins:
|
||||
if not origin.can_operate(self.aircraft):
|
||||
continue
|
||||
|
||||
inventory = self.global_inventory.for_control_point(origin)
|
||||
available = inventory.available(self.aircraft)
|
||||
if available:
|
||||
self.addItem(f"{origin.name} ({available} available)", origin)
|
||||
self.model().sort(0)
|
||||
self.update()
|
||||
|
||||
@property
|
||||
def available(self) -> int:
|
||||
|
||||
@@ -33,7 +33,7 @@ class QMapControlPoint(QMapObject):
|
||||
painter.setBrush(self.brush_color)
|
||||
painter.setPen(self.pen_color)
|
||||
|
||||
if not self.control_point.has_runway():
|
||||
if not self.control_point.runway_is_operational():
|
||||
painter.setBrush(const.COLORS["black"])
|
||||
painter.setPen(self.brush_color)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user