Skip to content

Commit

Permalink
Minor optimisations in intelitems
Browse files Browse the repository at this point in the history
  • Loading branch information
johnb432 committed Jan 11, 2025
1 parent d69f047 commit b4ea96f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion addons/intelitems/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
3 changes: 1 addition & 2 deletions addons/intelitems/functions/fnc_addActions.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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)};

Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion addons/intelitems/functions/fnc_createControl.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand Down
2 changes: 1 addition & 1 deletion addons/intelitems/functions/fnc_deleteControl.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b4ea96f

Please sign in to comment.