From 89392553bd8e15bdb8d13158e3218f857f5c70b4 Mon Sep 17 00:00:00 2001 From: Simon Clark Date: Sat, 30 Jan 2021 18:08:17 +0000 Subject: [PATCH] Adds a new icon for AA sites with no threat. Also adds the logic to check for this state. Contributes-to: #239 --- changelog.md | 1 + qt_ui/uiconstants.py | 2 ++ qt_ui/widgets/map/QMapGroundObject.py | 16 ++++++++++++++-- resources/ui/ground_assets/nothreat.png | Bin 0 -> 889 bytes resources/ui/ground_assets/nothreat_blue.png | Bin 0 -> 715 bytes 5 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 resources/ui/ground_assets/nothreat.png create mode 100644 resources/ui/ground_assets/nothreat_blue.png diff --git a/changelog.md b/changelog.md index 780a1248..d587aa85 100644 --- a/changelog.md +++ b/changelog.md @@ -23,6 +23,7 @@ Saves from 2.3 are not compatible with 2.4. * **[Economy]** Carriers and off-map spawns generate no income (previously $20M like airbases). * **[Economy]** Sales of aircraft and ground vehicles can now be cancelled before the next turn begins. * **[UI]** Multi-SAM objectives now show threat and detection rings per group. +* **[UI]** New icon for AA sites with no active threat. * **[UI]** Unit names are now prettier and more accurate, and can now be set per-country for added historical flavour. * **[UI]** Default loadout is now shown for flights with no custom loadout selected. * **[UI]** Aircraft for a new flight are now only selectable if they match the task type for that flight. diff --git a/qt_ui/uiconstants.py b/qt_ui/uiconstants.py index 066add27..1ac196f6 100644 --- a/qt_ui/uiconstants.py +++ b/qt_ui/uiconstants.py @@ -132,6 +132,8 @@ def load_icons(): ICONS["ship_blue"] = QPixmap("./resources/ui/ground_assets/ship_blue.png") ICONS["missile"] = QPixmap("./resources/ui/ground_assets/missile.png") ICONS["missile_blue"] = QPixmap("./resources/ui/ground_assets/missile_blue.png") + ICONS["nothreat"] = QPixmap("./resources/ui/ground_assets/nothreat.png") + ICONS["nothreat_blue"] = QPixmap("./resources/ui/ground_assets/nothreat_blue.png") ICONS["Generator"] = QPixmap("./resources/ui/misc/"+get_theme_icons()+"/generator.png") ICONS["Missile"] = QPixmap("./resources/ui/misc/"+get_theme_icons()+"/missile.png") diff --git a/qt_ui/widgets/map/QMapGroundObject.py b/qt_ui/widgets/map/QMapGroundObject.py index 7d8217b5..a0f51205 100644 --- a/qt_ui/widgets/map/QMapGroundObject.py +++ b/qt_ui/widgets/map/QMapGroundObject.py @@ -85,10 +85,22 @@ class QMapGroundObject(QMapObject): is_dead = False break + if cat == "aa": + has_threat = False + for group in self.ground_object.groups: + if self.ground_object.threat_range(group).distance_in_meters > 0: + has_threat = True + if not is_dead and not self.control_point.captured: - painter.drawPixmap(rect, const.ICONS[cat + enemy_icons]) + if cat == "aa" and not has_threat: + painter.drawPixmap(rect, const.ICONS["nothreat" + enemy_icons]) + else: + painter.drawPixmap(rect, const.ICONS[cat + enemy_icons]) elif not is_dead: - painter.drawPixmap(rect, const.ICONS[cat + player_icons]) + if cat == "aa" and not has_threat: + painter.drawPixmap(rect, const.ICONS["nothreat" + player_icons]) + else: + painter.drawPixmap(rect, const.ICONS[cat + player_icons]) else: painter.drawPixmap(rect, const.ICONS["destroyed"]) diff --git a/resources/ui/ground_assets/nothreat.png b/resources/ui/ground_assets/nothreat.png new file mode 100644 index 0000000000000000000000000000000000000000..175fa29014547d72154f313b3543bade3d076cf8 GIT binary patch literal 889 zcmV-<1BU#GP)D?|y6LFcR^O ze&i_%<~knbGZyV}UHs?c=RYI!p_KgRCJM`0i+uq=~6lHh@r-==(#+*C6#xDG^|7YpDhuX09p*S3?}Ksp$-(f1a{AfS z^{=D<{{HfqiT?Zg?QB=(HyZlW&GC_e@|A}1jeYmQxa1}W_rtpOyR!0{i|b%X`OnDn zppyOZ@90S{_PDO_hIQ_BVf*0R`q$C=)z9Q83H7X?>t9Iy@$TtOH2KTK>}gc;nTqE> zB=CxP{qF1Zsh$4x^7XHz|NQ*#e{JO~4(LlU_rJFCl!fU}Ht~;t@Qi%zZdvPLO8n^M z<~AAfmWTZ6=kk|`?sj7Q=;Y-x761SL;~)SajljkL000SaNLh0L01FcU01FcV0GgZ_ z00007bV*G`2ju}C5g{$pU#VOG00B)&L_t(I%k9(EQvy*G2Joc>X+>!eK`{ssBpkbS z?58}py4NI=vTnyqh5ijN6*>{n+ayoy0PR|97h1` znTe)312fac!fhxXY>T?-Rb)bEq;D(b<;H=_E}51Z>k!;=nFDOnllUtPvb>9BomW}Y z{&@w&zA%V|cig) P00000NkvXXu0mjfv*qZl literal 0 HcmV?d00001 diff --git a/resources/ui/ground_assets/nothreat_blue.png b/resources/ui/ground_assets/nothreat_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..46f2532ab81c06eb3f7ba580c5754594f3d593ae GIT binary patch literal 715 zcmWlVc`%d#0L8zJuu2k*Te-(LQYfYxs@>T($Lz4G9Z6Cejb<8Qbh#oSMa1SNtw~a@ z965G}wP8eUl8~EZoH;^$uk~hr@6EhFf3YkVhJw6?JV6i&%#$=%$?n}mPD;|Wg18of zpct{7*mU9^Nr{3~G`8M{Yz(Lmuq_sf@lbjQ!l?9t@9Lj-xK28*X!2`1p&M)Cs49**PyoGl;d@A5yOjiaw<4(x$?bUd5gDDx>O$UUJQt%tO!B^vMcw49 zuXx>q(q2^dp{gG>19<-f^@9)$qiF=fQHaLSI*#@UbWEc2Cq7L<{0rUF=$%2|EC%K< zynxX~j4xvHH>Q>_y^NU^%&lVK4}PyQ@F(&1g*DxtL!v$jmyF}7{{jJWS~q=Smgkco|fqqvx6s>s&h z(Ss|>Tq}~fTja+U!jL9cV0Nlzy5z3ihDZ68*GKKCxBOxjWvFzmc)bd%TnM}(qI%Q~ zGS=LU6H_B1ZyU{P1+hfkZDvFEb9uXj;W-q&Lwuper#xO^L=Bf%<1_j*<9tU{&#s8} z=<<#PSZduFYn(4^r1aRZwyW7Mu>?aQ47K5!a~Zo_qW!cgc zJ8MI4>sdud!A;HFxCDZee>d}@r=@>ZFT*lHN7G{7e`3l