diff --git a/addons/ai/fnc_taskPatrol.sqf b/addons/ai/fnc_taskPatrol.sqf index 815637939..42252fddf 100644 --- a/addons/ai/fnc_taskPatrol.sqf +++ b/addons/ai/fnc_taskPatrol.sqf @@ -54,10 +54,10 @@ _position = _position call CBA_fnc_getPos; } forEach units _group; // Can pass parameters straight through to addWaypoint -_this =+ _this; -_this set [2,-1]; -if (count _this > 3) then { - _this deleteAt 3; +private _args = +_this; +_args set [2,-1]; +if (count _args > 3) then { + _args deleteAt 3; }; // Using angles create better patrol patterns @@ -71,12 +71,12 @@ for "_i" from 1 to _count do { // Alternate sides of circle & modulate offset private _theta = (_i % 2) * 180 + sin (deg (_step * _i)) * _offset + _step * _i; - _this set [1, _position getPos [_rad, _theta]]; - _this call CBA_fnc_addWaypoint; + _args set [1, _position getPos [_rad, _theta]]; + _args call CBA_fnc_addWaypoint; }; // Close the patrol loop -_this set [1, _position]; -_this set [2, _radius]; -_this set [3, "CYCLE"]; -_this call CBA_fnc_addWaypoint; +_args set [1, _position]; +_args set [2, _radius]; +_args set [3, "CYCLE"]; +_args call CBA_fnc_addWaypoint; diff --git a/addons/common/fnc_directCall.sqf b/addons/common/fnc_directCall.sqf index d4eda2224..94762994d 100644 --- a/addons/common/fnc_directCall.sqf +++ b/addons/common/fnc_directCall.sqf @@ -22,14 +22,14 @@ Author: commy2 ---------------------------------------------------------------------------- */ -params [["_CBA_code", {}, [{}]], ["_this", []]]; +params [["_CBA_code", {}, [{}]], ["_CBA_args", []]]; private "_CBA_return"; isNil { // Wrap the _CBA_code in an extra call block to prevent problems with exitWith and apply //IGNORE_PRIVATE_WARNING ["_x"]; - _CBA_return = ([_x] apply {call _CBA_code}) select 0; + _CBA_return = ([_x] apply {_CBA_args call _CBA_code}) select 0; }; if (!isNil "_CBA_return") then {_CBA_return}; diff --git a/addons/common/fnc_getTerrainProfile.sqf b/addons/common/fnc_getTerrainProfile.sqf index 2145dd2f9..6fdba4bda 100644 --- a/addons/common/fnc_getTerrainProfile.sqf +++ b/addons/common/fnc_getTerrainProfile.sqf @@ -22,13 +22,11 @@ Author: ---------------------------------------------------------------------------- */ -params ["_posA","_posB"]; +params ["_posA","_posB", ["_resolution", 10]]; _posA = _posA call CBA_fnc_getPos; _posB = _posB call CBA_fnc_getPos; _posA set [2,0]; _posB set [2,0]; -DEFAULT_PARAM(2,_resolution,10); - private _angle = [_posA, _posB] call BIS_fnc_dirTo; private _2Ddistance = [_posA, _posB] call BIS_fnc_distance2D; diff --git a/addons/diagnostic/XEH_preInit.sqf b/addons/diagnostic/XEH_preInit.sqf index 3f09384da..f111b1a60 100644 --- a/addons/diagnostic/XEH_preInit.sqf +++ b/addons/diagnostic/XEH_preInit.sqf @@ -27,9 +27,9 @@ if (getMissionConfigValue ["EnableTargetDebug", 0] == 1 || {getNumber (configFil private _timeStart = diag_tickTime; private _returnString = _statementText call { private ["_clientID", "_statementText", "_varName", "_timeStart", "_x"]; // prevent these variables from being overwritten - _this = ([nil] apply compile _this) select 0; - if (isNil "_this") exitWith {""}; - str _this + private _str = ([nil] apply compile _this) select 0; + if (isNil "_str") exitWith {""}; + str _str }; _returnString = _returnString select [0, 1000]; // limit string length private _duration = diag_tickTime - _timeStart; diff --git a/addons/diagnostic/fnc_test.sqf b/addons/diagnostic/fnc_test.sqf index 183c01136..89ac5e465 100644 --- a/addons/diagnostic/fnc_test.sqf +++ b/addons/diagnostic/fnc_test.sqf @@ -37,8 +37,7 @@ Author: // ---------------------------------------------------------------------------- -DEFAULT_PARAM(0,_addon,"cba"); -DEFAULT_PARAM(1,_component,"main"); +params [["_addon", "cba"], ["_component", "main"]]; LOG('===== STARTING TESTS ====='); diff --git a/addons/diagnostic/test_parameters.sqf b/addons/diagnostic/test_parameters.inc.sqf similarity index 100% rename from addons/diagnostic/test_parameters.sqf rename to addons/diagnostic/test_parameters.inc.sqf diff --git a/addons/main/script_macros_common.hpp b/addons/main/script_macros_common.hpp index 2683f3b03..ef31234b4 100644 --- a/addons/main/script_macros_common.hpp +++ b/addons/main/script_macros_common.hpp @@ -1335,7 +1335,7 @@ Macros: PARAMS_n() /* ------------------------------------------- Macro: DEFAULT_PARAM() - DEPRECATED - Use param/params commands added in Arma 3 1.48 + DEPRECATED - Use param/params commands added in Arma 3 1.48 - Will not work with HEMTT 1.13.2+ Getting a default function parameter. This may be used together with to have a mix of required and optional parameters. diff --git a/addons/ui/fnc_notify.sqf b/addons/ui/fnc_notify.sqf index 0dc44f040..8b2c6c0c5 100644 --- a/addons/ui/fnc_notify.sqf +++ b/addons/ui/fnc_notify.sqf @@ -39,13 +39,15 @@ if (canSuspend) exitWith { if (!hasInterface) exitWith {}; +private _args = _this; + // compose structured text if !(_this isEqualType []) then { - _this = [_this]; + _args = [_this]; }; if !(_this select 0 isEqualType []) then { - _this = [_this]; + _args = [_this]; }; private _composition = []; @@ -83,7 +85,7 @@ private _skippable = false; } else { _composition pushBack parseText format ["%1", _text, _size, _color]; }; -} forEach _this; +} forEach _args; _composition deleteAt 0; diff --git a/addons/ui/fnc_openItemContextMenu.sqf b/addons/ui/fnc_openItemContextMenu.sqf index b405bb25a..12d9f49e7 100644 --- a/addons/ui/fnc_openItemContextMenu.sqf +++ b/addons/ui/fnc_openItemContextMenu.sqf @@ -111,11 +111,11 @@ private _unit = call CBA_fnc_currentUnit; // Execute context menu option statement on selection. _list setVariable [QFUNC(activate), { params ["_list", "_index"]; - _list getVariable (_list lbData _index) params ["_condition", "_statement", "_consume", "_this"]; + _list getVariable (_list lbData _index) params ["_condition", "_statement", "_consume", "_args"]; - if (_this call _condition) then { + if (_args call _condition) then { if (_consume) then { - params ["_unit", "_container", "_item", "_slot"]; + _args params ["_unit", "_container", "_item", "_slot"]; if !([_unit, _item, _slot, _container] call CBA_fnc_consumeItem) then { ERROR_2("Cannot consume item %1 from %2.",_item,_slot); @@ -125,9 +125,9 @@ _list setVariable [QFUNC(activate), { // Call statement and safe check return value. private _keepOpen = [nil] apply { - private _this = [_this, _statement]; + private _args = [_args, _statement]; private ["_list", "_index", "_condition", "_statement", "_consume"]; - (_this select 0) call (_this select 1) // return + (_args select 0) call (_args select 1) // return } param [0, false] isEqualTo true; // If statement returned true, keep context menu open, otherwise close. @@ -135,7 +135,7 @@ _list setVariable [QFUNC(activate), { // Keep focus to prevent auto closing. ctrlSetFocus _list; } else { - [{ctrlDelete _this}, _list] call CBA_fnc_execNextFrame; + [{ctrlDelete _args}, _list] call CBA_fnc_execNextFrame; }; }; }]; diff --git a/addons/xeh/fnc_init.sqf b/addons/xeh/fnc_init.sqf index 45db4f488..6025e6054 100644 --- a/addons/xeh/fnc_init.sqf +++ b/addons/xeh/fnc_init.sqf @@ -21,33 +21,33 @@ Author: commy2 ---------------------------------------------------------------------------- */ -params ["_this"]; +params ["_object"]; -if (_this call CBA_fnc_isTerrainObject) exitWith { - INFO_2("Abort init event for terrain object %1. Class: %2.",_this,typeOf _this); +if (_object call CBA_fnc_isTerrainObject) exitWith { + INFO_2("Abort init event for terrain object %1. Class: %2.",_object,typeOf _object); }; -if !(ISINITIALIZED(_this)) then { - SETINITIALIZED(_this); +if !(ISINITIALIZED(_object)) then { + SETINITIALIZED(_object); // run Init { - [_this] call _x; - } forEach (_this getVariable QGVAR(init)); + [_object] call _x; + } forEach (_object getVariable QGVAR(init)); // run InitPost or put on stack if (SLX_XEH_MACHINE select 8) then { [{ { - [_this] call _x; - } forEach (_this getVariable QGVAR(initPost)); - }, _this] call CBA_fnc_execNextFrame; + [_object] call _x; + } forEach (_object getVariable QGVAR(initPost)); + }, _object] call CBA_fnc_execNextFrame; } else { - GVAR(initPostStack) pushBack _this; + GVAR(initPostStack) pushBack _object; }; // fix for respawnVehicle clearing the object namespace - _this addEventHandler ["Respawn", { + _object addEventHandler ["Respawn", { params ["_vehicle", "_wreck"]; if (ISINITIALIZED(_vehicle)) exitWith {}; // Exit if unit respawned normaly with copied variables (e.g. humans) diff --git a/addons/xeh/fnc_postInit.sqf b/addons/xeh/fnc_postInit.sqf index 09d0417f1..0f2fe579c 100644 --- a/addons/xeh/fnc_postInit.sqf +++ b/addons/xeh/fnc_postInit.sqf @@ -45,11 +45,11 @@ isNil { // do InitPost { - _x params ["_this"]; + _x params ["_object"]; { - [_this] call _x; - } forEach (_this getVariable QGVAR(initPost)); + [_object] call _x; + } forEach (_object getVariable QGVAR(initPost)); } forEach GVAR(initPostStack); GVAR(initPostStack) = nil;