Merge pull request #7523 from Whigital/isnil_conformity

Various - Conform isNil checks across the codebase
This commit is contained in:
commy2 2020-02-19 18:09:05 +01:00 committed by GitHub
commit c73f64617f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 45 additions and 45 deletions

View File

@ -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;
@ -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"];

View File

@ -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;

View File

@ -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;

View File

@ -46,7 +46,7 @@ private _hideUnusedFnc = {
} forEach _numbers;
};
if !(isNil "_itemCfg") then {
if (!isNil "_itemCfg") then {
private _handleStatsFnc = {
params ["_statsIndex", "_leftPanel"];

View File

@ -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;
};

View File

@ -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");

View File

@ -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);

View File

@ -53,7 +53,7 @@ private _continue = if (_item isEqualType objNull) then {
};
} forEach _loaded;
FILTER(_loaded,_x != nil);
FILTER(_loaded,!isNil "_x");
true
};

View File

@ -43,7 +43,7 @@ if (_checkNil) then {
private _nilCheckedList = [];
{
if !(isNil _x) then {
if (!isNil _x) then {
_nilCheckedList pushBack (missionNamespace getVariable _x);
};
false

View File

@ -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);
};

View File

@ -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);

View File

@ -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 {

View File

@ -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];
};

View File

@ -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);
@ -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");};

View File

@ -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 = {
@ -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 {

View File

@ -16,7 +16,7 @@
*/
// 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"];
@ -24,7 +24,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 {

View File

@ -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]];

View File

@ -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];

View File

@ -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 {

View File

@ -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 {

View File

@ -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;
};

View File

@ -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) = [{

View File

@ -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

View File

@ -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);
@ -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;
@ -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;
};
};

View File

@ -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;
};

View File

@ -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"];

View File

@ -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);

View File

@ -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);
};

View File

@ -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;
};

View File

@ -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 {