Add option to limit squadron sizes and begin full.

Adding temporarily as an option to make sure it's not a terrible idea,
but the old mode will probably go away.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1583.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2808.
This commit is contained in:
Dan Albert
2023-05-05 18:02:23 -07:00
committed by Raffson
parent f719e1cfe7
commit 5c07a2556e
15 changed files with 138 additions and 24 deletions

View File

@@ -294,7 +294,7 @@ class Game:
if self.turn > 1:
self.conditions = self.generate_conditions()
def begin_turn_0(self) -> None:
def begin_turn_0(self, squadrons_start_full: bool) -> None:
"""Initialization for the first turn of the game."""
from .sim import GameUpdateEvents
@@ -319,8 +319,9 @@ class Game:
# Rotate the whole TGO with the new heading
tgo.rotate(heading or tgo.heading)
self.blue.preinit_turn_0()
self.red.preinit_turn_0()
self.blue.preinit_turn_0(squadrons_start_full)
self.red.preinit_turn_0(squadrons_start_full)
# TODO: Check for overfull bases.
# We don't need to actually stream events for turn zero because we haven't given
# *any* state to the UI yet, so it will need to do a full draw once we do.
self.initialize_turn(GameUpdateEvents())
@@ -365,7 +366,10 @@ class Game:
self.red.bullseye = Bullseye(player_cp.position)
def initialize_turn(
self, events: GameUpdateEvents, for_red: bool = True, for_blue: bool = True
self,
events: GameUpdateEvents,
for_red: bool = True,
for_blue: bool = True,
) -> None:
"""Performs turn initialization for the specified players.
@@ -418,9 +422,9 @@ class Game:
# Plan Coalition specific turn
if for_blue:
self.blue.initialize_turn()
self.blue.initialize_turn(self.turn == 0)
if for_red:
self.red.initialize_turn()
self.red.initialize_turn(self.turn == 0)
# Plan GroundWar
self.ground_planners = {}