From 575f4e1786f0c5516304d3b414fdb0100e4cbf9c Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Wed, 23 Dec 2020 17:19:57 -0800 Subject: [PATCH] Clean up debug display options. --- qt_ui/displayoptions.py | 11 +++++++++-- qt_ui/widgets/map/QLiberationMap.py | 16 +++++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/qt_ui/displayoptions.py b/qt_ui/displayoptions.py index 6513d1ce..100e7960 100644 --- a/qt_ui/displayoptions.py +++ b/qt_ui/displayoptions.py @@ -70,13 +70,19 @@ class NavMeshOptions(DisplayGroup): self.red_navmesh = DisplayRule("DEBUG Show red navmesh", False) +class PathDebugFactionOptions(DisplayGroup): + def __init__(self) -> None: + super().__init__("Faction for path debugging", debug_only=True) + self.blue = DisplayRule("Debug blue paths", True) + self.red = DisplayRule("Debug red paths", False) + + class PathDebugOptions(DisplayGroup): def __init__(self) -> None: super().__init__("Shortest paths", debug_only=True) self.hide = DisplayRule("DEBUG Hide paths", True) self.shortest_path = DisplayRule("DEBUG Show shortest path", False) - self.blue_tarcap = DisplayRule("DEBUG Show blue TARCAP plan", False) - self.red_tarcap = DisplayRule("DEBUG Show red TARCAP plan", False) + self.tarcap = DisplayRule("DEBUG Show TARCAP plan", False) class DisplayOptions: @@ -95,6 +101,7 @@ class DisplayOptions: blue_threat_zones = ThreatZoneOptions("Blue") red_threat_zones = ThreatZoneOptions("Red") navmeshes = NavMeshOptions() + path_debug_faction = PathDebugFactionOptions() path_debug = PathDebugOptions() @classmethod diff --git a/qt_ui/widgets/map/QLiberationMap.py b/qt_ui/widgets/map/QLiberationMap.py index aa93a874..b9255241 100644 --- a/qt_ui/widgets/map/QLiberationMap.py +++ b/qt_ui/widgets/map/QLiberationMap.py @@ -1046,14 +1046,16 @@ class QLiberationMap(QGraphicsView): if DisplayOptions.navmeshes.red_navmesh: self.highlight_mouse_navmesh( self.scene(), self.game.red_navmesh, mouse_world_pos) - if DisplayOptions.path_debug.shortest_path: - self.draw_shortest_path(self.scene(), self.game.red_navmesh, - mouse_world_pos, player=False) - if DisplayOptions.path_debug.blue_tarcap: - self.draw_tarcap_plan(self.scene(), mouse_world_pos, player=True) - if DisplayOptions.path_debug.red_tarcap: - self.draw_tarcap_plan(self.scene(), mouse_world_pos, player=False) + debug_blue = DisplayOptions.path_debug_faction.blue + if DisplayOptions.path_debug.shortest_path: + self.draw_shortest_path( + self.scene(), self.game.navmesh_for(player=debug_blue), + mouse_world_pos, player=False) + + if DisplayOptions.path_debug.tarcap: + self.draw_tarcap_plan(self.scene(), mouse_world_pos, + player=debug_blue) def sceneMousePressEvent(self, event: QGraphicsSceneMouseEvent): if self.state == QLiberationMapState.MOVING_UNIT: