From b10395715dbdf9e8ce5b8afbffd27d05473f8dd9 Mon Sep 17 00:00:00 2001 From: zhexu14 <64713351+zhexu14@users.noreply.github.com> Date: Sun, 23 Jul 2023 10:58:38 +1000 Subject: [PATCH] In NewUnitTransferDialog, only list reachable control points. This PR addresses #3066 by restricting the list of control points in the new unit transfer dialog to control points reachable from the origin. This change centralizes the logic for reachable nodes to the TransitNetworkBuilder class. This PR was tested by: 1. Loading save from #3066 2. Using cheat menu to destroy runway at Wadi al Jandali 3. Purchasing units at any of the other control points 4. Pass the turn to allow the purchase to complete 5. Initiating a unit transfer from the other control point and confirming that Wadi al Jandali does not show up in the list Steps 2-4 are needed as no ground units show up at Melez when loading the save directly from the latest dev build. Fixes https://github.com/dcs-liberation/dcs_liberation/issues/3066. --- changelog.md | 1 + qt_ui/windows/basemenu/NewUnitTransferDialog.py | 13 ++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/changelog.md b/changelog.md index 7df96888..1cb04ec6 100644 --- a/changelog.md +++ b/changelog.md @@ -23,6 +23,7 @@ Saves from 8.x are not compatible with 9.0.0. * **[Plugins]** Fixed Lua errors in Skynet plugin that would occur whenever one coalition had no IADS nodes. * **[UI]** Fixed deleting waypoints in custom flight plans deleting the wrong waypoint. * **[UI]** Fixed flight properties UI to support F-15E S4+ laser codes. +* **[UI]** In unit transfer dialog, only list control points that are reachable from the control point units are being transferred from. # 8.1.0 diff --git a/qt_ui/windows/basemenu/NewUnitTransferDialog.py b/qt_ui/windows/basemenu/NewUnitTransferDialog.py index 0774ae5f..ad202c07 100644 --- a/qt_ui/windows/basemenu/NewUnitTransferDialog.py +++ b/qt_ui/windows/basemenu/NewUnitTransferDialog.py @@ -36,13 +36,12 @@ class TransferDestinationComboBox(QComboBox): self.game = game self.origin = origin - for cp in self.game.theater.controlpoints: - if ( - cp != self.origin - and cp.is_friendly(to_player=True) - and cp.can_deploy_ground_units - ): - self.addItem(cp.name, cp) + for cp in self.game.blue.transit_network.nodes: + if cp == origin: + continue + if not self.game.blue.transit_network.has_path_between(origin, cp): + continue + self.addItem(cp.name, cp) self.model().sort(0) self.setCurrentIndex(0)