Skip to content

Commit

Permalink
Intel Items - Minor optimisations (#10637)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnb432 authored Jan 13, 2025
1 parent a4ffaab commit 4af2e74
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 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
3 changes: 1 addition & 2 deletions addons/intelitems/functions/fnc_handleLoadout.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ private _allIndices = [];

// Handle magazine ids with missing index assignments
private _cfgMagazines = configFile >> "CfgMagazines";
private _magazines = magazines _player;

{
if (getNumber (_cfgMagazines >> _x >> QGVAR(intel)) == 1) then {
Expand All @@ -39,7 +38,7 @@ private _magazines = magazines _player;
};
} forEach _magazineIds;
};
} forEach (_magazines arrayIntersect _magazines);
} forEach ([_player, 2] call EFUNC(common,uniqueItems));

// Close any open controls if player no longer has needed magazine
{
Expand Down

0 comments on commit 4af2e74

Please sign in to comment.