mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
We estimate the longest possible time from mission start to TOT for all flights in a package and use that to set the TOT (plus any delay used to stagger flights). This both cuts down on loiter time for shorter flights and ensures that long flights will make it to the target in time. This is also used to compute the start time for the AI, so the explicit delay option is no longer needed.
29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
import datetime
|
|
|
|
from PySide2.QtGui import QStandardItem, QIcon
|
|
|
|
from game import db
|
|
from gen.ato import Package
|
|
from gen.flights.flight import Flight
|
|
from gen.flights.traveltime import TotEstimator
|
|
from qt_ui.uiconstants import AIRCRAFT_ICONS
|
|
|
|
|
|
# TODO: Replace with QFlightList.
|
|
class QFlightItem(QStandardItem):
|
|
|
|
def __init__(self, package: Package, flight: Flight):
|
|
super(QFlightItem, self).__init__()
|
|
self.package = package
|
|
self.flight = flight
|
|
|
|
if db.unit_type_name(self.flight.unit_type).replace("/", " ") in AIRCRAFT_ICONS.keys():
|
|
icon = QIcon((AIRCRAFT_ICONS[db.unit_type_name(self.flight.unit_type)]))
|
|
self.setIcon(icon)
|
|
self.setEditable(False)
|
|
estimator = TotEstimator(self.package)
|
|
delay = datetime.timedelta(seconds=estimator.mission_start_time(flight))
|
|
self.setText("["+str(self.flight.flight_type.name[:6])+"] "
|
|
+ str(self.flight.count) + " x " + db.unit_type_name(self.flight.unit_type)
|
|
+ " in " + str(delay))
|