mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
d72555ab0c
* support per tab sorting, and external algorithms * improved sub sorting * improve alphabetical search * update mod sorting * sort by accuracy * sort right panel * more sorts * sort right tab * fix empty * stringtables * Apply suggestions from code review Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com> * more suggestions * suggestions * remember last sort * Fix missing throw and put names * bad copy paste in stringtable * Update addons/arsenal/functions/fnc_sortPanel.sqf Co-authored-by: PabstMirror <pabstmirror@gmail.com> Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com> Co-authored-by: PabstMirror <pabstmirror@gmail.com>
100 lines
2.9 KiB
Plaintext
100 lines
2.9 KiB
Plaintext
#include "script_component.hpp"
|
|
#include "..\defines.hpp"
|
|
/*
|
|
* Author: Alganthe, SynixeBrett
|
|
* Fill right panel.
|
|
*
|
|
* Arguments:
|
|
* 0: Arsenal display <DISPLAY>
|
|
* 1: Tab control <CONTROL>
|
|
* 2: Sort control <CONTROL>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_display", "_control", "_sortCtrl"];
|
|
|
|
lbClear _sortCtrl;
|
|
|
|
private _right = false;
|
|
private _rightSort = ctrlIDC _sortCtrl == 17;
|
|
|
|
private _sorts = if (_rightSort && {GVAR(currentLeftPanel) in [IDC_buttonUniform ,IDC_buttonVest, IDC_buttonBackpack]}) then {
|
|
_right = true;
|
|
GVAR(sortListRightPanel) select (
|
|
switch (GVAR(currentRightPanel)) do {
|
|
case IDC_buttonOptic: { 0 };
|
|
case IDC_buttonItemAcc: { 1 };
|
|
case IDC_buttonMuzzle: { 2 };
|
|
case IDC_buttonBipod: { 3 };
|
|
case IDC_buttonCurrentMag;
|
|
case IDC_buttonCurrentMag2;
|
|
case IDC_buttonMag;
|
|
case IDC_buttonMagALL: { 4 };
|
|
case IDC_buttonThrow: { 5 };
|
|
case IDC_buttonPut: { 6 };
|
|
case IDC_buttonMisc: { 7 };
|
|
}
|
|
)
|
|
} else {
|
|
private _sidc = ctrlIDC _sortCtrl;
|
|
private _idc = ctrlIDC _control;
|
|
switch true do {
|
|
case (_sidc == 17): { // Right panel weapon attachment
|
|
GVAR(sortListRightPanel) select (
|
|
switch (_idc) do {
|
|
case IDC_buttonOptic: { 0 };
|
|
case IDC_buttonItemAcc: { 1 };
|
|
case IDC_buttonMuzzle: { 2 };
|
|
case IDC_buttonBipod: { 3 };
|
|
case IDC_buttonCurrentMag;
|
|
case IDC_buttonCurrentMag2;
|
|
case IDC_buttonMag;
|
|
case IDC_buttonMagALL: { 4 };
|
|
case IDC_buttonThrow: { 5 };
|
|
case IDC_buttonPut: { 6 };
|
|
case IDC_buttonMisc: { 7 };
|
|
}
|
|
)
|
|
};
|
|
case ([IDC_buttonFace, IDC_buttonVoice, IDC_buttonInsigna] find _idc > -1): {
|
|
[]
|
|
};
|
|
default {
|
|
GVAR(sortListLeftPanel) select ([
|
|
IDC_buttonPrimaryWeapon,
|
|
IDC_buttonHandgun,
|
|
IDC_buttonSecondaryWeapon,
|
|
IDC_buttonUniform,
|
|
IDC_buttonVest,
|
|
IDC_buttonBackpack,
|
|
IDC_buttonHeadgear,
|
|
IDC_buttonGoggles,
|
|
IDC_buttonNVG,
|
|
IDC_buttonBinoculars,
|
|
IDC_buttonMap,
|
|
IDC_buttonGPS,
|
|
IDC_buttonRadio,
|
|
IDC_buttonCompass,
|
|
IDC_buttonWatch
|
|
] find _idc)
|
|
};
|
|
}
|
|
};
|
|
|
|
private _lastSort = [GVAR(lastSortLeft), GVAR(lastSortRight)] select _rightSort;
|
|
private _sortIndex = 0;
|
|
|
|
{
|
|
if (_x isEqualTo []) exitWith {};
|
|
_sortCtrl lbAdd (_x select 1);
|
|
if ((_x select 1) isEqualTo _lastSort) then {
|
|
_sortIndex = _forEachIndex;
|
|
};
|
|
} forEach _sorts;
|
|
|
|
_sortCtrl lbSetCurSel _sortIndex;
|