Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various - Conform isNil checks across the codebase #7523

Merged
merged 22 commits into from
Feb 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions addons/arsenal/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ GVAR(lastSearchTextLoadouts) = "";
[QGVAR(loadoutUnshared), {
params ["_contentPanelCtrl" , "_playerName", "_loadoutName"];

if (!(isNil QGVAR(currentLoadoutsTab)) && {GVAR(currentLoadoutsTab) == IDC_buttonSharedLoadouts}) then {
if (!isNil QGVAR(currentLoadoutsTab) && {GVAR(currentLoadoutsTab) == IDC_buttonSharedLoadouts}) then {

private _dataToCheck = _playerName + _loadoutName;

Expand Down Expand Up @@ -52,7 +52,7 @@ GVAR(lastSearchTextLoadouts) = "";
params ["_contentPanelCtrl" ,"_loadoutArgs"];
_loadoutArgs params ["_playerName", "_loadoutName", "_loadoutData"];

if (!(isNil QGVAR(currentLoadoutsTab)) && {GVAR(currentLoadoutsTab) == IDC_buttonSharedLoadouts}) then {
if (!isNil QGVAR(currentLoadoutsTab) && {GVAR(currentLoadoutsTab) == IDC_buttonSharedLoadouts}) then {

private _curSelData =_contentPanelCtrl lnbData [(lnbCurSelRow _contentPanelCtrl), 1];
([_loadoutData] call FUNC(verifyLoadout)) params ["_loadout", "_nullItemsAmount", "_unavailableItemsAmount"];
Expand Down
2 changes: 1 addition & 1 deletion addons/arsenal/functions/fnc_fillLeftPanel.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ params ["_display", "_control"];

private _ctrlIDC = ctrlIDC _control;

if !(isNil QGVAR(currentLeftPanel)) then {
if (!isNil QGVAR(currentLeftPanel)) then {
private _previousCtrlBackground = _display displayCtrl (GVAR(currentLeftPanel) - 1);
_previousCtrlBackground ctrlSetFade 1;
_previousCtrlBackground ctrlCommit FADE_DELAY;
Expand Down
2 changes: 1 addition & 1 deletion addons/arsenal/functions/fnc_fillRightPanel.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ params ["_display", "_control"];
private _ctrlIDC = ctrlIDC _control;

// Fade old control background
if !(isNil QGVAR(currentRightPanel)) then {
if (!isNil QGVAR(currentRightPanel)) then {
private _previousCtrlBackground = _display displayCtrl (GVAR(currentRightPanel) - 1);
_previousCtrlBackground ctrlSetFade 1;
_previousCtrlBackground ctrlCommit FADE_DELAY;
Expand Down
2 changes: 1 addition & 1 deletion addons/arsenal/functions/fnc_handleStats.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private _hideUnusedFnc = {
} forEach _numbers;
};

if !(isNil "_itemCfg") then {
if (!isNil "_itemCfg") then {

private _handleStatsFnc = {
params ["_statsIndex", "_leftPanel"];
Expand Down
2 changes: 1 addition & 1 deletion addons/arsenal/functions/fnc_message.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ params ["_display", "_message"];
private _messageBoxCtrl = _display displayCtrl IDC_message;
private _handle = _messageBoxCtrl getVariable QGVAR(messageBoxHandle);

if !(isNil "_handle") then {
if (!isNil "_handle") then {
terminate _handle;
};

Expand Down
4 changes: 2 additions & 2 deletions addons/arsenal/functions/fnc_onSelChangedLeft.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ private _display = ctrlParent _control;
private _item = [_control lnbData [_curSel, 0], _control lbData _curSel] select !(ctrlType _control == 102);

private _weaponDefaultRightPanel = _display displayCtrl IDC_buttonOptic;
private _selectCorrectPanelWeapon = [_weaponDefaultRightPanel, _display displayCtrl GVAR(currentRightPanel)] select (!(isNil QGVAR(currentRightPanel)) && {GVAR(currentRightPanel) in [RIGHT_PANEL_ACC_IDCS, IDC_buttonCurrentMag, IDC_buttonCurrentMag2]});
private _selectCorrectPanelWeapon = [_weaponDefaultRightPanel, _display displayCtrl GVAR(currentRightPanel)] select (!isNil QGVAR(currentRightPanel) && {GVAR(currentRightPanel) in [RIGHT_PANEL_ACC_IDCS, IDC_buttonCurrentMag, IDC_buttonCurrentMag2]});

private _containerDefaultRightPanel = _display displayCtrl IDC_buttonMisc;
private _selectCorrectPanelContainer = [_containerDefaultRightPanel, _display displayCtrl GVAR(currentRightPanel)] select (!(isNil QGVAR(currentRightPanel)) && {GVAR(currentRightPanel) in [RIGHT_PANEL_ITEMS_IDCS]});
private _selectCorrectPanelContainer = [_containerDefaultRightPanel, _display displayCtrl GVAR(currentRightPanel)] select (!isNil QGVAR(currentRightPanel) && {GVAR(currentRightPanel) in [RIGHT_PANEL_ITEMS_IDCS]});

private _fnc_clearPreviousWepMags = {
private _compatibleMags = getArray (configfile >> "cfgweapons" >> _baseWeapon >> "magazines");
Expand Down
2 changes: 1 addition & 1 deletion addons/arsenal/functions/fnc_removeBox.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (isNull _object || {isNil QGVAR(EHIDArray)}) exitWith {};
if (_global && {isMultiplayer}) then {
private _ID = (GVAR(EHIDArray) select {_x select 1 == _object}) select 0;

if !(isNil "_ID") then {
if (!isNil "_ID") then {
[_ID select 0] call CBA_fnc_removeGlobalEventJIP;
GVAR(EHIDArray) deleteAt (GVAR(EHIDArray) find _ID);
publicVariable QGVAR(EHIDArray);
Expand Down
2 changes: 1 addition & 1 deletion addons/cargo/functions/fnc_removeCargoItem.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private _continue = if (_item isEqualType objNull) then {
};
} forEach _loaded;

FILTER(_loaded,_x != nil);
FILTER(_loaded,!isNil "_x");
true
};

Expand Down
2 changes: 1 addition & 1 deletion addons/common/functions/fnc_parseList.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if (_checkNil) then {
private _nilCheckedList = [];

{
if !(isNil _x) then {
if (!isNil _x) then {
_nilCheckedList pushBack (missionNamespace getVariable _x);
};
false
Expand Down
2 changes: 1 addition & 1 deletion addons/common/functions/fnc_receiveRequest.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if (isLocalized _requestMessage) then {

hint format ["%1", _requestMessage]; // @todo ?

if !(isNil QGVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT)) then {
if (!isNil QGVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT)) then {
terminate GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT);
};

Expand Down
2 changes: 1 addition & 1 deletion addons/common/functions/fnc_resetAllDefaults.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ _unit setVariable ["ACE_isUnconscious", nil, true];
if (isPlayer _unit) then {
[true] call FUNC(setVolume);

if !(isNil QGVAR(DISABLE_USER_INPUT_COLLECTION)) then {
if (!isNil QGVAR(DISABLE_USER_INPUT_COLLECTION)) then {
// clear all disable user input
{
[_x, false] call FUNC(setDisableUserInputStatus);
Expand Down
2 changes: 1 addition & 1 deletion addons/fastroping/functions/fnc_onRopeBreak.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private _unit = {
if (_x isKindOf "CAManBase") exitWith {_x};
} forEach (attachedObjects (_brokenRope select 3));

if !(isNil "_unit") then {
if (!isNil "_unit") then {
if (_part == "top") then {
detach _unit;
} else {
Expand Down
2 changes: 1 addition & 1 deletion addons/gunbag/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ PREP_RECOMPILE_END;

[QEGVAR(arsenal,displayClosed), {

if !(isNil QGVAR(arsenalCache)) then {
if (!isNil QGVAR(arsenalCache)) then {
(backpackContainer EGVAR(arsenal,center)) setVariable [QGVAR(gunbagWeapon),GVAR(arsenalCache), true];
};

Expand Down
4 changes: 2 additions & 2 deletions addons/interact_menu/functions/fnc_compileMenu.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (_target isEqualType objNull) then {
private _namespace = GVAR(ActNamespace);

// Exit if the action menu is already compiled for this class
if !(isNil {_namespace getVariable _objectType}) exitWith {};
if (!isNil {_namespace getVariable _objectType}) exitWith {};

if (_objectType isKindOf "VirtualMan_F") exitWith { // these have config: isPlayableLogic = 1
TRACE_1("skipping playable logic",_objectType);
Expand All @@ -41,7 +41,7 @@ private _recurseFnc = {

{
private _entryCfg = _x;
if(isClass _entryCfg) then {
if (isClass _entryCfg) then {
private _displayName = getText (_entryCfg >> "displayName");
private _distance = _parentDistance;
if (isNumber (_entryCfg >> "distance")) then {_distance = getNumber (_entryCfg >> "distance");};
Expand Down
4 changes: 2 additions & 2 deletions addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (_target isEqualType objNull) then {
private _namespace = GVAR(ActSelfNamespace);

// Exit if the action menu is already compiled for this class
if !(isNil {_namespace getVariable _objectType}) exitWith {};
if (!isNil {_namespace getVariable _objectType}) exitWith {};


private _recurseFnc = {
Expand All @@ -34,7 +34,7 @@ private _recurseFnc = {

{
private _entryCfg = _x;
if(isClass _entryCfg) then {
if (isClass _entryCfg) then {
private _displayName = getText (_entryCfg >> "displayName");

private _icon = if (isArray (_entryCfg >> "icon")) then {
Expand Down
4 changes: 2 additions & 2 deletions addons/interact_menu/functions/fnc_compileMenuZeus.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
*/

// Exit if the action menu is already compiled for zeus
if !(isNil {missionNamespace getVariable [QGVAR(ZeusActions), nil]}) exitWith {};
if (!isNil {missionNamespace getVariable [QGVAR(ZeusActions), nil]}) exitWith {};

private _recurseFnc = {
params ["_actionsCfg"];
private _actions = [];

{
private _entryCfg = _x;
if(isClass _entryCfg) then {
if (isClass _entryCfg) then {
private _displayName = getText (_entryCfg >> "displayName");

private _icon = if (isArray (_entryCfg >> "icon")) then {
Expand Down
2 changes: 1 addition & 1 deletion addons/laser/functions/fnc_shootRay.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if (!(_intersects isEqualTo [])) then {
TRACE_3("", _resultPos, _distance, _intersects);

#ifdef DRAW_LASER_INFO
if !(isNil "_resultPos") then {
if (!isNil "_resultPos") then {
private _text = [_distance, 4, 0] call CBA_fnc_formatNumber;
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [0, 1, 0, 1], ASLtoAGL _resultPos, 0.5, 0.5, 0, _text, 0.4, 0.025, "TahomaB"];
drawLine3D [ASLtoAGL _posASL, ASLtoAGL _resultPos, [0,1,0,1]];
Expand Down
2 changes: 1 addition & 1 deletion addons/rearm/functions/fnc_readSupplyCounter.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ if (GVAR(supply) == 1) then {
private _numChars = count (localize LSTRING(Hint_RemainingAmmo));
private _text = "";
private _magazines = _truck getVariable QGVAR(magazineSupply);
if !(isNil "_magazines") then {
if (!isNil "_magazines") then {
{
_x params ["_magazineClass", "_rounds"];
private _line = format ["%1: %2", _magazineClass call FUNC(getMagazineName), _rounds];
Expand Down
2 changes: 1 addition & 1 deletion addons/repair/functions/fnc_canRepair.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ if (!("All" in _repairLocations)) then {
if (_x == "field") exitWith {_return = true;};
if (_x == "RepairFacility" && _repairFacility) exitWith {_return = true;};
if (_x == "RepairVehicle" && _repairVeh) exitWith {_return = true;};
if !(isNil _x) exitWith {
if (!isNil _x) exitWith {
private _val = missionNamespace getVariable _x;
if (_val isEqualType 0) then {
_return = switch (_val) do {
Expand Down
2 changes: 1 addition & 1 deletion addons/repair/functions/fnc_repair.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ if (!("All" in _repairLocations)) then {
if (_x == "field") exitWith {_return = true;};
if (_x == "RepairFacility" && _repairFacility) exitWith {_return = true;};
if (_x == "RepairVehicle" && _repairVeh) exitWith {_return = true;};
if !(isNil _x) exitWith {
if (!isNil _x) exitWith {
private _val = missionNamespace getVariable _x;
if (_val isEqualType 0) then {
_return = switch (_val) do {
Expand Down
2 changes: 1 addition & 1 deletion addons/scopes/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ GVAR(scopeAdjust) = [[[0,0],0,[0,0],0], [[0,0],0,[0,0],0], [[0,0],0,[0,0],0]];
private _layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer;
_layer cutText ["", "PLAIN", 0];

if !(isNil QGVAR(fadePFH)) then {
if (!isNil QGVAR(fadePFH)) then {
[GVAR(fadePFH)] call CBA_fnc_removePerFrameHandler;
GVAR(fadePFH) = nil;
};
Expand Down
2 changes: 1 addition & 1 deletion addons/scopes/functions/fnc_showZeroing.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ if (GVAR(simplifiedZeroing)) then {
// Set the time when to hide the knobs
GVAR(timeToHide) = diag_tickTime + 3.0;

if !(isNil QGVAR(fadePFH)) exitWith {};
if (!isNil QGVAR(fadePFH)) exitWith {};

// Launch a PFH to wait and fade out the knobs
GVAR(fadePFH) = [{
Expand Down
2 changes: 1 addition & 1 deletion addons/spectator/functions/fnc_getCameraAttributes.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* Public: Yes
*/

if !(isNil QGVAR(camera)) then {
if (!isNil QGVAR(camera)) then {
[GVAR(camMode), GVAR(camFocus), GVAR(camVision), getPosATL GVAR(camera), getDirVisual GVAR(camera)]
} else {
// These values could be pre-set by function
Expand Down
22 changes: 11 additions & 11 deletions addons/spectator/functions/fnc_setCameraAttributes.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ params [
];

// Apply if camera exists
if !(isNil QGVAR(camera)) then {
if (!isNil QGVAR(camera)) then {
// These functions are smart and handle unavailable inputs
if !(isNil "_focus") then {
if (!isNil "_focus") then {
[_focus] call FUNC(setFocus);
};

if !(isNil "_mode") then {
if (!isNil "_mode") then {
// If mode not free and no focus, find focus
if ((_mode != MODE_FREE) && {isNull GVAR(camFocus)}) then {
[true] call FUNC(setFocus);
Expand All @@ -57,19 +57,19 @@ if !(isNil QGVAR(camera)) then {
[_mode] call FUNC(cam_setCameraMode);
};

if !(isNil "_vision") then {
if (!isNil "_vision") then {
[_vision] call FUNC(cam_setVisionMode);
};

if !(isNil "_position") then {
if (!isNil "_position") then {
GVAR(camera) setPosATL _position;
};

if !(isNil "_direction") then {
if (!isNil "_direction") then {
GVAR(camera) setDir _direction;
};
} else {
if !(isNil "_focus") then {
if (!isNil "_focus") then {
// If there are no entities this becomes nil, handled on camera startup
if (_focus isEqualType true) then {
_focus = ([] call FUNC(getTargetEntities)) select 0;
Expand All @@ -78,20 +78,20 @@ if !(isNil QGVAR(camera)) then {
GVAR(camFocus) = _focus;
};

if !(isNil "_mode") then {
if (!isNil "_mode") then {
GVAR(camMode) = _mode;
};

if !(isNil "_vision") then {
if (!isNil "_vision") then {
GVAR(camVision) = _vision;
};

// GVARs exits purely for pre-setting of these attributes
if !(isNil "_position") then {
if (!isNil "_position") then {
GVAR(camPos) = ATLtoASL _position;
};

if !(isNil "_direction") then {
if (!isNil "_direction") then {
GVAR(camDir) = _direction;
};
};
2 changes: 1 addition & 1 deletion addons/spectator/functions/fnc_ui.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ while {dialog} do {
BIS_fnc_feedback_allowPP = !_init;

// Removes death blur if present
if !(isNil "BIS_DeathBlur") then {
if (!isNil "BIS_DeathBlur") then {
BIS_DeathBlur ppEffectAdjust [0];
BIS_DeathBlur ppEffectCommit 0;
};
Expand Down
2 changes: 1 addition & 1 deletion addons/spectator/functions/fnc_ui_handleMapDraw.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ GVAR(uiMapHighlighted) = _nearestEntity;
CTRL_MAP_FOOTER ctrlSetText _text;

// Draw camera icon
if !(isNil QGVAR(camera)) then {
if (!isNil QGVAR(camera)) then {
private _cameraPos = getPosASLVisual GVAR(camera);
private _cameraDir = getDirVisual GVAR(camera);
_map drawIcon [ICON_CAMERA, [0.5, 1, 0.5, 1], _cameraPos, 32, 48, _cameraDir, "", 1, 0.05, "TahomaB", "right"];
Expand Down
2 changes: 1 addition & 1 deletion addons/spectator/functions/fnc_updateCameraModes.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ if (_newModes isEqualTo []) then {
};

// Update camera in case of change
if !(isNil QGVAR(camera)) then {
if (!isNil QGVAR(camera)) then {
// If mode was free and no longer available, find a focus
if (!(MODE_FREE in _newModes) && {GVAR(camMode) == MODE_FREE} && {isNull GVAR(camFocus)}) then {
[true] call FUNC(setFocus);
Expand Down
2 changes: 1 addition & 1 deletion addons/spectator/functions/fnc_updateVisionModes.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if (_newModes isEqualTo []) then {
};

// Update camera in case of change
if !(isNil QGVAR(camera)) then {
if (!isNil QGVAR(camera)) then {
[GVAR(camVision)] call FUNC(cam_setVisionMode);
};

Expand Down
2 changes: 1 addition & 1 deletion addons/tagging/functions/fnc_createTag.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if (_object getVariable [QGVAR(testVar), false]) then {

// If the object already has tags attached, just add the new one to the list
private _attachedTags = _object getVariable QGVAR(attachedTags);
if !(isNil "_attachedTags ") exitWith {
if (!isNil "_attachedTags") exitWith {
_attachedTags pushBack _tag;
};

Expand Down
2 changes: 1 addition & 1 deletion addons/zeus/functions/fnc_moduleSuicideBomber.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ if (_autoSeek) then {
private _nearestObjects = nearestObjects [_unit, [], _range] select {side _x == _activationSide && {_x != _unit} && {alive _x}};

#ifdef DEBUG_MODE_FULL
if !(isNil "_lastMove") then {
if (!isNil "_lastMove") then {
drawLine3D [_unit modelToWorldVisual [0, 0, 1], _lastMove, [1, 0, 0, 1]];
};
for "_i" from 0 to 35 do {
Expand Down