Updated type checks in line with recommendation from johnb432

This commit is contained in:
lambdatiger 2024-01-15 17:36:02 -06:00
parent 3874146b23
commit 133f0b1da4
3 changed files with 12 additions and 13 deletions

View File

@ -33,13 +33,13 @@ if (_isSidePlayer) then {
[
{
if (isGamePaused) exitWith {};
params ["_par", "_handle"];
_par params ["_projectile"];
params ["_params", "_handle"];
_params params ["_projectile"];
if (!alive _projectile) exitWith {
[_handle] call CBA_fnc_removePerFrameHandler;
};
private _projectileArray = GVAR(dev_trackLines) getOrDefault [(getObjectID _projectile), -1];
if (typeName _projectileArray == "SCALAR") exitWith {};
if (_projectileArray isEqualType 0) exitWith {};
(_projectileArray#0) pushBack getPosATL _projectile;
},
0,

View File

@ -41,14 +41,14 @@ GVAR(dev_trackLines) set [getObjectID _object, [1, [getposATL _object], _colorAr
[
{
if (isGamePaused) exitWith {};
params ["_par", "_handle"];
_par params ["_object"];
params ["_params", "_handle"];
_params params ["_object"];
if (!alive _object) exitWith {
[_handle] call CBA_fnc_removePerFrameHandler;
};
private _arr = GVAR(dev_trackLines) getOrDefault [(getObjectID _object), -1];
if (typeName _arr isEqualTo "SCALAR") exitWith {
if (_arr isEqualType 0) exitWith {
[_handle] call CBA_fnc_removePerFrameHandler;
};

View File

@ -30,11 +30,10 @@ if (count _convArray == 0 ) exitWith {
// Add CBA setting blacklist to blacklist and log errors
private _errors = 0;
private _items = count _convArray;
for "_i" from 0 to _items - 1 do {
private _ammo = _convArray#_i;
if (typeName _ammo isNotEqualTo "STRING") then {
INFO_1("Improper ammo string at index %1", _i);
forEach {
private _ammo = _x;
if (!(_ammo isEqualType "")) then {
INFO_1("Improper ammo string at index %1", _forEachIndex);
INC(_errors);
continue;
};
@ -46,6 +45,6 @@ for "_i" from 0 to _items - 1 do {
};
GVAR(shouldFragCache) set [_convArray#_i, false];
};
} forEach ;
INFO_2("Initialized blacklist. Total items found: %1, number of items failed: %2", _items, _errors);
INFO_2("Initialized blacklist. Total items found: %1, number of items failed: %2", count _convArray, _errors);