Skip to content

Commit 0fd6a51

Browse files
committed
refactor: extract exclude check into local variable
Avoids redundant getVariable call on the unit object per review feedback.
1 parent 482f3c3 commit 0fd6a51

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

addons/recorder/fnc_captureLoop.sqf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,12 @@ GVAR(PFHObject) = [
113113
_justInitialized = true;
114114
};
115115
// Re-include units that have become player-controlled again (e.g., reconnected players)
116-
if (_x getVariable [QGVARMAIN(exclude), false] && {isPlayer _x}) then {
116+
private _isExcluded = _x getVariable [QGVARMAIN(exclude), false];
117+
if (_isExcluded && {isPlayer _x}) then {
117118
_x setVariable [QGVARMAIN(exclude), false];
119+
_isExcluded = false;
118120
};
119-
if (!_justInitialized && {!(_x getVariable [QGVARMAIN(exclude), false])}) then {
121+
if (!_justInitialized && {!_isExcluded}) then {
120122
private _unitRole = _x getVariable [QGVARMAIN(unitType), ""];
121123
if (GVAR(captureFrameNo) % 10 == 0 || _unitRole == "") then {
122124
_unitRole = [_x] call FUNC(getUnitType);

0 commit comments

Comments
 (0)