Skip to content

Commit

Permalink
use forEach instead of Count
Browse files Browse the repository at this point in the history
  • Loading branch information
jokoho48 committed Apr 19, 2024
1 parent 90c44c8 commit d1c68cf
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 22 deletions.
6 changes: 2 additions & 4 deletions addons/Streamator/Spectator/TFAR/fn_serverInitTFAR.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@ publicVariable QGVAR(radioNamespace);
_units deleteAt _index;
GVAR(radioNamespace) setVariable [_x, _units, true];
};
nil;
} count (_oldData - _notChanged);
} forEach (_oldData - _notChanged);

{
private _units = GVAR(radioNamespace) getVariable [_x, []];
_units pushBackUnique _unit;
GVAR(radioNamespace) setVariable [_x, _units, true];
nil
} count (_data - _notChanged);
} forEach (_data - _notChanged);
}] call CFUNC(addEventhandler);
6 changes: 2 additions & 4 deletions addons/Streamator/Spectator/TFAR/fn_updateTFARFreq.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ private _freqLR = [];
if (_adChannel > -1 && {_adChannel == (_x call TFAR_fnc_getSwChannel)}) then {
_freqSW pushBackUnique [format ["%1%2", [_x, _adChannel + 1] call TFAR_fnc_GetChannelFrequency, _rc], _x call TFAR_fnc_getAdditionalSwStereo, _x];
};
nil;
} count (CLib_Player call TFAR_fnc_radiosList);
} forEach (CLib_Player call TFAR_fnc_radiosList);

{
private _adChannel = _x call TFAR_fnc_getAdditionalLrChannel;
Expand All @@ -35,8 +34,7 @@ private _freqLR = [];
if (_adChannel > -1 && {_adChannel != (_x call TFAR_fnc_getLrChannel)}) then {
_freqLR pushBackUnique [format ["%1%2", [_x, _adChannel + 1] call TFAR_fnc_GetChannelFrequency, _rc], _x call TFAR_fnc_getAdditionalLrStereo, typeOf (_x select 0)];
};
nil;
} count (CLib_Player call TFAR_fnc_lrRadiosList);
} forEach (CLib_Player call TFAR_fnc_lrRadiosList);

if (_freqSW isEqualTo []) then {
_freqSW pushBackUnique "No_SW_Radio";
Expand Down
9 changes: 3 additions & 6 deletions addons/Streamator/Spectator/UI/fn_buildRadioInfoUI.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ _ctrlRadioInfoGrp ctrlCommit 0;
[{
ctrlDelete _this;
}, 0.2, _x] call CFUNC(wait);
nil;
} count _elements;
} forEach _elements;
_ctrlGroup setVariable [QGVAR(elements), []];
}, [_ctrlRadioFollowUnit, _ctrlRadioInfoGrp]] call CFUNC(addEventhandler);

Expand Down Expand Up @@ -138,8 +137,7 @@ _ctrlRadioInfoGrp ctrlCommit 0;
};
};
};
nil;
} count _elements;
} forEach _elements;
if (_elementFound) then {
_elements = _elements - [_element];
};
Expand Down Expand Up @@ -184,8 +182,7 @@ _ctrlRadioInfoGrp ctrlCommit 0;
};
};
};
nil;
} count _elements;
} forEach _elements;
if (_elementFound > 0) then {
_elements = _elements - _element;
};
Expand Down
2 changes: 1 addition & 1 deletion addons/Streamator/Spectator/UI/fn_buildUI.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ _ctrlGrp ctrlCommit 0;
_tempCtrl ctrlSetPosition _x;
_tempCtrl ctrlSetText "#(argb,8,8,3)color(0,0,0,1)";
_tempCtrl ctrlCommit 0;
} count [
} forEach [
[0, PY(BORDERWIDTH), PX(BORDERWIDTH), safeZoneH - PY(2 * BORDERWIDTH)],
[safeZoneW - PX(BORDERWIDTH), PY(BORDERWIDTH), PX(BORDERWIDTH), safeZoneH - PY(2 * BORDERWIDTH)],
[0, 0, safeZoneW, PY(BORDERWIDTH)],
Expand Down
3 changes: 1 addition & 2 deletions addons/Streamator/Spectator/User/fn_addCustom3dIcon.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ private _buildedIcons = [];
};
_x set [13, compile _codeStr];
_buildedIcons pushBack _x;
nil
} count _icons;
} forEach _icons;

[
_id,
Expand Down
3 changes: 1 addition & 2 deletions addons/Streamator/UnitTracker/fn_addGroupToTracker.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ private _shortGroupId = format ["%1 %2", _firstGroupIdElement select [0, 1], _gr

{
_x ctrlCommit 0;
nil;
} count [_ctrlGrp, _ctrlSquadName, _ctrlBgBottom, _ctrlMemberList];
} forEach [_ctrlGrp, _ctrlSquadName, _ctrlBgBottom, _ctrlMemberList];

ctrlSetFocus _ctrlGrp;

Expand Down
3 changes: 1 addition & 2 deletions addons/Streamator/UnitTracker/fn_addVehicleToTracker.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ private _vehIconHover = ["ICON", "\a3\ui_f\data\igui\cfg\islandmap\iconplayer_ca

{
_x ctrlCommit 0;
nil;
} count [_ctrlGrp, _ctrlVehicleName, _ctrlTotalSeats, _ctrlBgBottom, _ctrlMemberList];
} forEach [_ctrlGrp, _ctrlVehicleName, _ctrlTotalSeats, _ctrlBgBottom, _ctrlMemberList];

ctrlSetFocus _ctrlGrp;

Expand Down
2 changes: 1 addition & 1 deletion addons/Streamator/UnitTracker/fn_updateIcons.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ DUMP("Update Icons");
{
// DUMP("ICON REMOVED: " + _x);
[_x] call CFUNC(removeMapGraphicsGroup);
} count GVAR(processedIcons);
} forEach GVAR(processedIcons);
GVAR(processedIcons) = [];

private _units = +allUnits;
Expand Down

0 comments on commit d1c68cf

Please sign in to comment.