mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Fix inventory handling when adjusting flight size.
We need to resize the flight before attempting to claim the aircraft, or we'll reclaim the original number of aircraft rather than the new size.
This commit is contained in:
parent
d0976c45e9
commit
82281e2477
@ -202,8 +202,10 @@ class QFlightSlotEditor(QGroupBox):
|
|||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
|
|
||||||
def _changed_aircraft_count(self):
|
def _changed_aircraft_count(self):
|
||||||
self.game.aircraft_inventory.return_from_flight(self.flight)
|
old_count = self.flight.count
|
||||||
new_count = int(self.aircraft_count_spinner.value())
|
new_count = int(self.aircraft_count_spinner.value())
|
||||||
|
self.game.aircraft_inventory.return_from_flight(self.flight)
|
||||||
|
self.flight.resize(new_count)
|
||||||
try:
|
try:
|
||||||
self.game.aircraft_inventory.claim_for_flight(self.flight)
|
self.game.aircraft_inventory.claim_for_flight(self.flight)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
@ -217,7 +219,6 @@ class QFlightSlotEditor(QGroupBox):
|
|||||||
f"{available} {self.flight.unit_type} remaining"
|
f"{available} {self.flight.unit_type} remaining"
|
||||||
)
|
)
|
||||||
self.game.aircraft_inventory.claim_for_flight(self.flight)
|
self.game.aircraft_inventory.claim_for_flight(self.flight)
|
||||||
|
self.flight.resize(old_count)
|
||||||
return
|
return
|
||||||
|
|
||||||
self.flight.resize(new_count)
|
|
||||||
self.roster_editor.resize(new_count)
|
self.roster_editor.resize(new_count)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user