Attempt to fix index-out-of-range

Injecting pylons in the F-100 seems to go out of bounds here
This commit is contained in:
Raffson 2023-07-21 22:05:51 +02:00
parent 2cfd56c8da
commit 64f6a10ced
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99

View File

@ -515,7 +515,12 @@ class AircraftType(UnitType[Type[FlyingType]]):
for pylon_number, weapons in wpn_injection.items():
for w in weapons:
weapon = weapon_ids[w]
setattr(pylons[pylon_number - 1], w, (pylon_number, weapon))
pylon = [
pylon
for pylon in pylons
if int(pylon.__name__.replace("Pylon", "")) == pylon_number
][0]
setattr(pylon, w, (pylon_number, weapon))
def __hash__(self) -> int:
return hash(self.name)