ACE3/addons/arsenal/functions/fnc_sortPanel.sqf
Josuan Albin 1994e301fd More various ace arsenal fixes (#6192)
* Compile stats on preInit

* Remove uneeded check in add/removeStat

* Remove perf profiler vars

They aren't required anymore

* Fix case issue in verifyLoadout, remove uneeded line

* Fix ace arsenal cam not working porperly underwater

By removing those checks the cam is allowed to clip through objects and work properly underwater, sounds like features to me :D

* Fix gunbag behavior in ace arsenal

Switching between gunbags will keep the weapon, switching to another backpack then back to a gunbag will also keep the weapon.

* Fix text scaling in the searchbars and loadout name edit boxes

Also made the text bigger by default
2018-04-12 10:44:23 -05:00

65 lines
1.5 KiB
Plaintext

/*
* Author: Alganthe, Dedmen
* Sort arsenal panel.
*
* Arguments:
* 0: Panel's control to sort <CONTROL>
* 1: Sorting mode <SCALAR>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
#include "..\defines.hpp"
params ["_control", "_mode"];
private _display = ctrlParent _control;
private ["_panel", "_curSel", "_selected"];
// Right panel
if (ctrlIDC _control == 17 && {GVAR(currentLeftPanel) in [IDC_buttonUniform ,IDC_buttonVest, IDC_buttonBackpack]}) then {
_panel = _display displayCtrl IDC_rightTabContentListnBox;
_curSel = lnbCurSelRow _panel;
_selected = _panel lnbData [_curSel, 0];
switch (_mode) do {
case 0: {
_panel lnbSort [1, false];
};
case 1: {
_panel lnbSortByValue [0, false];
};
case 2: {
_panel lnbSort [2, true];
};
};
if (_cursel >= 0) then {
for '_i' from 0 to (((lnbsize _panel) select 0) - 1) do {
if ((_panel lnbdata [_i, 0]) == _selected) exitwith {_panel lnbSetCurSelRow _i};
};
};
// Left panel
} else {
_panel = _display displayCtrl ([IDC_leftTabContent, IDC_rightTabContent] select (ctrlIDC _control == 17));
_curSel = lbCurSel _panel;
_selected = _panel lbData _curSel;
if (_mode > 0) then {
lbSortByValue _panel;
} else {
lbsort _panel;
};
if (_cursel >= 0) then {
for '_i' from 0 to (lbsize _panel - 1) do {
if ((_panel lbdata _i) == _selected) exitwith {_panel lbSetCurSel _i};
};
};
};