From b4ea96f26e58101d692fa3f6fac8836e2d24ee7e Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Sat, 11 Jan 2025 20:51:57 +0100 Subject: [PATCH] Minor optimisations in intelitems --- addons/intelitems/XEH_preInit.sqf | 2 +- addons/intelitems/functions/fnc_addActions.sqf | 3 +-- addons/intelitems/functions/fnc_createControl.sqf | 2 +- addons/intelitems/functions/fnc_deleteControl.sqf | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/intelitems/XEH_preInit.sqf b/addons/intelitems/XEH_preInit.sqf index ff09f6ea0e9..e2914443cce 100644 --- a/addons/intelitems/XEH_preInit.sqf +++ b/addons/intelitems/XEH_preInit.sqf @@ -27,7 +27,7 @@ if (hasInterface) then { GVAR(controlsGroups) = []; // Hash to track controls group positions on map between closing - GVAR(controlsData) = [] call CBA_fnc_hashCreate; + GVAR(controlsData) = createHashMap; }; ADDON = true; diff --git a/addons/intelitems/functions/fnc_addActions.sqf b/addons/intelitems/functions/fnc_addActions.sqf index 6b93a54eb1d..5e1501a7f0d 100644 --- a/addons/intelitems/functions/fnc_addActions.sqf +++ b/addons/intelitems/functions/fnc_addActions.sqf @@ -20,7 +20,6 @@ params ["_player"]; private _actions = []; private _cfgMagazines = configFile >> "CfgMagazines"; -private _magazines = magazines _player; private _openIndices = GVAR(controlsGroups) apply {_x getVariable QGVAR(index)}; @@ -53,6 +52,6 @@ private _openIndices = GVAR(controlsGroups) apply {_x getVariable QGVAR(index)}; }; } forEach _magazineIds; }; -} forEach (_magazines arrayIntersect _magazines); +} forEach ([_player, 2] call EFUNC(common,uniqueItems)); _actions diff --git a/addons/intelitems/functions/fnc_createControl.sqf b/addons/intelitems/functions/fnc_createControl.sqf index b56d3f36819..5f8fc61ca9a 100644 --- a/addons/intelitems/functions/fnc_createControl.sqf +++ b/addons/intelitems/functions/fnc_createControl.sqf @@ -44,7 +44,7 @@ private _ctrlContent = _controlsGroup controlsGroupCtrl IDC_CONTENT; _ctrlContent ctrlSetText GET_DATA(_index); // Restore position of controls group (center if not saved) -private _position = [GVAR(controlsData), _index] call CBA_fnc_hashGet; +private _position = GVAR(controlsData) get _index; if (isNil "_position") then { ctrlPosition _controlsGroup params ["", "", "_posW", "_posH"]; diff --git a/addons/intelitems/functions/fnc_deleteControl.sqf b/addons/intelitems/functions/fnc_deleteControl.sqf index c2b986b21f7..4d7d9cd2e28 100644 --- a/addons/intelitems/functions/fnc_deleteControl.sqf +++ b/addons/intelitems/functions/fnc_deleteControl.sqf @@ -21,7 +21,7 @@ private _index = _controlsGroup getVariable QGVAR(index); // Save position of controls group ctrlPosition _controlsGroup params ["_posX", "_posY"]; -[GVAR(controlsData), _index, [_posX, _posY]] call CBA_fnc_hashSet; +GVAR(controlsData) set [_index, [_posX, _posY]]; // Update data if modified private _ctrlContent = _controlsGroup controlsGroupCtrl IDC_CONTENT;