From 8ec133830fbfa2de8bda6b602f2efb005eed8f12 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Sat, 15 May 2021 00:10:05 -0700 Subject: [PATCH] Don't tell the UI about CP TGOs. These are an implementation quirk, and passing them to the UI just means that we put TGO pins on top of the CP, which makes the base menu unopenable. In the old UI we avoided this by not drawing anything that was `for_airbase`, but now that we can zoom in further we're drawing base defenses. --- game/theater/theatergroundobject.py | 9 ++++++++- qt_ui/widgets/map/mapmodel.py | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/game/theater/theatergroundobject.py b/game/theater/theatergroundobject.py index 2922089c..04c44f84 100644 --- a/game/theater/theatergroundobject.py +++ b/game/theater/theatergroundobject.py @@ -233,6 +233,11 @@ class TheaterGroundObject(MissionTarget): def is_factory(self) -> bool: return self.category == "factory" + @property + def is_control_point(self) -> bool: + """True if this TGO is the group for the control point itself (CVs and FOBs).""" + return False + class BuildingGroundObject(TheaterGroundObject): def __init__( @@ -354,7 +359,9 @@ class NavalGroundObject(TheaterGroundObject): class GenericCarrierGroundObject(NavalGroundObject): - pass + @property + def is_control_point(self) -> bool: + return True # TODO: Why is this both a CP and a TGO? diff --git a/qt_ui/widgets/map/mapmodel.py b/qt_ui/widgets/map/mapmodel.py index bffc61fd..b77788a4 100644 --- a/qt_ui/widgets/map/mapmodel.py +++ b/qt_ui/widgets/map/mapmodel.py @@ -517,6 +517,11 @@ class MapModel(QObject): continue seen.add(tgo.name) + if tgo.is_control_point: + # TGOs that are the CP (CV groups) are an implementation quirk that + # we don't need to expose to the UI. + continue + self._ground_objects.append(GroundObjectJs(tgo, self.game)) self.groundObjectsChanged.emit()