ACE3/addons/optionsmenu/functions/fnc_onListBoxSettingsChanged.sqf
Glowbal b489750d5b Minor optimizations using private, params, and isEqualType (#4323)
* Optimizations with private, params, and isEqualType

* Fixed tab being used instead of space

* Fixed tabs inserted by notepad++

* More usage of new private syntax and params

- changed a few checks for an array being empty to `_arr isEqualTo []`
rather than `count _arr == 0`
- added more uses of `private` on the same line as the variable is
declared
- added more uses of params to assign variables passed as parameters
- removed unnecessary parentheses
- removed several unnecessary variable declarations with private array
syntax

* clean up and formatting
2016-09-04 16:44:22 +02:00

44 lines
1.4 KiB
Plaintext

/*
* Author: Glowbal
* Called when the listbox selection is changed for an options (eg: chaning a setting from false to true)
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ACE_optionsmenu_fnc_onListBoxSettingsChanged
*
* Public: No
*/
#include "script_component.hpp"
private _rightDropDownIndex = lbCurSel 400; //Index of right drop down
if (_rightDropDownIndex < 0) then {_rightDropDownIndex = 0;};
private _settingIndex = -1;
if (((lnbCurSelRow 200) >= 0) && {(lnbCurSelRow 200) < ((lnbSize 200) select 0)}) then {
_settingIndex = lnbValue [200, [(lnbCurSelRow 200), 0]];
};
if (_settingIndex == -1) exitWith {};
switch (GVAR(optionMenu_openTab)) do {
case (MENU_TAB_OPTIONS): {
if ((_settingIndex >= 0) && (_settingIndex < (count GVAR(clientSideOptions)))) then {
_settingIndex = (GVAR(clientSideOptions) select _settingIndex) select 0;
[MENU_TAB_OPTIONS, _settingIndex, _rightDropDownIndex] call FUNC(updateSetting);
};
[false] call FUNC(settingsMenuUpdateList);
};
case (MENU_TAB_SERVER_OPTIONS): {
if ((_settingIndex >= 0) && (_settingIndex < (count GVAR(serverSideOptions)))) then {
_settingIndex = (GVAR(serverSideOptions) select _settingIndex) select 0;
[MENU_TAB_SERVER_OPTIONS, _settingIndex, _rightDropDownIndex] call FUNC(updateSetting);
};
[false] call FUNC(serverSettingsMenuUpdateList);
};
};