mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Remove error handling for impossible case.
This commit is contained in:
parent
459c8d02f9
commit
ac49772584
@ -1,6 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import math
|
||||
import random
|
||||
from typing import List, Optional, TYPE_CHECKING, Tuple
|
||||
@ -203,9 +202,6 @@ class FlotGenerator:
|
||||
forward_heading,
|
||||
self.conflict.theater,
|
||||
)
|
||||
if not infantry_position:
|
||||
logging.warning("Could not find infantry position")
|
||||
return
|
||||
|
||||
faction = self.game.faction_for(is_player)
|
||||
|
||||
@ -691,7 +687,7 @@ class FlotGenerator:
|
||||
|
||||
def get_valid_position_for_group(
|
||||
self, distance_from_frontline: int, spawn_heading: Heading
|
||||
) -> Point | None:
|
||||
) -> Point:
|
||||
assert self.conflict.heading is not None
|
||||
assert self.conflict.size is not None
|
||||
shifted = self.conflict.position.point_from_heading(
|
||||
@ -733,30 +729,27 @@ class FlotGenerator:
|
||||
distance_from_frontline, spawn_heading
|
||||
)
|
||||
|
||||
if final_position is not None:
|
||||
g = self._generate_group(
|
||||
g = self._generate_group(
|
||||
is_player,
|
||||
self.mission.country(country),
|
||||
group.unit_type,
|
||||
group.size,
|
||||
final_position,
|
||||
heading=spawn_heading.opposite,
|
||||
)
|
||||
if is_player:
|
||||
g.set_skill(Skill(self.game.settings.player_skill))
|
||||
else:
|
||||
g.set_skill(Skill(self.game.settings.enemy_vehicle_skill))
|
||||
positioned_groups.append((g, group))
|
||||
|
||||
if group.role in [CombatGroupRole.APC, CombatGroupRole.IFV]:
|
||||
self.gen_infantry_group_for_group(
|
||||
g,
|
||||
is_player,
|
||||
self.mission.country(country),
|
||||
group.unit_type,
|
||||
group.size,
|
||||
final_position,
|
||||
heading=spawn_heading.opposite,
|
||||
spawn_heading.opposite,
|
||||
)
|
||||
if is_player:
|
||||
g.set_skill(Skill(self.game.settings.player_skill))
|
||||
else:
|
||||
g.set_skill(Skill(self.game.settings.enemy_vehicle_skill))
|
||||
positioned_groups.append((g, group))
|
||||
|
||||
if group.role in [CombatGroupRole.APC, CombatGroupRole.IFV]:
|
||||
self.gen_infantry_group_for_group(
|
||||
g,
|
||||
is_player,
|
||||
self.mission.country(country),
|
||||
spawn_heading.opposite,
|
||||
)
|
||||
else:
|
||||
logging.warning(f"Unable to get valid position for {group}")
|
||||
|
||||
return positioned_groups
|
||||
|
||||
|
||||
@ -67,8 +67,6 @@ class FrontLineConflictDescription:
|
||||
attack_heading.right,
|
||||
theater,
|
||||
)
|
||||
if position is None:
|
||||
raise RuntimeError("Could not find front line position")
|
||||
return position, attack_heading.opposite
|
||||
|
||||
@classmethod
|
||||
@ -147,7 +145,7 @@ class FrontLineConflictDescription:
|
||||
max_distance: int,
|
||||
heading: Heading,
|
||||
theater: ConflictTheater,
|
||||
) -> Optional[Point]:
|
||||
) -> Point:
|
||||
"""Finds a valid ground position for the front line center.
|
||||
|
||||
Checks for positions along the front line first. If none succeed, the nearest
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user