Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intel Items - Minor optimisations #10637

Merged
merged 2 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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));
LinkIsGrim marked this conversation as resolved.
Show resolved Hide resolved

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