Remove error handling for impossible case.

This commit is contained in:
Dan Albert 2022-09-11 17:45:22 -07:00
parent c39a094d88
commit bbfe1657d6
2 changed files with 20 additions and 29 deletions

View File

@ -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,7 +729,6 @@ class FlotGenerator:
distance_from_frontline, spawn_heading
)
if final_position is not None:
g = self._generate_group(
is_player,
self.mission.country(country),
@ -755,8 +750,6 @@ class FlotGenerator:
self.mission.country(country),
spawn_heading.opposite,
)
else:
logging.warning(f"Unable to get valid position for {group}")
return positioned_groups

View File

@ -68,8 +68,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
@ -142,7 +140,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