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
This commit is contained in:
RndName 2022-03-30 09:21:26 +02:00
parent 4738a722a6
commit de76276a4d
No known key found for this signature in database
GPG Key ID: 5EF516FD9537F7C0

View File

@ -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)")