Skip to content

Commit 0617c14

Browse files
committed
use Native Hashmaps where possible
1 parent 62110ed commit 0617c14

6 files changed

+9
-9
lines changed

addons/Streamator/Spectator/Menu/fn_addMenuItem.sqf

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@
2121
*/
2222
params ["_name", "_path", ["_dik", DIK_F1], ["_onUse", {LOG("Nothing here.")}, [{}, ""]], ["_onRender", {true}, [{}]], ["_hasSubMenus", false], ["_args", []]];
2323
if (isNil QGVAR(menuEntries)) then {
24-
GVAR(menuEntries) = false call CFUNC(createNamespace);
25-
GVAR(menuEntries) setVariable ["MAIN", []];
24+
GVAR(menuEntries) = createHashMap;
25+
GVAR(menuEntries) set ["MAIN", []];
2626
};
2727

28-
private _entry = GVAR(menuEntries) getVariable [_path, []];
28+
private _entry = GVAR(menuEntries) get [_path, []];
2929

3030
if ((_entry findIf {(_x select 0) == _dik}) != -1) exitWith {
3131
["Menu Item %1/%2 reused Keybinding %3", _path, _name, call compile (keyName _dik)] call BIS_fnc_error;
3232
[_name, _path, _dik + 1, _onUse, _onRender, _hasSubMenus, _args] call FUNC(addMenuItem);
3333
};
3434
_entry pushBack [_dik, _name, _onUse, _onRender, _hasSubMenus, _args];
3535
_entry sort true;
36-
GVAR(menuEntries) setVariable [_path, _entry];
36+
GVAR(menuEntries) set [_path, _entry];

addons/Streamator/Spectator/Menu/fn_executeEntry.sqf

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
1515
*/
1616
params ["_path", "_keyCode"];
17-
private _entries = GVAR(menuEntries) getVariable [_path, []];
17+
private _entries = GVAR(menuEntries) get [_path, []];
1818
{
1919
_x params ["_dik", "", "_onUse", "_onRender", "", "_args"];
2020
if (_dik == _keyCode) then {

addons/Streamator/Spectator/Menu/fn_renderMenu.sqf

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ params [["_path", "", [""]], ["_mainPrefixText", ""]];
1717
if (_path isEqualTo "") then {
1818
"MAIN" call FUNC(renderMenu);
1919
};
20-
private _entry = GVAR(menuEntries) getVariable [_path, []];
20+
private _entry = GVAR(menuEntries) get [_path, []];
2121
if (_entry isEqualTo []) exitWith {
2222
"MAIN" call FUNC(renderMenu);
2323
};

addons/Streamator/Spectator/fn_openSpectator.sqf

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ if (isNil QGVAR(SideColorsString)) then {
3333
};
3434

3535
if (isNil QGVAR(PositionMemory)) then {
36-
GVAR(PositionMemory) = false call CFUNC(createNamespace);
36+
GVAR(PositionMemory) = createHashMap;
3737
};
3838

3939
if (GVAR(aceMapGesturesLoaded)) then {

addons/Streamator/Spectator/fn_restorePosition.sqf

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
params ["_slot", "_smoothTranslation"];
1717

18-
private _element = GVAR(PositionMemory) getVariable (str _slot);
18+
private _element = GVAR(PositionMemory) get (str _slot);
1919
if (isNil "_element") exitWith {};
2020

2121
if (count _element != 12) exitWith {};

addons/Streamator/Spectator/fn_savePosition.sqf

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ private _element = [
2929
GVAR(ShoulderOffset),
3030
GVAR(TopDownOffset)
3131
];
32-
GVAR(PositionMemory) setVariable [str _slot, _element];
32+
GVAR(PositionMemory) set [str _slot, _element];

0 commit comments

Comments
 (0)