Automate transfers from factories.

The purchase system will seek out a source for its units when the
purchase is completed. If no source is available the order will be
refunded. Orders with no source available are prevented, so this only
happens when the source was cut off from the destination during the
turn.

There's still some funkiness going on with the first turn (but possibly
only when the first turn includes a cheat to capture) where the AI buys
a ton of units somewhere other than the front line. First turn behavior
should probably be different anyway, with the first turn allowing
purchases anywhere to avoid empty front lines while troops reinforce if
the front line isn't a factory.

https://github.com/Khopa/dcs_liberation/issues/986
This commit is contained in:
Dan Albert
2021-04-18 23:11:26 -07:00
parent 627f18c42b
commit 56fc2986e9
4 changed files with 155 additions and 38 deletions

View File

@@ -34,7 +34,7 @@ from .settings import Settings
from .theater import ConflictTheater, ControlPoint, TheaterGroundObject
from game.theater.theatergroundobject import MissileSiteGroundObject
from .threatzones import ThreatZones
from .transfers import PendingTransfers
from .transfers import PendingTransfers, RoadTransferOrder
from .unitmap import UnitMap
from .weather import Conditions, TimeOfDay
@@ -272,11 +272,13 @@ class Game:
)
self.turn += 1
# Must happen *before* unit deliveries are handled, or else new units will spawn
# one hop ahead. ControlPoint.process_turn handles unit deliveries.
self.transfers.perform_transfers()
for control_point in self.theater.controlpoints:
control_point.process_turn(self)
self.transfers.perform_transfers()
self.process_enemy_income()
self.process_player_income()