ACE3/addons/arsenal/functions/fnc_buttonClearAll.sqf
jonpas 742626ff1a
General - Relative script_component.hpp includes (#9378)
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
2023-09-12 20:58:10 +02:00

71 lines
1.9 KiB
Plaintext

#include "..\script_component.hpp"
#include "..\defines.hpp"
/*
* Author: Alganthe, johnb43
* Clear the current container.
*
* Arguments:
* 0: Arsenal display <DISPLAY>
*
* Return Value:
* None
*
* Public: No
*/
params ["_display"];
// Clear chosen container, reset currentItems for that container and get relevant container
private _container = switch (GVAR(currentLeftPanel)) do {
// Uniform
case IDC_buttonUniform: {
private _container = uniformContainer GVAR(center);
// Remove everything (backpacks need special command for this)
clearWeaponCargoGlobal _container;
clearMagazineCargoGlobal _container;
clearItemCargoGlobal _container;
clearBackpackCargoGlobal _container;
GVAR(currentItems) set [IDX_CURR_UNIFORM_ITEMS, []];
_container
};
// Vest
case IDC_buttonVest: {
private _container = vestContainer GVAR(center);
// Remove everything (backpacks need special command for this)
clearWeaponCargoGlobal _container;
clearMagazineCargoGlobal _container;
clearItemCargoGlobal _container;
clearBackpackCargoGlobal _container;
GVAR(currentItems) set [IDX_CURR_VEST_ITEMS, []];
_container
};
// Backpack
case IDC_buttonBackpack: {
// Remove everything
clearAllItemsFromBackpack GVAR(center);
GVAR(currentItems) set [IDX_CURR_BACKPACK_ITEMS, []];
backpackContainer GVAR(center)
};
};
// Clear number of owned items
private _ctrlList = _display displayCtrl IDC_rightTabContentListnBox;
for "_lbIndex" from 0 to (lbSize _ctrlList) - 1 do {
_ctrlList lnbSetText [[_lbIndex, 2], "0"];
};
// Update load bar
(_display displayCtrl IDC_loadIndicatorBar) progressSetPosition 0;
// Refresh availibility of items based on space remaining in container
[_ctrlList, _container, false] call FUNC(updateRightPanel);