From de76276a4d789b9cff35603dfd8702aea2800c0a Mon Sep 17 00:00:00 2001 From: RndName Date: Wed, 30 Mar 2022 09:21:26 +0200 Subject: [PATCH] Fix incorrect value calculation of ground objects A user would be able to sell a complete damaged TGO for the price of a new one as the value calculation function was not taking care if the unit was dead or alive. This fix now only takes alive units into account for the actual value of the tgo --- qt_ui/windows/groundobject/QGroundObjectMenu.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qt_ui/windows/groundobject/QGroundObjectMenu.py b/qt_ui/windows/groundobject/QGroundObjectMenu.py index e76272d8..d8056193 100644 --- a/qt_ui/windows/groundobject/QGroundObjectMenu.py +++ b/qt_ui/windows/groundobject/QGroundObjectMenu.py @@ -218,7 +218,9 @@ class QGroundObjectMenu(QDialog): if not self.ground_object.purchasable: return self.total_value = sum( - u.unit_type.price for u in self.ground_object.units if u.unit_type + u.unit_type.price + for u in self.ground_object.units + if u.unit_type and u.alive ) if self.sell_all_button is not None: self.sell_all_button.setText("Disband (+$" + str(self.total_value) + "M)")