Fix allocation range for Link 4.

Prior to DCS 2.9 Jester was able to use datalink frequencies outside the
range the aircraft was capable of, but this has presumably always been
broken for human RIOs.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/3222.
This commit is contained in:
Dan Albert
2023-11-01 18:38:23 -07:00
parent c010ef9994
commit efa47e1550
3 changed files with 8 additions and 2 deletions

View File

@@ -446,7 +446,7 @@ class GenericCarrierGenerator(GroundObjectGenerator):
icls = next(self.icls_alloc)
link4 = None
if carrier_type in [Stennis, CVN_71, CVN_72, CVN_73, CVN_75]:
link4 = self.radio_registry.alloc_uhf()
link4 = self.radio_registry.alloc_link4()
self.activate_beacons(ship_group, tacan, tacan_callsign, icls, link4)
self.add_runway_data(
brc or Heading.from_degrees(0), atc, tacan, tacan_callsign, icls

View File

@@ -337,11 +337,13 @@ class RadioRegistry:
"BLUFOR UHF", (RadioRange(MHz(225), MHz(400), MHz(1), Modulation.AM),)
)
LINK_4 = Radio("Link 4", (RadioRange(MHz(300), MHz(325), kHz(100), Modulation.AM),))
def __init__(self) -> None:
self.allocated_channels: Set[RadioFrequency] = set()
self.radio_allocators: Dict[Radio, Iterator[RadioFrequency]] = {}
radios = itertools.chain(RADIOS, [self.BLUFOR_UHF])
radios = itertools.chain(RADIOS, [self.BLUFOR_UHF, self.LINK_4])
for radio in radios:
self.radio_allocators[radio] = radio.range()
@@ -386,6 +388,9 @@ class RadioRegistry:
"""
return self.alloc_for_radio(self.BLUFOR_UHF)
def alloc_link4(self) -> RadioFrequency:
return self.alloc_for_radio(self.LINK_4)
def reserve(self, frequency: RadioFrequency) -> None:
"""Reserves the given channel.