Filter out empty string CLSIDs.

There's more detail in the comment, but this fixes an issue where some
Mosquito loadouts could not be loaded.

Might fix https://github.com/dcs-liberation/dcs_liberation/issues/3171.
There aren't enough instructions in the bug for me to be sure, but it
sounds like a similar problem, although I came across it with bombs
rather than rockets.
This commit is contained in:
Dan Albert
2023-10-20 13:09:52 -07:00
parent f9e7370b35
commit 0e01aaf9cd
2 changed files with 12 additions and 1 deletions

View File

@@ -134,7 +134,17 @@ class Loadout:
pylons = payload["pylons"]
try:
pylon_assignments = {
p["num"]: Weapon.with_clsid(p["CLSID"]) for p in pylons.values()
p["num"]: Weapon.with_clsid(p["CLSID"])
for p in pylons.values()
# When unloading incompatible pylons (for example, some of the
# Mosquito's pylons cannot be loaded when other pylons are carrying
# rockets), DCS sometimes equips the empty string rather than
# unsetting the pylon. An unset pylon and the empty string appear to
# have identical behavior, and it's annoying to deal with weapons
# that pydcs doesn't know about, so just clear those pylons rather
# than explicitly handling "".
# https://github.com/dcs-liberation/dcs_liberation/issues/3171
if p["CLSID"] != ""
}
except KeyError:
logging.exception(