Skip to content

Commit 001e7df

Browse files
committed
Ignore inconsistent DCS beacon information.
Fixes #3021.
1 parent cf985d3 commit 001e7df

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Saves from 7.x are not compatible with 8.0.
1414

1515
* **[Campaign]** Fix bug introduced in 7.0 where map strike target deaths are no longer tracked.
1616
* **[Mission Generation]** Fix crash during mission generation caused by out of date DCS data for the Gazelle.
17+
* **[Mission Generation]** Fix crash during mission generation when DCS beacon data is inconsistent.
1718

1819
# 7.1.0
1920

game/runways.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Runway information and selection."""
22
from __future__ import annotations
33

4+
import logging
45
from dataclasses import dataclass
56
from typing import Iterator, Optional, TYPE_CHECKING
67

@@ -51,7 +52,20 @@ def for_pydcs_runway_runway(
5152
atc = atc_radio.uhf
5253

5354
for beacon_data in airport.beacons:
54-
beacon = Beacons.with_id(beacon_data.id, theater)
55+
try:
56+
beacon = Beacons.with_id(beacon_data.id, theater)
57+
except KeyError:
58+
# DCS data is not always correct. At time of writing, Hatzor in Sinai
59+
# claims to have a beacon named airfield20_0, but the Sinai beacons.lua
60+
# has no such beacon.
61+
# See https://github.com/dcs-liberation/dcs_liberation/issues/3021.
62+
logging.exception(
63+
"Airport %s claims to have beacon %s but the map has no beacon "
64+
"with that ID",
65+
airport.name,
66+
beacon_data.id,
67+
)
68+
continue
5569
if beacon.is_tacan:
5670
tacan = beacon.tacan_channel
5771
tacan_callsign = beacon.callsign

0 commit comments

Comments
 (0)