From ec787b913cefe786e489a51755a7f747d2e2ef00 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Sun, 27 Dec 2020 13:45:53 -0800 Subject: [PATCH] Use exact name matching when picking targets. Inexact name matching targets the first group that partially matches the given group name. aa|71 will match aa|7. The inexact match that was here was only needed for an early attempt to use skynet where group names were not used consistently. That's no longer a problem so we don't need this workaround. Fixes https://github.com/Khopa/dcs_liberation/issues/676 (cherry picked from commit 89f313295e6be36ad0fd6db08907006c25a7d187) --- changelog.md | 1 + gen/aircraft.py | 15 +++------------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/changelog.md b/changelog.md index 4e797ed5..616f2aab 100644 --- a/changelog.md +++ b/changelog.md @@ -27,6 +27,7 @@ * **[UI]** Ship groups could be replaced by SAM sites in the UI, which would lead to broken mission being generated - fixed * **[New Game Wizard]** Removed the "mid game" campaign generator option which is currently broken * **[Mission Generator]** Empty navy groups will no longer be generated +* **[Mission Generator]** Fixed BAI, SEAD, and DEAD flights ocassionally being assigned the wrong targets. * **[Flight Planner]** Fixed not being able to plan packages against opfor carriers * **[UI]** Repaired SAMs no longer show as dead. * **[UI]** Fixed not being able to manage a disbanded site after disbanding and closing the base menu. diff --git a/gen/aircraft.py b/gen/aircraft.py index 87233d35..42454df4 100644 --- a/gen/aircraft.py +++ b/gen/aircraft.py @@ -1474,10 +1474,7 @@ class BaiIngressBuilder(PydcsWaypointBuilder): target_group = self.package.target if isinstance(target_group, TheaterGroundObject): - # Match search is used due to TheaterGroundObject.name not matching - # the Mission group name because of SkyNet prefixes. - tgroup = self.mission.find_group(target_group.group_name, - search="match") + tgroup = self.mission.find_group(target_group.group_name) if tgroup is not None: task = AttackGroup(tgroup.id, weapon_type=WeaponType.Auto) task.params["attackQtyLimit"] = False @@ -1527,10 +1524,7 @@ class DeadIngressBuilder(PydcsWaypointBuilder): target_group = self.package.target if isinstance(target_group, TheaterGroundObject): - # Match search is used due to TheaterGroundObject.name not matching - # the Mission group name because of SkyNet prefixes. - tgroup = self.mission.find_group(target_group.group_name, - search="match") + tgroup = self.mission.find_group(target_group.group_name) if tgroup is not None: task = AttackGroup(tgroup.id, weapon_type=WeaponType.Guided) task.params["expend"] = "All" @@ -1593,10 +1587,7 @@ class SeadIngressBuilder(PydcsWaypointBuilder): target_group = self.package.target if isinstance(target_group, TheaterGroundObject): - # Match search is used due to TheaterGroundObject.name not matching - # the Mission group name because of SkyNet prefixes. - tgroup = self.mission.find_group(target_group.group_name, - search="match") + tgroup = self.mission.find_group(target_group.group_name) if tgroup is not None: waypoint.add_task(EngageTargetsInZone( position=tgroup.position,