Ignore inconsistent DCS beacon information.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/3021.
This commit is contained in:
Dan Albert 2023-06-20 18:21:41 -07:00
parent cf985d3d37
commit 001e7dfed9
2 changed files with 16 additions and 1 deletions

View File

@ -14,6 +14,7 @@ Saves from 7.x are not compatible with 8.0.
* **[Campaign]** Fix bug introduced in 7.0 where map strike target deaths are no longer tracked.
* **[Mission Generation]** Fix crash during mission generation caused by out of date DCS data for the Gazelle.
* **[Mission Generation]** Fix crash during mission generation when DCS beacon data is inconsistent.
# 7.1.0

View File

@ -1,6 +1,7 @@
"""Runway information and selection."""
from __future__ import annotations
import logging
from dataclasses import dataclass
from typing import Iterator, Optional, TYPE_CHECKING
@ -51,7 +52,20 @@ class RunwayData:
atc = atc_radio.uhf
for beacon_data in airport.beacons:
beacon = Beacons.with_id(beacon_data.id, theater)
try:
beacon = Beacons.with_id(beacon_data.id, theater)
except KeyError:
# DCS data is not always correct. At time of writing, Hatzor in Sinai
# claims to have a beacon named airfield20_0, but the Sinai beacons.lua
# has no such beacon.
# See https://github.com/dcs-liberation/dcs_liberation/issues/3021.
logging.exception(
"Airport %s claims to have beacon %s but the map has no beacon "
"with that ID",
airport.name,
beacon_data.id,
)
continue
if beacon.is_tacan:
tacan = beacon.tacan_channel
tacan_callsign = beacon.callsign