Remove front line minimum distance.

This isn't what it says. It doesn't enforce a minimum distance between
points, but a minimum path length, which isn't useful and isn't a
documented requirement.

cherry-pick from c844c364
This commit is contained in:
MetalStormGhost
2022-01-02 23:34:01 +02:00
committed by RndName
parent d2eb98bcc5
commit dbe9691d9e
2 changed files with 4 additions and 21 deletions

View File

@@ -18,6 +18,7 @@ Saves from 5.0.0 are compatible with 5.1.0
* **[Mission Generation]** Fixed mission scripting error when using a dedicated server.
* **[Mission Generation]** Fixed an issue where empty convoys lead to an index error when a point capture made a pending transfer of units not completable anymore.
* **[Mission Generation]** Corrected Viggen FR22 & FR24 preset channels for the DCS 2.7.9 update
* **[Mission Generation]** Fixed an issue which prevented the mission generation if two controlpoints are really close to each other (e.g. Marianas campaigns)
* **[UI]** Enable / Disable the settings, save and stats actions if no game is loaded to prevent an error as these functions can only be used on a valid game.
# 5.0.0

View File

@@ -14,9 +14,6 @@ from .controlpoint import (
from ..utils import Heading, pairwise
FRONTLINE_MIN_CP_DISTANCE = 5000
@dataclass
class FrontLineSegment:
"""
@@ -172,23 +169,8 @@ class FrontLine(MissionTarget):
"""
total_strength = self.blue_cp.base.strength + self.red_cp.base.strength
if self.blue_cp.base.strength == 0:
return self._adjust_for_min_dist(0)
return 0
if self.red_cp.base.strength == 0:
return self._adjust_for_min_dist(self.attack_distance)
return self.attack_distance
strength_pct = self.blue_cp.base.strength / total_strength
return self._adjust_for_min_dist(strength_pct * self.attack_distance)
def _adjust_for_min_dist(self, distance: float) -> float:
"""
Ensures the frontline conflict is never located within the minimum distance
constant of either end control point.
"""
if (distance > self.attack_distance / 2) and (
distance + FRONTLINE_MIN_CP_DISTANCE > self.attack_distance
):
distance = self.attack_distance - FRONTLINE_MIN_CP_DISTANCE
elif (distance < self.attack_distance / 2) and (
distance < FRONTLINE_MIN_CP_DISTANCE
):
distance = FRONTLINE_MIN_CP_DISTANCE
return distance
return strength_pct * self.attack_distance