mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fix edge-case bug in layout's group size
This commit is contained in:
parent
d7fda2d598
commit
ce7bd9def7
@ -13,6 +13,7 @@
|
||||
## Fixes
|
||||
* **[Plugins]** Fix bug where changes to plugin options doesn't do anything.
|
||||
* **[Campaign Management]** Fix bug in procurement when no squadrons are present.
|
||||
* **[Layouts]** Fix edge-case bug layout's group size.
|
||||
|
||||
# Retribution v1.1.0
|
||||
|
||||
|
||||
@ -141,7 +141,7 @@ class Campaign:
|
||||
def load_ground_forces_config(self) -> TgoConfig:
|
||||
ground_forces = self.data.get("ground_forces", {})
|
||||
if not ground_forces:
|
||||
logging.warning(f"Campaign {self.name} does not define any squadrons")
|
||||
logging.warning(f"Campaign {self.name} does not define any ground_forces")
|
||||
return TgoConfig({})
|
||||
return TgoConfig.from_campaign_data(ground_forces)
|
||||
|
||||
|
||||
@ -137,11 +137,14 @@ class TgoLayoutUnitGroup:
|
||||
|
||||
@property
|
||||
def group_size(self) -> int:
|
||||
"""The amount of units to be generated. If unit_count is defined in the layout this will be randomized accordingly. Otherwise this will be the maximum size."""
|
||||
"""
|
||||
The amount of units to be generated. If unit_count is defined in the layout this will be
|
||||
randomized accordingly. Otherwise this will be the maximum size.
|
||||
"""
|
||||
if self.unit_count:
|
||||
if len(self.unit_count) == 1:
|
||||
return self.unit_count[0]
|
||||
return random.choice(range(min(self.unit_count), max(self.unit_count)))
|
||||
return random.choice(range(min(self.unit_count), max(self.unit_count) + 1))
|
||||
return self.max_size
|
||||
|
||||
@property
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user