mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Rename UnitType.name what it is: the variant ID.
This property affects safe compat because the ID is what gets preserved in the save, but it's unfortunately also used as the display name, which means changing the display name breaks save compat. It also prevents us from changing display names without breaking faction definitions. This is the first step in fixing that. The next is adding a separate display_name property that can be updated without breaking either of those.
This commit is contained in:
@@ -611,12 +611,12 @@ class AircraftTypeList(QListView):
|
||||
self.add_aircraft_type(aircraft)
|
||||
|
||||
def remove_aircraft_type(self, aircraft: AircraftType):
|
||||
for item in self.item_model.findItems(aircraft.name):
|
||||
for item in self.item_model.findItems(aircraft.variant_id):
|
||||
self.item_model.removeRow(item.row())
|
||||
self.page_index_changed.emit(self.selectionModel().currentIndex().row())
|
||||
|
||||
def add_aircraft_type(self, aircraft: AircraftType):
|
||||
aircraft_item = QStandardItem(aircraft.name)
|
||||
aircraft_item = QStandardItem(aircraft.variant_id)
|
||||
icon = self.icon_for(aircraft)
|
||||
if icon is not None:
|
||||
aircraft_item.setIcon(icon)
|
||||
@@ -728,7 +728,7 @@ class AirWingConfigurationTab(QWidget):
|
||||
)
|
||||
|
||||
# Add Squadron
|
||||
if not self.type_list.item_model.findItems(selected_type.name):
|
||||
if not self.type_list.item_model.findItems(selected_type.variant_id):
|
||||
self.type_list.add_aircraft_type(selected_type)
|
||||
# TODO Select the newly added type
|
||||
self.squadrons_panel.add_squadron_to_panel(squadron)
|
||||
@@ -814,8 +814,8 @@ class SquadronAircraftTypeSelector(QComboBox):
|
||||
super().__init__()
|
||||
self.setSizeAdjustPolicy(self.AdjustToContents)
|
||||
|
||||
for type in sorted(types, key=lambda type: type.name):
|
||||
self.addItem(type.name, type)
|
||||
for type in sorted(types, key=lambda type: type.variant_id):
|
||||
self.addItem(type.variant_id, type)
|
||||
|
||||
if selected_aircraft:
|
||||
self.setCurrentText(selected_aircraft)
|
||||
|
||||
Reference in New Issue
Block a user