@@ -64,22 +64,28 @@ private _controls = [];
64
64
_ctrlCombo lbAdd localize LSTRING(Empty);
65
65
_ctrlCombo lbSetCurSel 0 ;
66
66
67
- // Add compatible magazines to the combo box
67
+ // Get compatible magazines and sort them alphabetically by name
68
+ private _magazines = _aircraft getCompatiblePylonMagazines configName _x apply {
69
+ private _config = _cfgMagazines >> _x ;
70
+ [getText (_config >> " displayName" ), getText (_config >> " descriptionShort" ), _x ]
71
+ };
72
+
73
+ _magazines sort true ;
74
+
75
+ // Add compatible magazines to the combo box and select the current one
68
76
private _currentMagazine = _currentMagazines select _forEachIndex ;
69
77
70
78
{
71
- private _config = _cfgMagazines >> _x ;
72
- private _name = getText (_config >> " displayName" );
73
- private _tooltip = getText (_config >> " descriptionShort" );
79
+ _x params [" _name" , " _tooltip" , " _magazine" ];
74
80
75
81
private _index = _ctrlCombo lbAdd _name ;
76
82
_ctrlCombo lbSetTooltip [_index , _tooltip ];
77
- _ctrlCombo lbSetData [_index , _x ];
83
+ _ctrlCombo lbSetData [_index , _magazine ];
78
84
79
- if (_x == _currentMagazine ) then {
85
+ if (_magazine == _currentMagazine ) then {
80
86
_ctrlCombo lbSetCurSel _index ;
81
87
};
82
- } forEach ( _aircraft getCompatiblePylonMagazines configName _x ) ;
88
+ } forEach _magazines ;
83
89
84
90
// Create turret button if aircraft has a gunner position
85
91
private _ctrlTurret = controlNull ;
0 commit comments