Airlift support.

UI isn't finished. Bulk transfers where the player doesn't care what
aircraft get used work (though they're chosen with no thought at all),
but being able to plan your own airlift flight isn't here yet.

Cargo planes are not implemented yet.

No way to view the cargo of a flight (will come with the cargo flight
planning UI).

The airlift flight/package creation should probably be moved out of the
UI and into the game code.

AI doesn't use these yet.

https://github.com/Khopa/dcs_liberation/issues/825
This commit is contained in:
Dan Albert
2021-04-21 17:13:35 -07:00
parent 8e361a8776
commit 481f195725
12 changed files with 406 additions and 73 deletions

View File

@@ -22,8 +22,7 @@ from PySide2.QtWidgets import (
QVBoxLayout,
)
from game.theater.supplyroutes import SupplyRoute
from game.transfers import RoadTransferOrder
from game.transfers import TransferOrder
from qt_ui.delegate_helpers import painter_context
from qt_ui.models import GameModel, TransferModel
@@ -43,20 +42,14 @@ class TransferDelegate(QStyledItemDelegate):
return font
@staticmethod
def transfer(index: QModelIndex) -> RoadTransferOrder:
def transfer(index: QModelIndex) -> TransferOrder:
return index.data(TransferModel.TransferRole)
def first_row_text(self, index: QModelIndex) -> str:
return self.transfer_model.data(index, Qt.DisplayRole)
def second_row_text(self, index: QModelIndex) -> str:
transfer = self.transfer(index)
path = transfer.path()
if len(path) == 1:
turns = "1 turn"
else:
turns = f"{len(path)} turns"
return f"Currently at {transfer.position}. Arrives at destination in {turns}."
return self.transfer(index).description
def paint(
self, painter: QPainter, option: QStyleOptionViewItem, index: QModelIndex