mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Convert TOTs to datetime.
https://github.com/dcs-liberation/dcs_liberation/issues/1680
This commit is contained in:
@@ -2,6 +2,7 @@ from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from collections import defaultdict
|
||||
from datetime import datetime
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
|
||||
from game.theater import ControlPoint
|
||||
@@ -52,7 +53,7 @@ class GroundUnitOrders:
|
||||
pending_units = 0
|
||||
return pending_units
|
||||
|
||||
def process(self, game: Game) -> None:
|
||||
def process(self, game: Game, now: datetime) -> None:
|
||||
coalition = game.coalition_for(self.destination.captured)
|
||||
ground_unit_source = self.find_ground_unit_source(game)
|
||||
if ground_unit_source is None:
|
||||
@@ -95,15 +96,20 @@ class GroundUnitOrders:
|
||||
"still tried to transfer units to there"
|
||||
)
|
||||
ground_unit_source.base.commission_units(units_needing_transfer)
|
||||
self.create_transfer(coalition, ground_unit_source, units_needing_transfer)
|
||||
self.create_transfer(
|
||||
coalition, ground_unit_source, units_needing_transfer, now
|
||||
)
|
||||
|
||||
def create_transfer(
|
||||
self,
|
||||
coalition: Coalition,
|
||||
source: ControlPoint,
|
||||
units: dict[GroundUnitType, int],
|
||||
now: datetime,
|
||||
) -> None:
|
||||
coalition.transfers.new_transfer(TransferOrder(source, self.destination, units))
|
||||
coalition.transfers.new_transfer(
|
||||
TransferOrder(source, self.destination, units), now
|
||||
)
|
||||
|
||||
def find_ground_unit_source(self, game: Game) -> Optional[ControlPoint]:
|
||||
# This is running *after* the turn counter has been incremented, so this is the
|
||||
|
||||
Reference in New Issue
Block a user