Skip to content

Commit c5b18fe

Browse files
authored
fix: vehicle class exclusion broken when kindOf list is empty (#81)
* fix: vehicle class exclusion check failing when kindOf exclusion list is empty The `_vic` variable (reference to the vehicle being checked) was declared inside the `excludeKindFromRecord` conditional block. When that setting was empty, the block never executed, leaving `_vic` undefined. The subsequent `excludeClassFromRecord` check silently failed because `typeOf nil` returns "" which never matches any class name. This caused ACE_friesAnchorBar entities (and any other class-excluded vehicles) to be recorded despite being in the exclusion list, resulting in phantom black helicopter icons overlapping real helicopters in playback. Also sync the excludeClassFromRecord default value to include WeaponHolderSimulated as the setting description already documents. * perf: cache parseSimpleArray results for exclude checks Avoid calling parseSimpleArray twice per setting (once for the emptiness check, once for forEach) on every vehicle every frame.
1 parent 9ccbe8f commit c5b18fe

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

addons/recorder/XEH_preInit.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ GVAR(allSettings) = [
149149
"Array of object classnames that should be excluded from recording. Use single quotes! Default: ['ACE_friesAnchorBar', 'WeaponHolderSimulated']"
150150
],
151151
[COMPONENT_NAME, "Exclusions"], // Pretty name of the category where the setting can be found. Can be stringtable entry.
152-
"['ACE_friesAnchorBar']", // default string value
152+
"['ACE_friesAnchorBar','WeaponHolderSimulated']", // default string value
153153
true, // "_isGlobal" flag. Set this to true to always have this setting synchronized between all clients in multiplayer
154154
{}, // function that will be executed once on mission start and every time the setting is changed.
155155
false // requires restart to apply

addons/recorder/fnc_captureLoop.sqf

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,22 +180,24 @@ GVAR(PFHObject) = [
180180
if !(_x getVariable [QGVARMAIN(isInitialized), false]) then {
181181
_vehType = typeOf _x;
182182
_class = _vehType call FUNC(getClass);
183+
private _vic = _x;
183184
private _toExcludeKind = false;
184-
if (parseSimpleArray EGVAR(settings,excludeKindFromRecord) isNotEqualTo []) then {
185-
private _vic = _x;
185+
private _kindList = parseSimpleArray EGVAR(settings,excludeKindFromRecord);
186+
if (_kindList isNotEqualTo []) then {
186187
{
187188
if (_vic isKindOf _x) exitWith {
188189
_toExcludeKind = true;
189190
};
190-
} forEach (parseSimpleArray EGVAR(settings,excludeKindFromRecord));
191+
} forEach _kindList;
191192
};
192193
private _toExcludeClass = false;
193-
if (parseSimpleArray EGVAR(settings,excludeClassFromRecord) isNotEqualTo []) then {
194+
private _classList = parseSimpleArray EGVAR(settings,excludeClassFromRecord);
195+
if (_classList isNotEqualTo []) then {
194196
{
195197
if (typeOf _vic == _x) exitWith {
196198
_toExcludeClass = true;
197199
};
198-
} forEach (parseSimpleArray EGVAR(settings,excludeClassFromRecord));
200+
} forEach _classList;
199201
};
200202
if ((_class isEqualTo "unknown") || _toExcludeKind || _toExcludeClass) exitWith {
201203
LOG(ARR2("WARNING: vehicle is defined as 'unknown' or exclude:",_vehType));

0 commit comments

Comments
 (0)