diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf
index 05302869f2..22cf7a944e 100644
--- a/addons/common/XEH_postInit.sqf
+++ b/addons/common/XEH_postInit.sqf
@@ -80,8 +80,7 @@ if (isServer) then {
params ["_name", "_value", "_force"];
if (_force) then {
- private "_settingData";
- _settingData = [_name] call FUNC(getSettingData);
+ private _settingData = [_name] call FUNC(getSettingData);
if (_settingData isEqualTo []) exitWith {};
@@ -162,10 +161,8 @@ QGVAR(remoteFnc) addPublicVariableEventHandler {
// Check files, previous installed version etc.
//////////////////////////////////////////////////
-private ["_currentVersion", "_previousVersion"];
-
-_currentVersion = getText (configFile >> "CfgPatches" >> QUOTE(ADDON) >> "version");
-_previousVersion = profileNamespace getVariable ["ACE_VersionNumberString", ""];
+private _currentVersion = getText (configFile >> "CfgPatches" >> QUOTE(ADDON) >> "version");
+private _previousVersion = profileNamespace getVariable ["ACE_VersionNumberString", ""];
// check previous version number from profile
if (_currentVersion != _previousVersion) then {
@@ -269,8 +266,7 @@ GVAR(ScrollWheelFrame) = diag_frameno;
}] call FUNC(addEventHandler);
// add PFH to execute event that fires when the main display (46) is created
-private "_fnc_initMainDisplayCheck";
-_fnc_initMainDisplayCheck = {
+private _fnc_initMainDisplayCheck = {
[{
if !(isNull findDisplay 46) then {
// Raise ACE event locally
@@ -344,7 +340,7 @@ if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then {
BEGIN_COUNTER(stateChecker);
// "playerChanged" event
- private _data = call FUNC(player); // reuse one variable to reduce number of variables that have to be set to private each frame
+ private _data = call FUNC(player);
if !(_data isEqualTo ACE_player) then {
private _oldPlayer = ACE_player;
diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf
index 8073b9345b..1b7bdc624c 100644
--- a/addons/common/XEH_preInit.sqf
+++ b/addons/common/XEH_preInit.sqf
@@ -329,8 +329,7 @@ if (hasInterface) then {
// PFH to update the ACE_player variable
GVAR(PreInit_playerChanged_PFHID) = [{
if !(ACE_player isEqualTo (call FUNC(player))) then {
- private ["_oldPlayer"];
- _oldPlayer = ACE_player;
+ private _oldPlayer = ACE_player;
ACE_player = call FUNC(player);
uiNamespace setVariable ["ACE_player", ACE_player];
diff --git a/addons/common/functions/fnc__handleNetEvent.sqf b/addons/common/functions/fnc__handleNetEvent.sqf
index e409afe6a3..e3b2ac609c 100644
--- a/addons/common/functions/fnc__handleNetEvent.sqf
+++ b/addons/common/functions/fnc__handleNetEvent.sqf
@@ -16,15 +16,12 @@ params ["_eventType", "_event"];
if (_eventType == "ACEg") then {
_event params ["_eventName", "_eventArgs"];
+ GVAR(events) params ["_eventNames"];
- private ["_eventNames", "_eventIndex"];
-
- _eventNames = GVAR(events) select 0;
- _eventIndex = _eventNames find _eventName;
+ private _eventIndex = _eventNames find _eventName;
if (_eventIndex != -1) then {
- private "_events";
- _events = (GVAR(events) select 1) select _eventIndex;
+ private _events = (GVAR(events) select 1) select _eventIndex;
#ifdef DEBUG_EVENTS
ACE_LOGINFO_1("* Net Event %1",_eventName);
@@ -46,9 +43,8 @@ if (_eventType == "ACEc") then {
if (isServer) then {
_event params ["_eventName", "_eventTargets", "_eventArgs"];
- private ["_sentEvents", "_owner", "_serverFlagged"];
+ private _sentEvents = [];
- _sentEvents = [];
if (!IS_ARRAY(_eventTargets)) then {
_eventTargets = [_eventTargets];
};
@@ -59,9 +55,11 @@ if (_eventType == "ACEc") then {
["ACEg", ACEg] call FUNC(_handleNetEvent);
};
- _serverFlagged = false;
+ private _serverFlagged = false;
+
{
- _owner = _x;
+ private _owner = _x;
+
if (IS_OBJECT(_x)) then {
_owner = owner _x;
};
diff --git a/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf b/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf
index 4e755562b5..8c8cbd1486 100644
--- a/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf
+++ b/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf
@@ -15,10 +15,8 @@
params ["_client"];
{
- private ["_eventEntry", "_eventLog"];
-
- _eventEntry = HASH_GET(GVAR(syncedEvents),_x);
- _eventLog = _eventEntry select 1;
+ private _eventEntry = HASH_GET(GVAR(syncedEvents),_x);
+ _eventEntry params ["", "_eventLog"];
["SEH_s", _client, [_x, _eventLog]] call FUNC(targetEvent);
false
diff --git a/addons/common/functions/fnc__handleRequestSyncedEvent.sqf b/addons/common/functions/fnc__handleRequestSyncedEvent.sqf
index d4d9b2cf76..605af2fa85 100644
--- a/addons/common/functions/fnc__handleRequestSyncedEvent.sqf
+++ b/addons/common/functions/fnc__handleRequestSyncedEvent.sqf
@@ -27,10 +27,8 @@ if (isServer) then {
false
};
- private ["_eventEntry", "_eventLog"];
-
- _eventEntry = HASH_GET(GVAR(syncedEvents),_eventName);
- _eventLog = _eventEntry select 1;
+ private _eventEntry = HASH_GET(GVAR(syncedEvents),_eventName);
+ _eventEntry params ["", "_eventLog"];
["SEH_s", _client, [_eventName, _eventLog]] call FUNC(targetEvent);
} else {
diff --git a/addons/common/functions/fnc__handleSyncedEvent.sqf b/addons/common/functions/fnc__handleSyncedEvent.sqf
index a14ee2680e..41f7ed429c 100644
--- a/addons/common/functions/fnc__handleSyncedEvent.sqf
+++ b/addons/common/functions/fnc__handleSyncedEvent.sqf
@@ -21,20 +21,17 @@ if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
false
};
-private ["_internalData", "_eventCode"];
-
-_internalData = HASH_GET(GVAR(syncedEvents),_name);
+private _internalData = HASH_GET(GVAR(syncedEvents),_name);
if (isServer) then {
// Server needs to internally log it for synchronization
if (_ttl > -1) then {
_internalData = HASH_GET(GVAR(syncedEvents),_name);
- private "_eventLog";
- _eventLog = _internalData select 1;
+ _internalData params ["", "_eventLog"];
_eventLog pushBack [ACE_diagTime, _args, _ttl];
};
};
-_eventCode = _internalData select 0;
+_internalData params ["_eventCode"];
_args call _eventCode;
diff --git a/addons/common/functions/fnc_addActionEventHandler.sqf b/addons/common/functions/fnc_addActionEventHandler.sqf
index ae04933cdd..fe641010e4 100644
--- a/addons/common/functions/fnc_addActionEventHandler.sqf
+++ b/addons/common/functions/fnc_addActionEventHandler.sqf
@@ -25,10 +25,8 @@ if (_statement isEqualType "") then {
_statement = compile _statement;
};
-private ["_name", "_actionsVar"];
-
-_name = format ["ACE_Action_%1", _action];
-_actionsVar = _unit getVariable [_name, [-1, [-1, [], []], objNull]];
+private _name = format ["ACE_Action_%1", _action];
+private _actionsVar = _unit getVariable [_name, [-1, [-1, [], []], objNull]];
if (_unit != _actionsVar select 2) then { // check if the unit is still valid, fixes respawn issues
_actionsVar = [-1, [-1, [], []], objNull];
@@ -44,8 +42,7 @@ _actions pushBack [_condition, _statement];
// first action to add, unit needs addAction command
if (_actionID == -1) then {
- private "_addAction";
- _addAction = call compile format [
+ private _addAction = call compile format [
"[
'',
{if (inputAction '%1' == 0) exitWith {}; {if (_this call (_x select 0)) then {_this call (_x select 1)}} forEach (((_this select 0) getVariable '%2') select 1 select 2)},
diff --git a/addons/common/functions/fnc_addActionMenuEventHandler.sqf b/addons/common/functions/fnc_addActionMenuEventHandler.sqf
index d9beb977f7..e68507ae7b 100644
--- a/addons/common/functions/fnc_addActionMenuEventHandler.sqf
+++ b/addons/common/functions/fnc_addActionMenuEventHandler.sqf
@@ -37,23 +37,19 @@ if (_statement2 isEqualType "") then {
_statement2 = compile _statement2;
};
-private ["_name", "_actionsVar"];
-
-_name = format ["ACE_ActionMenu_%1", _action];
-_actionsVar = _unit getVariable [_name, [-1, [], []]];
+private _name = format ["ACE_ActionMenu_%1", _action];
+private _actionsVar = _unit getVariable [_name, [-1, [], []]];
_actionsVar params ["_id", "_actionIDs", "_actions"];
_id = _id + 1;
-private ["_nameVar", "_addAction", "_actionID"];
-
-_nameVar = format ["%1_ID%2", _name, _id];
+private _nameVar = format ["%1_ID%2", _name, _id];
missionNamespace setVariable [_nameVar, [_condition, _statement, _condition2, _statement2]];
_actionIDs pushBack _id;
-_addAction = call compile format [
+private _addAction = call compile format [
"[
'%2',
{if (inputAction '%1' == 0) then {if (_this call (%3 select 2)) then {_this call (%3 select 3)}} else {_this call (%3 select 1)}},
@@ -70,7 +66,7 @@ _addAction = call compile format [
_priority
];
-_actionID = _unit addAction _addAction;
+private _actionID = _unit addAction _addAction;
_actions pushBack [_actionID, _nameVar];
diff --git a/addons/common/functions/fnc_addCanInteractWithCondition.sqf b/addons/common/functions/fnc_addCanInteractWithCondition.sqf
index 740fa9bb9f..294dac1c72 100644
--- a/addons/common/functions/fnc_addCanInteractWithCondition.sqf
+++ b/addons/common/functions/fnc_addCanInteractWithCondition.sqf
@@ -17,12 +17,10 @@ params ["_conditionName", "_conditionFunc"];
_conditionName = toLower _conditionName;
-private ["_conditions", "_index"];
-
-_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
+private _conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
_conditions params ["_conditionNames", "_conditionFuncs"];
-_index = _conditionNames find _conditionName;
+private _index = _conditionNames find _conditionName;
if (_index == -1) then {
_index = count _conditionNames;
diff --git a/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf b/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf
index c739177288..1bb92130bc 100644
--- a/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf
+++ b/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf
@@ -13,8 +13,7 @@
disableSerialization;
-private "_dlg";
-_dlg = ctrlParent _this;
+private _dlg = ctrlParent _this;
_dlg displayAddEventHandler ["unload", {
if (_this select 1 == 1) then {
diff --git a/addons/common/functions/fnc_addEventHandler.sqf b/addons/common/functions/fnc_addEventHandler.sqf
index 599e937918..128f489701 100644
--- a/addons/common/functions/fnc_addEventHandler.sqf
+++ b/addons/common/functions/fnc_addEventHandler.sqf
@@ -15,17 +15,15 @@
params ["_eventName", "_eventCode"];
-private ["_eventNames", "_eventFunctions", "_eventIndex"];
+GVAR(events) params ["_eventNames"];
-_eventNames = GVAR(events) select 0;
-_eventFunctions = [];
-_eventIndex = _eventNames find _eventName;
+private _eventFunctions = [];
+private _eventIndex = _eventNames find _eventName;
if (_eventIndex != -1) then {
_eventFunctions = (GVAR(events) select 1) select _eventIndex;
} else {
- private "_eventNameCount";
- _eventNameCount = count _eventNames;
+ private _eventNameCount = count _eventNames;
_eventNames set [_eventNameCount, _eventName];
(GVAR(events) select 1) set [_eventNameCount, _eventFunctions];
diff --git a/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf b/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf
index 05e23cf099..2201426e48 100644
--- a/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf
+++ b/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf
@@ -18,8 +18,7 @@ if (_statement isEqualType "") then {
_statement = compile _statement;
};
-private "_actionsVar";
-_actionsVar = missionNamespace getVariable ["ACE_EventHandler_MapMarker", [-1, [], []]];
+private _actionsVar = missionNamespace getVariable ["ACE_EventHandler_MapMarker", [-1, [], []]];
_actionsVar params ["_id", "_actionIDs", "_actions"];
diff --git a/addons/common/functions/fnc_addScrollWheelEventHandler.sqf b/addons/common/functions/fnc_addScrollWheelEventHandler.sqf
index 45f935812f..aef88543be 100644
--- a/addons/common/functions/fnc_addScrollWheelEventHandler.sqf
+++ b/addons/common/functions/fnc_addScrollWheelEventHandler.sqf
@@ -19,8 +19,7 @@ if (_statement isEqualType "") then {
_statement = compile _statement;
};
-private "_actionsVar";
-_actionsVar = missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]];
+private _actionsVar = missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]];
_actionsVar params ["_id", "_actionIDs", "_actions"];
diff --git a/addons/common/functions/fnc_addSetting.sqf b/addons/common/functions/fnc_addSetting.sqf
index 06162de6b1..0cf25b860a 100644
--- a/addons/common/functions/fnc_addSetting.sqf
+++ b/addons/common/functions/fnc_addSetting.sqf
@@ -22,8 +22,7 @@
params ["_name", "", "", "", "", "", "", "_value"]; //["_name", "_typeName", "_isClientSetable", "_localizedName", "_localizedDescription", "_possibleValues", "_isForced", "_value"];
-private "_settingData";
-_settingData = [_name] call FUNC(getSettingData);
+private _settingData = [_name] call FUNC(getSettingData);
// Exit if the setting already exists
if (count _settingData > 0) exitWith {};
diff --git a/addons/common/functions/fnc_addSyncedEventHandler.sqf b/addons/common/functions/fnc_addSyncedEventHandler.sqf
index 801a915dc5..0964e419bc 100644
--- a/addons/common/functions/fnc_addSyncedEventHandler.sqf
+++ b/addons/common/functions/fnc_addSyncedEventHandler.sqf
@@ -21,9 +21,7 @@ if (HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
false
};
-private ["_eventId", "_data"];
-
-_eventId = [_name, FUNC(_handleSyncedEvent)] call FUNC(addEventHandler);
-_data = [_handler, [], _ttl, _eventId];
+private _eventId = [_name, FUNC(_handleSyncedEvent)] call FUNC(addEventHandler);
+private _data = [_handler, [], _ttl, _eventId];
HASH_SET(GVAR(syncedEvents),_name,_data);
diff --git a/addons/common/functions/fnc_addToInventory.sqf b/addons/common/functions/fnc_addToInventory.sqf
index 4019de93ac..9d796d6018 100644
--- a/addons/common/functions/fnc_addToInventory.sqf
+++ b/addons/common/functions/fnc_addToInventory.sqf
@@ -18,9 +18,9 @@
params ["_unit", "_classname", ["_container", ""], ["_ammoCount", -1]];
-private ["_type", "_canAdd", "_addedToUnit"];
+private _type = _classname call FUNC(getItemType);
-_type = [_classname] call FUNC(getItemType);
+private ["_canAdd", "_addedToUnit"];
switch (_container) do {
case "vest": {
@@ -59,8 +59,7 @@ switch (_type select 0) do {
} else {
_addedToUnit = false;
- private "_pos";
- _pos = _unit modelToWorldVisual [0,1,0.05];
+ private _pos = _unit modelToWorldVisual [0,1,0.05];
_unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"];
_unit addWeaponCargoGlobal [_classname, 1];
@@ -93,8 +92,7 @@ switch (_type select 0) do {
} else {
_addedToUnit = false;
- private "_pos";
- _pos = _unit modelToWorldVisual [0,1,0.05];
+ private _pos = _unit modelToWorldVisual [0,1,0.05];
_unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"];
_unit addMagazineCargoGlobal [_classname, 1/*_ammoCount*/]; //@todo Bug! This isn't really the ammo, but magazine count. No such command.
@@ -123,8 +121,7 @@ switch (_type select 0) do {
} else {
_addedToUnit = false;
- private "_pos";
- _pos = _unit modelToWorldVisual [0,1,0.05];
+ private _pos = _unit modelToWorldVisual [0,1,0.05];
_unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"];
_unit addItemCargoGlobal [_classname, 1];
diff --git a/addons/common/functions/fnc_applyForceWalkStatus.sqf b/addons/common/functions/fnc_applyForceWalkStatus.sqf
index d3b58a25a4..656e4a6d25 100644
--- a/addons/common/functions/fnc_applyForceWalkStatus.sqf
+++ b/addons/common/functions/fnc_applyForceWalkStatus.sqf
@@ -17,7 +17,6 @@
params ["_unit"];
-private "_forceWalkNumber";
-_forceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0];
+private _forceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0];
_unit forceWalk (_forceWalkNumber > 0);
diff --git a/addons/common/functions/fnc_assignObjectsInList.sqf b/addons/common/functions/fnc_assignObjectsInList.sqf
index edfeb1b709..5724521a7b 100644
--- a/addons/common/functions/fnc_assignObjectsInList.sqf
+++ b/addons/common/functions/fnc_assignObjectsInList.sqf
@@ -41,4 +41,5 @@ if (_list isEqualType "") then {
};
};
};
+ false
} count _list;
diff --git a/addons/common/functions/fnc_assignedItemFix.sqf b/addons/common/functions/fnc_assignedItemFix.sqf
index 9f804eaa4d..d93409ce7c 100644
--- a/addons/common/functions/fnc_assignedItemFix.sqf
+++ b/addons/common/functions/fnc_assignedItemFix.sqf
@@ -12,13 +12,11 @@
*/
#include "script_component.hpp"
-private "_config";
-
-ACE_isMapEnabled = call {_config = missionConfigFile >> "showMap"; !isNumber _config || {getNumber _config == 1}}; // default value is 1, so do isNumber check first
-ACE_isCompassEnabled = call {_config = missionConfigFile >> "showCompass"; !isNumber _config || {getNumber _config == 1}};
-ACE_isWatchEnabled = call {_config = missionConfigFile >> "showWatch"; !isNumber _config || {getNumber _config == 1}};
-ACE_isRadioEnabled = call {_config = missionConfigFile >> "showRadio"; !isNumber _config || {getNumber _config == 1}};
-ACE_isGPSEnabled = call {_config = missionConfigFile >> "showGPS"; !isNumber _config || {getNumber _config == 1}};
+ACE_isMapEnabled = call {private _config = missionConfigFile >> "showMap"; !isNumber _config || {getNumber _config == 1}}; // default value is 1, so do isNumber check first
+ACE_isCompassEnabled = call {private _config = missionConfigFile >> "showCompass"; !isNumber _config || {getNumber _config == 1}};
+ACE_isWatchEnabled = call {private _config = missionConfigFile >> "showWatch"; !isNumber _config || {getNumber _config == 1}};
+ACE_isRadioEnabled = call {private _config = missionConfigFile >> "showRadio"; !isNumber _config || {getNumber _config == 1}};
+ACE_isGPSEnabled = call {private _config = missionConfigFile >> "showGPS"; !isNumber _config || {getNumber _config == 1}};
GVAR(AssignedItems) = [];
GVAR(AssignedItemsInfo) = [];
diff --git a/addons/common/functions/fnc_binarizeNumber.sqf b/addons/common/functions/fnc_binarizeNumber.sqf
index aff2f9dc17..0945afa770 100644
--- a/addons/common/functions/fnc_binarizeNumber.sqf
+++ b/addons/common/functions/fnc_binarizeNumber.sqf
@@ -17,19 +17,17 @@ params ["_number", ["_minLength", 8]];
_number = round _number;
-private ["_array", "_index", "_rest"];
-
-_array = [];
+private _array = [];
_array resize _minLength;
for "_index" from 0 to (_minLength - 1) do {
_array set [_index, false];
};
-_index = 0;
+private _index = 0;
while {_number > 0} do {
- _rest = _number mod 2;
+ private _rest = _number mod 2;
_number = floor (_number / 2);
_array set [_index, _rest == 1];
diff --git a/addons/common/functions/fnc_cachedCall.sqf b/addons/common/functions/fnc_cachedCall.sqf
index 59350d0483..2c7cdd4b27 100644
--- a/addons/common/functions/fnc_cachedCall.sqf
+++ b/addons/common/functions/fnc_cachedCall.sqf
@@ -24,10 +24,8 @@ if ((_namespace getVariable [_uid, [-99999]]) select 0 < ACE_diagTime) then {
// Does the cache needs to be cleared on an event?
if (!isNil "_event") then {
- private ["_varName", "_cacheList"];
-
- _varName = format [QGVAR(clearCache_%1), _event];
- _cacheList = missionNamespace getVariable _varName;
+ private _varName = format [QGVAR(clearCache_%1), _event];
+ private _cacheList = missionNamespace getVariable _varName;
// If there was no EH to clear these caches, add one
if (isNil "_cacheList") then {
@@ -35,14 +33,13 @@ if ((_namespace getVariable [_uid, [-99999]]) select 0 < ACE_diagTime) then {
missionNamespace setVariable [_varName, _cacheList];
[_event, {
- private ["_varName", "_cacheList"];
// _eventName is defined on the function that calls the event
#ifdef DEBUG_MODE_FULL
ACE_LOGINFO_1("Clear cached variables on event: %1",_eventName);
#endif
// Get the list of caches to clear
- _varName = format [QGVAR(clearCache_%1), _eventName];
- _cacheList = missionNamespace getVariable [_varName, []];
+ private _varName = format [QGVAR(clearCache_%1), _eventName];
+ private _cacheList = missionNamespace getVariable [_varName, []];
// Erase all the cached results
{
_x call FUNC(eraseCache);
diff --git a/addons/common/functions/fnc_canGetInPosition.sqf b/addons/common/functions/fnc_canGetInPosition.sqf
index 45a2642655..c470337d6a 100644
--- a/addons/common/functions/fnc_canGetInPosition.sqf
+++ b/addons/common/functions/fnc_canGetInPosition.sqf
@@ -27,19 +27,19 @@ _position = toLower _position;
// general
if (!alive _vehicle || {locked _vehicle > 1}) exitWith {false};
-private ["_config", "_turret", "_radius", "_selectionPosition", "_selectionPosition2", "_enemiesInVehicle", "_return"];
+private ["_selectionPosition", "_selectionPosition2"];
-_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
-_turret = [];
+private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
+private _turret = [];
-_radius = 0;
+private _radius = 0;
-_enemiesInVehicle = false; //Possible Side Restriction
+private _enemiesInVehicle = false; //Possible Side Restriction
{
if (side _unit getFriend side _x < 0.6) exitWith {_enemiesInVehicle = true};
} forEach crew _vehicle;
-_return = false;
+private _return = false;
switch (_position) do {
case "driver" : {
_radius = getNumber (_config >> "getInRadius");
@@ -60,11 +60,10 @@ switch (_position) do {
};
case "gunner" : {
- private "_turretConfig";
_turret = [_vehicle] call FUNC(getTurretGunner);
if (_turret isEqualTo []) exitWith {false};
- _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath);
+ private _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath);
_radius = getNumber (_config >> "getInRadius");
_selectionPosition = _vehicle selectionPosition (getText (_turretConfig >> "memoryPointsGetInGunner"));
@@ -73,11 +72,10 @@ switch (_position) do {
};
case "commander" : {
- private "_turretConfig";
_turret = [_vehicle] call FUNC(getTurretCommander);
if (_turret isEqualTo []) exitWith {false};
- _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath);
+ private _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath);
_radius = getNumber (_config >> "getInRadius");
_selectionPosition = _vehicle selectionPosition (getText (_turretConfig >> "memoryPointsGetInGunner"));
@@ -86,11 +84,10 @@ switch (_position) do {
};
case "copilot" : {
- private "_turretConfig";
_turret = [_vehicle] call FUNC(getTurretCopilot);
if (_turret isEqualTo []) exitWith {false};
- _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath);
+ private _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath);
_radius = getNumber (_config >> "getInRadius");
_selectionPosition = _vehicle selectionPosition (getText (_turretConfig >> "memoryPointsGetInGunner"));
@@ -99,13 +96,12 @@ switch (_position) do {
};
case "turret" : {
- private ["_turrets", "_turretConfig"];
- _turrets = [_vehicle] call FUNC(getTurretsOther);
+ private _turrets = [_vehicle] call FUNC(getTurretsOther);
if (_index != -1 && {_turret = _turrets select _index;
CANGETINTURRETINDEX
}) then {
- _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath);
+ private _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath);
_radius = getNumber (_config >> "getInRadius");
_selectionPosition = _vehicle selectionPosition (getText (_turretConfig >> "memoryPointsGetInGunner"));
@@ -115,7 +111,7 @@ switch (_position) do {
for "_index" from 0 to (count _turrets - 1) do {
_turret = _turrets select _index;
if (CANGETINTURRETINDEX) exitWith {
- _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath);
+ private _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath);
_radius = getNumber (_config >> "getInRadius");
_selectionPosition = _vehicle selectionPosition (getText (_turretConfig >> "memoryPointsGetInGunner"));
@@ -127,13 +123,12 @@ switch (_position) do {
};
case "ffv" : {
- private ["_turrets", "_turretConfig"];
- _turrets = [_vehicle] call FUNC(getTurretsFFV);
+ private _turrets = [_vehicle] call FUNC(getTurretsFFV);
if (_index != -1 && {_turret = _turrets select _index;
CANGETINTURRETINDEX
}) then {
- _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath);
+ private _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath);
_radius = getNumber (_config >> "getInRadius");
_selectionPosition = _vehicle selectionPosition (getText (_turretConfig >> "memoryPointsGetInGunner"));
@@ -143,7 +138,7 @@ switch (_position) do {
for "_index" from 0 to (count _turrets - 1) do {
_turret = _turrets select _index;
if (CANGETINTURRETINDEX) exitWith {
- _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath);
+ private _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath);
_radius = getNumber (_config >> "getInRadius");
_selectionPosition = _vehicle selectionPosition (getText (_turretConfig >> "memoryPointsGetInGunner"));
@@ -155,8 +150,7 @@ switch (_position) do {
};
case "codriver" : {
- private "_positions";
- _positions = [typeOf _vehicle] call FUNC(getVehicleCodriver);
+ private _positions = [typeOf _vehicle] call FUNC(getVehicleCodriver);
{
if (alive _x) then {_positions deleteAt (_positions find (_vehicle getCargoIndex _x))};
@@ -189,8 +183,7 @@ switch (_position) do {
};
case "cargo" : {
- private "_positions";
- _positions = [typeOf _vehicle] call FUNC(getVehicleCargo);
+ private _positions = [typeOf _vehicle] call FUNC(getVehicleCargo);
{
if (alive _x) then {_positions deleteAt (_positions find (_vehicle getCargoIndex _x))};
@@ -226,14 +219,11 @@ switch (_position) do {
default {};
};
-private "_fnc_isInRange";
-_fnc_isInRange = {
+private _fnc_isInRange = {
if (_radius == 0) exitWith {true};
- private ["_unitPosition", "_distance"];
- _unitPosition = getPos _unit;
-
- _distance = _unitPosition distance (_vehicle modelToWorldVisual _selectionPosition);
+ private _unitPosition = getPos _unit;
+ private _distance = _unitPosition distance (_vehicle modelToWorldVisual _selectionPosition);
if (!isNil "_selectionPosition2") then {
_distance = _distance min (_unitPosition distance (_vehicle modelToWorldVisual _selectionPosition2));
diff --git a/addons/common/functions/fnc_canInteractWith.sqf b/addons/common/functions/fnc_canInteractWith.sqf
index 31ebf6b89f..4b4382a14e 100644
--- a/addons/common/functions/fnc_canInteractWith.sqf
+++ b/addons/common/functions/fnc_canInteractWith.sqf
@@ -18,20 +18,17 @@ params ["_unit", "_target", ["_exceptions", []]];
_exceptions = [_exceptions, {toLower _this}] call FUNC(map);
-private "_owner";
-_owner = _target getVariable [QGVAR(owner), objNull];
+private _owner = _target getVariable [QGVAR(owner), objNull];
// exit if the target is not free to interact
if (!isNull _owner && {_unit != _owner}) exitWith {false};
// check general conditions
-private ["_conditions", "_canInteract"];
-
-_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
-
+private _conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
_conditions params ["_conditionNames", "_conditionFuncs"];
-_canInteract = true;
+private _canInteract = true;
+
{
if (!(_x in _exceptions) && {!([_unit, _target] call (_conditionFuncs select _forEachIndex))}) exitWith {
_canInteract = false;
diff --git a/addons/common/functions/fnc_canUseWeapon.sqf b/addons/common/functions/fnc_canUseWeapon.sqf
index 31aaba17a2..a92d0a2b97 100644
--- a/addons/common/functions/fnc_canUseWeapon.sqf
+++ b/addons/common/functions/fnc_canUseWeapon.sqf
@@ -13,12 +13,11 @@
*/
#include "script_component.hpp"
-params ["_unit"];
+params [["_unit", objNull, [objNull]]];
if (_unit == vehicle _unit) exitWith {true};
-private "_config";
-_config = configFile >> "CfgMovesMaleSdr" >> "States" >> animationState _unit;
+private _config = configFile >> "CfgMovesMaleSdr" >> "States" >> animationState _unit;
isClass _config
&& {getNumber (_config >> "canPullTrigger") == 1}
diff --git a/addons/common/functions/fnc_changeProjectileDirection.sqf b/addons/common/functions/fnc_changeProjectileDirection.sqf
index 79b8c8aeea..89a8988306 100644
--- a/addons/common/functions/fnc_changeProjectileDirection.sqf
+++ b/addons/common/functions/fnc_changeProjectileDirection.sqf
@@ -17,14 +17,12 @@
params ["_projectile", "_adjustDir", "_adjustUp", ["_adjustSpeed",0]];
-private ["_vdir", "_dir", "_up", "_vlat", "_vup", "_vel"];
-
// get old direction vector
-_vdir = vectorNormalized velocity _projectile;
+private _vdir = vectorNormalized velocity _projectile;
// get azimuth and inclination and apply corrections
-_dir = (_vdir select 0) atan2 (_vdir select 1) + _adjustDir;
-_up = asin (_vdir select 2) + _adjustUp;
+private _dir = (_vdir select 0) atan2 (_vdir select 1) + _adjustDir;
+private _up = asin (_vdir select 2) + _adjustUp;
// get new direction vector (this is a unit vector)
_vdir = [
@@ -34,11 +32,11 @@ _vdir = [
];
// get best up vector
-_vlat = vectorNormalized (_vdir vectorCrossProduct [0,0,1]);
-_vup = _vlat vectorCrossProduct _vdir;
+private _vlat = vectorNormalized (_vdir vectorCrossProduct [0,0,1]);
+private _vup = _vlat vectorCrossProduct _vdir;
// get new speed vector. Keep total speed, but change to new direction. Yay for vector commands.
-_vel = _vdir vectorMultiply (_adjustSpeed + vectorMagnitude velocity _projectile);
+private _vel = _vdir vectorMultiply (_adjustSpeed + vectorMagnitude velocity _projectile);
// set projectile direction dir and up. Projectiles are long objects, especially with tracers, so it would look dumb otherwise.
_projectile setVectorDirAndUp [_vdir, _vup];
diff --git a/addons/common/functions/fnc_checkFiles.sqf b/addons/common/functions/fnc_checkFiles.sqf
index 2c8976f042..cdf5cb3d93 100644
--- a/addons/common/functions/fnc_checkFiles.sqf
+++ b/addons/common/functions/fnc_checkFiles.sqf
@@ -15,21 +15,18 @@
///////////////
// check addons
///////////////
-private "_version";
-_version = getText (configFile >> "CfgPatches" >> "ace_main" >> "versionStr");
+private _version = getText (configFile >> "CfgPatches" >> "ace_main" >> "versionStr");
ACE_LOGINFO_1("ACE is version %1.",_version);
-private "_addons";
-//_addons = activatedAddons; // broken with High-Command module, see #2134
-_addons = "true" configClasses (configFile >> "CfgPatches");//
+//private _addons = activatedAddons; // broken with High-Command module, see #2134
+private _addons = "true" configClasses (configFile >> "CfgPatches");//
_addons = [_addons, {toLower configName _this}] call FUNC(map);//
_addons = [_addons, {_this find "ace_" == 0}] call FUNC(filter);
{
if (getText (configFile >> "CfgPatches" >> _x >> "versionStr") != _version) then {
- private "_errorMsg";
- _errorMsg = format ["File %1.pbo is outdated.", _x];
+ private _errorMsg = format ["File %1.pbo is outdated.", _x];
ACE_LOGERROR(_errorMsg);
@@ -44,12 +41,10 @@ _addons = [_addons, {_this find "ace_" == 0}] call FUNC(filter);
// check dlls
///////////////
{
- private "_versionEx";
- _versionEx = _x callExtension "version";
+ private _versionEx = _x callExtension "version";
if (_versionEx == "") then {
- private "_errorMsg";
- _errorMsg = format ["Extension %1.dll not installed.", _x];
+ private _errorMsg = format ["Extension %1.dll not installed.", _x];
ACE_LOGERROR(_errorMsg);
@@ -84,8 +79,7 @@ if (isMultiplayer) then {
(_this select 0) params ["_version", "_addons"];
if (_version != GVAR(ServerVersion)) then {
- private "_errorMsg";
- _errorMsg = format ["Client/Server Version Mismatch. Server: %1, Client: %2.", GVAR(ServerVersion), _version];
+ private _errorMsg = format ["Client/Server Version Mismatch. Server: %1, Client: %2.", GVAR(ServerVersion), _version];
ACE_LOGERROR(_errorMsg);
diff --git a/addons/common/functions/fnc_checkPBOs.sqf b/addons/common/functions/fnc_checkPBOs.sqf
index a196e8d4ca..f447d126af 100644
--- a/addons/common/functions/fnc_checkPBOs.sqf
+++ b/addons/common/functions/fnc_checkPBOs.sqf
@@ -41,10 +41,8 @@ if (!isServer) then {
// Display error message.
if (_missingAddon || {_missingAddonServer} || {_oldVersionClient} || {_oldVersionServer}) then {
- private ["_text", "_error"];
-
- _text = "[ACE] Version mismatch:
";
- _error = format ["ACE version mismatch: %1: ", profileName];
+ private _text = "[ACE] Version mismatch:
";
+ private _error = format ["ACE version mismatch: %1: ", profileName];
if (_missingAddon) then {
_text = _text + "Detected missing addon on client
";
@@ -69,13 +67,11 @@ if (!isServer) then {
if (_mode < 2) then {
_text = composeText [lineBreak, parseText format ["%1", _text]];
- private ["_rscLayer", "_ctrlHint"];
-
- _rscLayer = "ACE_RscErrorHint" call BIS_fnc_rscLayer;
+ private _rscLayer = "ACE_RscErrorHint" call BIS_fnc_rscLayer;
_rscLayer cutRsc ["ACE_RscErrorHint", "PLAIN", 0, true];
disableSerialization;
- _ctrlHint = uiNamespace getVariable "ACE_ctrlErrorHint";
+ private _ctrlHint = uiNamespace getVariable "ACE_ctrlErrorHint";
_ctrlHint ctrlSetStructuredText _text;
if (_mode == 0) then {
diff --git a/addons/common/functions/fnc_claim.sqf b/addons/common/functions/fnc_claim.sqf
index ac89a80172..cc514a2a6f 100644
--- a/addons/common/functions/fnc_claim.sqf
+++ b/addons/common/functions/fnc_claim.sqf
@@ -16,8 +16,7 @@
params ["_unit", "_target", ["_lockTarget", false]];
-private "_owner";
-_owner = _target getVariable [QGVAR(owner), objNull];
+private _owner = _target getVariable [QGVAR(owner), objNull];
if (!isNull _owner && {!isNull _unit} && {_unit != _owner}) then {
ACE_LOGERROR("Claiming already owned object.");
diff --git a/addons/common/functions/fnc_createOrthonormalReference.sqf b/addons/common/functions/fnc_createOrthonormalReference.sqf
index 4a8db8bba1..e45bf269aa 100644
--- a/addons/common/functions/fnc_createOrthonormalReference.sqf
+++ b/addons/common/functions/fnc_createOrthonormalReference.sqf
@@ -14,10 +14,10 @@
*/
#include "script_component.hpp"
-private ["_v1", "_v2", "_v3"];
+[_this] params [["_vector", [0,0,1], [[]], 3]];
-_v1 = vectorNormalized _this;
-_v2 = vectorNormalized (_v1 vectorCrossProduct [0,0,1]);
-_v3 = _v2 vectorCrossProduct _v1;
+private _v1 = vectorNormalized _this;
+private _v2 = vectorNormalized (_v1 vectorCrossProduct [0,0,1]);
+private _v3 = _v2 vectorCrossProduct _v1;
-[_v1,_v2,_v3]
+[_v1, _v2, _v3]
diff --git a/addons/common/functions/fnc_currentChannel.sqf b/addons/common/functions/fnc_currentChannel.sqf
index 82dd66b485..a78e2b0204 100644
--- a/addons/common/functions/fnc_currentChannel.sqf
+++ b/addons/common/functions/fnc_currentChannel.sqf
@@ -15,8 +15,7 @@
#define CHANNELS ["global", "side", "command", "group", "vehicle", "direct"]
#define CHANNELS_LOCALIZED [localize "str_channel_global", localize "str_channel_side", localize "str_channel_command", localize "str_channel_group", localize "str_channel_vehicle", localize "str_channel_direct"]
-private "_currentChannel";
-_currentChannel = currentChannel;
+private _currentChannel = currentChannel;
if (_currentChannel < count CHANNELS) then {
_currentChannel = CHANNELS select _currentChannel;
diff --git a/addons/common/functions/fnc_debug.sqf b/addons/common/functions/fnc_debug.sqf
index 6dd1f04163..862f7fe764 100644
--- a/addons/common/functions/fnc_debug.sqf
+++ b/addons/common/functions/fnc_debug.sqf
@@ -18,20 +18,15 @@
params ["_msg", ["_level", 2, [0]]];
-private ["_defaultLoglevel", "_defaultLogDisplayLevel"];
-
-_defaultLoglevel = [GVAR(LOGLEVEL), DEFAULT_LOGGING_LEVEL] select isNil QGVAR(LOGLEVEL);
+private _defaultLoglevel = [GVAR(LOGLEVEL), DEFAULT_LOGGING_LEVEL] select isNil QGVAR(LOGLEVEL);
if (_defaultLoglevel < 0) exitWith {false};
-_defaultLogDisplayLevel = [GVAR(LOGDISPLAY_LEVEL), DEFAULT_TEXT_DISPLAY] select isNil QGVAR(LOGDISPLAY_LEVEL);
+private _defaultLogDisplayLevel = [GVAR(LOGDISPLAY_LEVEL), DEFAULT_TEXT_DISPLAY] select isNil QGVAR(LOGDISPLAY_LEVEL);
if (_level <= _defaultLoglevel) then {
- private ["_prefix", "_message"];
-
- _prefix = ["Unknown", "Error", "Warn", "Debug", "Info"] select ([0, 1, 2, 3] find _level + 1);
-
- _message = format ["[ACE %1] %2", _prefix, _msg];
+ private _prefix = ["Unknown", "Error", "Warn", "Debug", "Info"] select ([0, 1, 2, 3] find _level + 1);
+ private _message = format ["[ACE %1] %2", _prefix, _msg];
if (_level <= _defaultLogDisplayLevel) then {
systemChat _message;
diff --git a/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf b/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf
index 16a80d6e3f..02135e59db 100644
--- a/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf
+++ b/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf
@@ -18,9 +18,7 @@
params [["_searchOffsetOrName", 0]];
-private ["_validIndex", "_realIndex"];
-
-_validIndex = -1;
+private _validIndex = -1;
if (_searchOffsetOrName isEqualType "") then {
{
@@ -33,7 +31,7 @@ if (_searchOffsetOrName isEqualType "") then {
_baseIndex = [GVAR(deviceKeyCurrentIndex) + _searchOffsetOrName, 0] select (GVAR(deviceKeyCurrentIndex) == -1);
for "_offset" from _baseIndex to (count GVAR(deviceKeyHandlingArray) - 1 + _baseIndex) do {
- _realIndex = _offset % (count GVAR(deviceKeyHandlingArray));
+ private _realIndex = _offset % (count GVAR(deviceKeyHandlingArray));
if ([] call ((GVAR(deviceKeyHandlingArray) select _realIndex) select 2)) exitWith {
_validIndex = _realIndex;
diff --git a/addons/common/functions/fnc_disableAI.sqf b/addons/common/functions/fnc_disableAI.sqf
index 1a66628ffb..75c59d1a9a 100644
--- a/addons/common/functions/fnc_disableAI.sqf
+++ b/addons/common/functions/fnc_disableAI.sqf
@@ -16,7 +16,7 @@
*/
#include "script_component.hpp"
-params ["_unit", "_disable"];
+params [["_unit", objNull, [objNull]], ["_disable", true, [false]]];
if (!local _unit) exitWith {};
diff --git a/addons/common/functions/fnc_disableUserInput.sqf b/addons/common/functions/fnc_disableUserInput.sqf
index 8b00cedeac..8e28edc5f0 100644
--- a/addons/common/functions/fnc_disableUserInput.sqf
+++ b/addons/common/functions/fnc_disableUserInput.sqf
@@ -31,8 +31,7 @@ if (_state) then {
closeDialog 0;
createDialog QGVAR(DisableMouse_Dialog);
- private "_dlg";
- _dlg = uiNamespace getVariable QGVAR(dlgDisableMouse);
+ private _dlg = uiNamespace getVariable QGVAR(dlgDisableMouse);
_dlg displayAddEventHandler ["KeyDown", {
params ["", "_key"];
@@ -42,15 +41,13 @@ if (_state) then {
disableSerialization;
- private ["_dlg", "_ctrl"];
-
- _dlg = findDisplay 49;
+ private _dlg = findDisplay 49;
for "_index" from 100 to 2000 do {
(_dlg displayCtrl _index) ctrlEnable false;
};
- _ctrl = _dlg displayctrl 103;
+ private _ctrl = _dlg displayctrl 103;
_ctrl ctrlSetEventHandler ["buttonClick", QUOTE(while {!isNull (uiNamespace getVariable [ARR_2(QUOTE(QGVAR(dlgDisableMouse)),displayNull)])} do {closeDialog 0}; failMission 'LOSER'; [false] call DFUNC(disableUserInput);)];
_ctrl ctrlEnable true;
_ctrl ctrlSetText "ABORT";
@@ -58,7 +55,7 @@ if (_state) then {
_ctrl = _dlg displayctrl ([104, 1010] select isMultiplayer);
_ctrl ctrlSetEventHandler ["buttonClick", QUOTE(closeDialog 0; player setDamage 1; [false] call DFUNC(disableUserInput);)];
- _ctrl ctrlEnable (call {private "_config"; _config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}});
+ _ctrl ctrlEnable (call {private _config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}});
_ctrl ctrlSetText "RESPAWN";
_ctrl ctrlSetTooltip "Respawn.";
};
@@ -66,8 +63,7 @@ if (_state) then {
if (_key in actionKeys "TeamSwitch" && {teamSwitchEnabled}) then {
(uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) closeDisplay 0;
- private "_acc";
- _acc = accTime;
+ private _acc = accTime;
teamSwitch;
setAccTime _acc;
};
diff --git a/addons/common/functions/fnc_displayIcon.sqf b/addons/common/functions/fnc_displayIcon.sqf
index 23c5631fa6..c51b3bd454 100644
--- a/addons/common/functions/fnc_displayIcon.sqf
+++ b/addons/common/functions/fnc_displayIcon.sqf
@@ -45,14 +45,11 @@ disableSerialization;
params ["_iconId", "_show", "_icon", "_color", ["_timeAlive", DEFAULT_TIME]];
-private ["_list", "_refresh"];
+private _list = missionNamespace getVariable [QGVAR(displayIconList), []];
-_list = missionNamespace getVariable [QGVAR(displayIconList), []];
-
-_refresh = {
+private _refresh = {
// Refreshing of all icons..
- private "_allControls";
- _allControls = missionNamespace getVariable [QGVAR(displayIconListControls), []];
+ private _allControls = missionNamespace getVariable [QGVAR(displayIconListControls), []];
{
ctrlDelete _x;
@@ -61,18 +58,16 @@ _refresh = {
_allControls = [];
- private ["_setting", "_ctrl", "_position"];
-
- _setting = missionNamespace getVariable [QGVAR(settingFeedbackIcons), 0];
+ private _setting = missionNamespace getVariable [QGVAR(settingFeedbackIcons), 0];
if (_setting > 0) then {
{
_x params ["", "_xicon", "_xcolor"];
// +19000 because we want to make certain we are using free IDCs..
- _ctrl = (findDisplay 46) ctrlCreate ["RscPicture", _forEachIndex + 19000];
+ private _ctrl = (findDisplay 46) ctrlCreate ["RscPicture", _forEachIndex + 19000];
- _position = switch (_setting) do {
+ private _position = switch (_setting) do {
case TOP_RIGHT_DOWN: {[X_POS_ICONS, Y_POS_ICONS + (_forEachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]};
case TOP_RIGHT_LEFT: {[X_POS_ICONS_SECOND - ((_forEachIndex+3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND - (ICON_WIDTH / 2), ICON_WIDTH, ICON_WIDTH]};
case TOP_LEFT_DOWN: {[LEFT_SIDE + (0.5 * ICON_WIDTH), Y_POS_ICONS + (_forEachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]};
@@ -115,8 +110,7 @@ if (_show) then {
} else {
if ({_x select 0 == _iconId} count _list == 1) then {
- private "_newList";
- _newList = [];
+ private _newList = [];
{
if (_x select 0 != _iconId) then {
diff --git a/addons/common/functions/fnc_displayText.sqf b/addons/common/functions/fnc_displayText.sqf
index fce8fdd832..3c68327535 100644
--- a/addons/common/functions/fnc_displayText.sqf
+++ b/addons/common/functions/fnc_displayText.sqf
@@ -23,12 +23,9 @@ if (isNil QGVAR(lastHint)) then {
if !(typeName _text in ["STRING", "TEXT"]) then {_text = str _text};
-private ["_lastHintTime", "_lastHintPriority", "_time"];
+GVAR(lastHint) params ["_lastHintTime", "_lastHintPriority"];
-_lastHintTime = GVAR(lastHint) select 0;
-_lastHintPriority = GVAR(lastHint) select 1;
-
-_time = ACE_time;
+private _time = ACE_time;
if (_time > _lastHintTime + _delay || {_priority >= _lastHintPriority}) then {
hintSilent _text;
diff --git a/addons/common/functions/fnc_displayTextStructured.sqf b/addons/common/functions/fnc_displayTextStructured.sqf
index ce088163a6..9fff7bb056 100644
--- a/addons/common/functions/fnc_displayTextStructured.sqf
+++ b/addons/common/functions/fnc_displayTextStructured.sqf
@@ -35,36 +35,34 @@ if (typeName _text != "TEXT") then {
_text = composeText [lineBreak, parseText format ["%1", _text]];
};
-private ["_isShown", "_ctrlHint", "_xPos", "_yPos", "_wPos", "_hPos", "_position"];
-
-_isShown = ctrlShown (uiNamespace getVariable ["ACE_ctrlHint", controlNull]);
+private _isShown = ctrlShown (uiNamespace getVariable ["ACE_ctrlHint", controlNull]);
("ACE_RscHint" call BIS_fnc_rscLayer) cutRsc ["ACE_RscHint", "PLAIN", 0, true];
disableSerialization;
-_ctrlHint = uiNamespace getVariable "ACE_ctrlHint";
+private _ctrlHint = uiNamespace getVariable "ACE_ctrlHint";
_ctrlHint ctrlSetBackgroundColor GVAR(displayTextColor);
_ctrlHint ctrlSetTextColor GVAR(displayTextFontColor);
/*
// This does not function at the moment. Has been disabled until it fixed.
-_xPos = profilenamespace getVariable ["IGUI_GRID_ACE_displayText_X", ((safezoneX + safezoneW) - (10 *(((safezoneW / safezoneH) min 1.2) / 40)) - 2.9 *(((safezoneW / safezoneH) min 1.2) / 40))];
-_yPos = profilenamespace getVariable ["IGUI_GRID_ACE_displayText_Y", safeZoneY + 0.175 * safezoneH];
-_wPos = profilenamespace getVariable ["IGUI_GRID_ACE_displayText_W", (10 *(((safezoneW / safezoneH) min 1.2) / 40))];
-_hPos = profilenamespace getVariable ["IGUI_GRID_ACE_displayText_H", (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25))];
+private _xPos = profilenamespace getVariable ["IGUI_GRID_ACE_displayText_X", ((safezoneX + safezoneW) - (10 *(((safezoneW / safezoneH) min 1.2) / 40)) - 2.9 *(((safezoneW / safezoneH) min 1.2) / 40))];
+private _yPos = profilenamespace getVariable ["IGUI_GRID_ACE_displayText_Y", safeZoneY + 0.175 * safezoneH];
+private _wPos = profilenamespace getVariable ["IGUI_GRID_ACE_displayText_W", (10 *(((safezoneW / safezoneH) min 1.2) / 40))];
+private _hPos = profilenamespace getVariable ["IGUI_GRID_ACE_displayText_H", (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25))];
*/
-_xPos = ((safezoneX + safezoneW) - (10 *(((safezoneW / safezoneH) min 1.2) / 40)) - 2.9 *(((safezoneW / safezoneH) min 1.2) / 40));
-_yPos = safeZoneY + 0.175 * safezoneH;
-_wPos = (10 *(((safezoneW / safezoneH) min 1.2) / 40));
-_hPos = (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25));
+private _xPos = ((safezoneX + safezoneW) - (10 *(((safezoneW / safezoneH) min 1.2) / 40)) - 2.9 *(((safezoneW / safezoneH) min 1.2) / 40));
+private _yPos = safeZoneY + 0.175 * safezoneH;
+private _wPos = (10 *(((safezoneW / safezoneH) min 1.2) / 40));
+private _hPos = (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25));
// Zeus Interface Open and Display would be under the "CREATE" list
if (!isNull curatorCamera) then {
_xPos = _xPos min ((safezoneX + safezoneW - 12.5 * (((safezoneW / safezoneH) min 1.2) / 40)) - _wPos);
};
-_position = [_xPos, _yPos, _wPos, _size * _hPos];
+private _position = [_xPos, _yPos, _wPos, _size * _hPos];
_ctrlHint ctrlSetPosition _position;
_ctrlHint ctrlCommit 0;
diff --git a/addons/common/functions/fnc_dropBackpack.sqf b/addons/common/functions/fnc_dropBackpack.sqf
index 26c902a057..7b7ee5765e 100644
--- a/addons/common/functions/fnc_dropBackpack.sqf
+++ b/addons/common/functions/fnc_dropBackpack.sqf
@@ -12,11 +12,9 @@
*/
#include "script_component.hpp"
-params ["_unit"];
+params [["_unit", objNull, [objNull]]];
-private ["_backpackObject", "_holder"];
-
-_backpackObject = backpackContainer _unit;
+private _backpackObject = backpackContainer _unit;
_unit addBackpack "ACE_FakeBackpack";
removeBackpack _unit;
diff --git a/addons/common/functions/fnc_dumpPerformanceCounters.sqf b/addons/common/functions/fnc_dumpPerformanceCounters.sqf
index e076831c6f..bdc4588b05 100644
--- a/addons/common/functions/fnc_dumpPerformanceCounters.sqf
+++ b/addons/common/functions/fnc_dumpPerformanceCounters.sqf
@@ -19,8 +19,7 @@ if (!isNil "ACE_PFH_COUNTER") then {
{
_x params ["_pfh", "_parameters"];
- private "_isActive";
- _isActive = ["ACTIVE", "REMOVED"] select isNil {CBA_common_PFHhandles select (_pfh select 0)};
+ private _isActive = ["ACTIVE", "REMOVED"] select isNil {CBA_common_PFHhandles select (_pfh select 0)};
diag_log text format ["Registered PFH: id=%1 [%2, delay %3], %4:%5", _pfh select 0, _isActive, _parameters select 1, _pfh select 1, _pfh select 2];
false
@@ -31,20 +30,18 @@ diag_log text format ["ACE COUNTER RESULTS"];
diag_log text format ["-------------------------------------------"];
{
- private ["_counterEntry", "_iter", "_total", "_count", "_averageResult", "_delta"];
-
- _counterEntry = _x;
- _iter = 0;
- _total = 0;
- _count = 0;
- _averageResult = 0;
+ private _counterEntry = _x;
+ private _iter = 0;
+ private _total = 0;
+ private _count = 0;
+ private _averageResult = 0;
if (count _counterEntry > 3) then {
// calc
{
if (_iter > 2) then {
_count = _count + 1;
- _delta = (_x select 1) - (_x select 0);
+ private _delta = (_x select 1) - (_x select 0);
_total = _total + _delta;
};
@@ -69,8 +66,7 @@ diag_log text format ["-------------------------------------------"];
diag_log text format["ACE_PERFORMANCE_EXCESSIVE_STEP_TRACKER"];
diag_log text format["-------------------------------------------"];
{
- private["_delay"];
- _delay = _x select 2;
+ private _delay = _x select 2;
//if(_delay > 0) then { _delay = _delay / 1000; };
diag_log text format["%1: %2s, delay=%3, handle=%4",(_x select 0), _delay, (_x select 3), (_x select 4)];
@@ -80,8 +76,7 @@ diag_log text format["-------------------------------------------"];
diag_log text format["ACE_PERFORMANCE_EXCESSIVE_FRAME_TRACKER"];
diag_log text format["-------------------------------------------"];
{
- private["_delta"];
- _delta = _x select 1;
+ private _delta = _x select 1;
//if(_delta > 0) then { _delta = _delta / 1000; };
diag_log text format[" DELTA: %1s", _delta];
} forEach ACE_PERFORMANCE_EXCESSIVE_FRAME_TRACKER;
diff --git a/addons/common/functions/fnc_errorMessage.sqf b/addons/common/functions/fnc_errorMessage.sqf
index aa2b872d47..88e0a3b90f 100644
--- a/addons/common/functions/fnc_errorMessage.sqf
+++ b/addons/common/functions/fnc_errorMessage.sqf
@@ -37,35 +37,29 @@ if (_textMessage isEqualType "") then {
(ARR_SELECT(_this,4,call BIS_fnc_displayMission)) createDisplay "RscDisplayCommonMessagePause";
-private ["_display", "_ctrlRscMessageBox", "_ctrlBcgCommonTop", "_ctrlBcgCommon", "_ctrlText", "_ctrlBackgroundButtonOK", "_ctrlBackgroundButtonMiddle", "_ctrlBackgroundButtonCancel", "_ctrlButtonOK", "_ctrlButtonCancel"];
-
-_display = uiNamespace getVariable "RscDisplayCommonMessage_display";
-_ctrlRscMessageBox = _display displayCtrl 2351;
-_ctrlBcgCommonTop = _display displayCtrl 235100;
-_ctrlBcgCommon = _display displayCtrl 235101;
-_ctrlText = _display displayCtrl 235102;
-_ctrlBackgroundButtonOK = _display displayCtrl 235103;
-_ctrlBackgroundButtonMiddle = _display displayCtrl 235104;
-_ctrlBackgroundButtonCancel = _display displayCtrl 235105;
-_ctrlButtonOK = _display displayCtrl 235106;
-_ctrlButtonCancel = _display displayCtrl 235107;
+private _display = uiNamespace getVariable "RscDisplayCommonMessage_display";
+private _ctrlRscMessageBox = _display displayCtrl 2351;
+private _ctrlBcgCommonTop = _display displayCtrl 235100;
+private _ctrlBcgCommon = _display displayCtrl 235101;
+private _ctrlText = _display displayCtrl 235102;
+private _ctrlBackgroundButtonOK = _display displayCtrl 235103;
+private _ctrlBackgroundButtonMiddle = _display displayCtrl 235104;
+private _ctrlBackgroundButtonCancel = _display displayCtrl 235105;
+private _ctrlButtonOK = _display displayCtrl 235106;
+private _ctrlButtonCancel = _display displayCtrl 235107;
_ctrlBcgCommonTop ctrlSetText _textHeader;
-private ["_ctrlButtonOKPos", "_ctrlBcgCommonPos", "_bottomSpaceY", "_ctrlTextPos", "_marginX", "_marginY"];
+private _ctrlButtonOKPos = ctrlPosition _ctrlButtonOK;
+private _ctrlBcgCommonPos = ctrlPosition _ctrlBcgCommon;
+private _bottomSpaceY = (_ctrlButtonOKPos select 1) - ((_ctrlBcgCommonPos select 1) + (_ctrlBcgCommonPos select 3));
-_ctrlButtonOKPos = ctrlPosition _ctrlButtonOK;
-_ctrlBcgCommonPos = ctrlPosition _ctrlBcgCommon;
-_bottomSpaceY = (_ctrlButtonOKPos select 1) - ((_ctrlBcgCommonPos select 1) + (_ctrlBcgCommonPos select 3));
-
-_ctrlTextPos = ctrlPosition _ctrlText;
-_marginX = (_ctrlTextPos select 0) - (_ctrlBcgCommonPos select 0);
-_marginY = (_ctrlTextPos select 1) - (_ctrlBcgCommonPos select 1);
-
-private ["_ctrlTextPosH", "_bottomPosY"];
+private _ctrlTextPos = ctrlPosition _ctrlText;
+private _marginX = (_ctrlTextPos select 0) - (_ctrlBcgCommonPos select 0);
+private _marginY = (_ctrlTextPos select 1) - (_ctrlBcgCommonPos select 1);
_ctrlText ctrlSetStructuredText _textMessage;
-_ctrlTextPosH = ctrlTextHeight _ctrlText;
+private _ctrlTextPosH = ctrlTextHeight _ctrlText;
_ctrlBcgCommon ctrlSetPosition [
_ctrlBcgCommonPos select 0,
@@ -83,11 +77,10 @@ _ctrlText ctrlSetPosition [
];
_ctrlText ctrlCommit 0;
-_bottomPosY = (_ctrlBcgCommonPos select 1) + _ctrlTextPosH + (_marginY * 2) + _bottomSpaceY;
+private _bottomPosY = (_ctrlBcgCommonPos select 1) + _ctrlTextPosH + (_marginY * 2) + _bottomSpaceY;
{
- private "_xPos";
- _xPos = ctrlPosition _x;
+ private _xPos = ctrlPosition _x;
_xPos set [1, _bottomPosY];
_x ctrlSetPosition _xPos;
@@ -100,10 +93,8 @@ _bottomPosY = (_ctrlBcgCommonPos select 1) + _ctrlTextPosH + (_marginY * 2) + _b
_ctrlButtonCancel
];
-private ["_ctrlRscMessageBoxPos", "_ctrlRscMessageBoxPosH"];
-
-_ctrlRscMessageBoxPos = ctrlPosition _ctrlRscMessageBox;
-_ctrlRscMessageBoxPosH = _bottomPosY + (_ctrlButtonOKPos select 3);
+private _ctrlRscMessageBoxPos = ctrlPosition _ctrlRscMessageBox;
+private _ctrlRscMessageBoxPosH = _bottomPosY + (_ctrlButtonOKPos select 3);
_ctrlRscMessageBox ctrlSetPosition [
0.5 - (_ctrlBcgCommonPos select 2) / 2,
diff --git a/addons/common/functions/fnc_execPersistentFnc.sqf b/addons/common/functions/fnc_execPersistentFnc.sqf
index 0b7bccb69a..06e1397f01 100644
--- a/addons/common/functions/fnc_execPersistentFnc.sqf
+++ b/addons/common/functions/fnc_execPersistentFnc.sqf
@@ -28,12 +28,11 @@ _function = call compile _function;
[[_arguments, _unit], _this select 1, 2] call FUNC(execRemoteFnc);
// save persistent function for JIP
-private ["_persistentFunctions", "_index"];
-
-_persistentFunctions = _unit getVariable ["ACE_PersistentFunctions", []];
+private _persistentFunctions = _unit getVariable ["ACE_PersistentFunctions", []];
// find index to overwrite function with the same name, add to end otherwise
-_index = count _persistentFunctions;
+private _index = count _persistentFunctions;
+
{
if (_x select 2 == _name) exitWith {
_index = _forEachIndex;
diff --git a/addons/common/functions/fnc_exportConfig.sqf b/addons/common/functions/fnc_exportConfig.sqf
index 2a4890c49c..c175254e5a 100644
--- a/addons/common/functions/fnc_exportConfig.sqf
+++ b/addons/common/functions/fnc_exportConfig.sqf
@@ -15,26 +15,22 @@
*/
#include "script_component.hpp"
-private "_fnc_logEntries";
-_fnc_logEntries = {
+private _fnc_logEntries = {
params ["_c", "_d"];
- private ["_p", "_t", "_e", "_a", "_i"];
+ private _p = inheritsFrom _c;
- _p = inheritsFrom _c;
-
- _t = format [["class %1: %2 {", "class %1 {"] select (configName _p == ""), configName _c, configName _p];
+ private _t = format [["class %1: %2 {", "class %1 {"] select (configName _p == ""), configName _c, configName _p];
for "_a" from 1 to _d do {
_t = " " + _t;
};
diag_log text _t;
- _e = [];
+ private _e = [];
for "_i" from 0 to (count _c - 1) do {
- private ["_e1, _e2"];
- _e1 = _c select _i;
+ private _e1 = _c select _i;
- _e2 = switch (true) do {
+ private _e2 = switch (true) do {
case (isNumber _e1): {getNumber _e1};
case (isText _e1): {getText _e1};
case (isArray _e1): {getArray _e1};
diff --git a/addons/common/functions/fnc_filter.sqf b/addons/common/functions/fnc_filter.sqf
index 0b30e59cf9..36ff328ef0 100644
--- a/addons/common/functions/fnc_filter.sqf
+++ b/addons/common/functions/fnc_filter.sqf
@@ -16,10 +16,9 @@
*/
#include "script_component.hpp"
-params ["_array", "_code"];
+params [["_array", [], [[]]], ["_code", {}, [{}]]];
-private "_result";
-_result = [];
+private _result = [];
{
if (_x call _code) then {
diff --git a/addons/common/functions/fnc_fixCrateContent.sqf b/addons/common/functions/fnc_fixCrateContent.sqf
index a067c29c63..06d73c39b1 100644
--- a/addons/common/functions/fnc_fixCrateContent.sqf
+++ b/addons/common/functions/fnc_fixCrateContent.sqf
@@ -14,11 +14,9 @@
params ["_crate"];
-private ["_weapons", "_items"];
-
// get all weapons inside the crate
-_weapons = weaponCargo _crate;
-_items = [];
+private _weapons = weaponCargo _crate;
+private _items = [];
// if the "weapon" is supposed to be an item, move those from the weapon array to the item array
{
diff --git a/addons/common/functions/fnc_fixFloating.sqf b/addons/common/functions/fnc_fixFloating.sqf
index 2eb6f2b4e4..5391402ca4 100644
--- a/addons/common/functions/fnc_fixFloating.sqf
+++ b/addons/common/functions/fnc_fixFloating.sqf
@@ -12,15 +12,13 @@
*/
#include "script_component.hpp"
-private "_object";
-_object = _this;
+params ["_object"];
// setHitPointDamage requires local object
if (!local _object) exitWith {};
// save and restore hitpoints, see below why
-private "_hitPointDamages";
-_hitPointDamages = getAllHitPointsDamage _object;
+private _hitPointDamages = getAllHitPointsDamage _object;
// get correct format for objects without hitpoints
if (_hitPointDamages isEqualTo []) then {
diff --git a/addons/common/functions/fnc_fixPosition.sqf b/addons/common/functions/fnc_fixPosition.sqf
index 54d0cdfbf6..e2e2d71059 100644
--- a/addons/common/functions/fnc_fixPosition.sqf
+++ b/addons/common/functions/fnc_fixPosition.sqf
@@ -16,8 +16,7 @@
// setVectorUp requires local object
if (!local _this) exitWith {};
-private "_position";
-_position = getPos _this;
+private _position = getPos _this;
// don't place the object below the ground
if (_position select 2 < -0.1) then {
diff --git a/addons/common/functions/fnc_getAllDefinedSetVariables.sqf b/addons/common/functions/fnc_getAllDefinedSetVariables.sqf
index 7205a943d9..a5d973767f 100644
--- a/addons/common/functions/fnc_getAllDefinedSetVariables.sqf
+++ b/addons/common/functions/fnc_getAllDefinedSetVariables.sqf
@@ -22,12 +22,10 @@ params ["_object", ["_category", ""]];
if (isNil QGVAR(OBJECT_VARIABLES_STORAGE)) exitWith {[]};
-private ["_return", "_val"];
-
-_return = [];
+private _return = [];
{
- _val = _object getVariable (_x select 0);
+ private _val = _object getVariable (_x select 0);
if (!isNil "_val") then {
if (_category == "" || _category == _x select 3) then {
diff --git a/addons/common/functions/fnc_getCaptivityStatus.sqf b/addons/common/functions/fnc_getCaptivityStatus.sqf
index 36bf0ff183..e2663a892e 100644
--- a/addons/common/functions/fnc_getCaptivityStatus.sqf
+++ b/addons/common/functions/fnc_getCaptivityStatus.sqf
@@ -14,13 +14,10 @@
params ["_unit"];
-private ["_captivityReasons", "_unitCaptivityStatus", "_unitCaptivityReasons"];
+private _captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []];
+private _unitCaptivityStatus = [captiveNum _unit, count _captivityReasons] call FUNC(binarizeNumber);
-_captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []];
-
-_unitCaptivityStatus = [captiveNum _unit, count _captivityReasons] call FUNC(binarizeNumber);
-
-_unitCaptivityReasons = [];
+private _unitCaptivityReasons = [];
{
if (_unitCaptivityStatus select _forEachIndex) then {
diff --git a/addons/common/functions/fnc_getChildren.sqf b/addons/common/functions/fnc_getChildren.sqf
index d5212dd9a5..19fdf287fe 100644
--- a/addons/common/functions/fnc_getChildren.sqf
+++ b/addons/common/functions/fnc_getChildren.sqf
@@ -14,7 +14,6 @@
params ["_name", "_cfgClass"];
-private "_classes";
-_classes = format ["configName inheritsFrom _x == '%1'", _name] configClasses (configFile >> _cfgClass);
+private _classes = format ["configName inheritsFrom _x == '%1'", _name] configClasses (configFile >> _cfgClass);
[_classes, {configName _this}] call FUNC(map) // return
diff --git a/addons/common/functions/fnc_getConfigCommander.sqf b/addons/common/functions/fnc_getConfigCommander.sqf
index bfa5fbc379..d4a53905b8 100644
--- a/addons/common/functions/fnc_getConfigCommander.sqf
+++ b/addons/common/functions/fnc_getConfigCommander.sqf
@@ -14,9 +14,7 @@
params ["_vehicle"];
-private ["_config", "_turret"];
-
-_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
-_turret = [_vehicle] call FUNC(getTurretCommander);
+private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
+private _turret = _vehicle call FUNC(getTurretCommander);
[_config, _turret] call FUNC(getTurretConfigPath) // return
diff --git a/addons/common/functions/fnc_getConfigGunner.sqf b/addons/common/functions/fnc_getConfigGunner.sqf
index bc3131d798..abbbd5f014 100644
--- a/addons/common/functions/fnc_getConfigGunner.sqf
+++ b/addons/common/functions/fnc_getConfigGunner.sqf
@@ -14,9 +14,7 @@
params ["_vehicle"];
-private ["_config", "_turret"];
-
-_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
-_turret = [_vehicle] call FUNC(getTurretGunner);
+private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
+private _turret = _vehicle call FUNC(getTurretGunner);
[_config, _turret] call FUNC(getTurretConfigPath) // return
diff --git a/addons/common/functions/fnc_getDeathAnim.sqf b/addons/common/functions/fnc_getDeathAnim.sqf
index 590418bf25..60aaf3bc0c 100644
--- a/addons/common/functions/fnc_getDeathAnim.sqf
+++ b/addons/common/functions/fnc_getDeathAnim.sqf
@@ -17,25 +17,23 @@
params ["_unit"];
-private ["_returnAnimation", "_animationState", "_unitAnimationCfg", "_unitActionsCfg", "_interpolateArray", "_indexAnimation"];
+private _returnAnimation = "";
-_returnAnimation = "";
-
-_animationState = animationState _unit;
-_unitAnimationCfg = configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState;
+private _animationState = animationState _unit;
+private _unitAnimationCfg = configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState;
//If we're already in a terminal animation just return current
if (getNumber (_unitAnimationCfg >> "terminal") == 1) exitWith {_animationState};
-_unitActionsCfg = configFile >> "CfgMovesBasic" >> "Actions" >> getText (_unitAnimationCfg >> "actions");
+private _unitActionsCfg = configFile >> "CfgMovesBasic" >> "Actions" >> getText (_unitAnimationCfg >> "actions");
TRACE_2("Animation/Action", configName _unitAnimationCfg, configName _unitActionsCfg);
if (vehicle _unit != _unit) then {
- _interpolateArray = getArray (_unitAnimationCfg >> "interpolateTo");
+ private _interpolateArray = getArray (_unitAnimationCfg >> "interpolateTo");
for "_index" from 0 to (count _interpolateArray - 1) step 2 do {
- _indexAnimation = _interpolateArray select _index;
+ private _indexAnimation = _interpolateArray select _index;
//No guarentee that first animation will be right so scan for the first "terminal" animation
//E.G.: interpolateTo[] = {"passenger_apc_generic04still",1,"KIA_passenger_apc_generic04",1};
diff --git a/addons/common/functions/fnc_getDefaultAnim.sqf b/addons/common/functions/fnc_getDefaultAnim.sqf
index 372a2424eb..c2c0e1e7c4 100644
--- a/addons/common/functions/fnc_getDefaultAnim.sqf
+++ b/addons/common/functions/fnc_getDefaultAnim.sqf
@@ -17,12 +17,10 @@
params ["_unit"];
-private ["_anim", "_stance"];
-
-_anim = toLower animationState _unit;
+private _anim = toLower animationState _unit;
// stance is broken for some animations.
-_stance = stance _unit;
+private _stance = stance _unit;
if (_anim find "ppne" == 4) then {
_stance = "PRONE";
diff --git a/addons/common/functions/fnc_getDefinedVariable.sqf b/addons/common/functions/fnc_getDefinedVariable.sqf
index ea22163622..32a75edb5e 100644
--- a/addons/common/functions/fnc_getDefinedVariable.sqf
+++ b/addons/common/functions/fnc_getDefinedVariable.sqf
@@ -15,15 +15,13 @@
params ["_unit", "_variable", "_defaultValue"];
-private "_value";
-_value = _unit getVariable _variable;
+private _value = _unit getVariable _variable;
if (isNil "_value") then {
if (!isNil "_defaultValue") then {
_value = _defaultValue;
} else {
- private "_definedVariable";
- _definedVariable = [_variable] call FUNC(getDefinedVariableInfo);
+ private _definedVariable = _variable call FUNC(getDefinedVariableInfo);
if (count _definedVariable > 1) then {
_value = _definedVariable select 1;
diff --git a/addons/common/functions/fnc_getDefinedVariableDefault.sqf b/addons/common/functions/fnc_getDefinedVariableDefault.sqf
index ba9ff20e23..c6f4f7711c 100644
--- a/addons/common/functions/fnc_getDefinedVariableDefault.sqf
+++ b/addons/common/functions/fnc_getDefinedVariableDefault.sqf
@@ -14,8 +14,7 @@
params ["_varName"];
-private "_variableDefinition";
-_variableDefinition = [_varName] call FUNC(getDefinedVariableInfo);
+private _variableDefinition = _varName call FUNC(getDefinedVariableInfo);
if !(_variableDefinition isEqualTo []) exitWith {
_variableDefinition select 1;
diff --git a/addons/common/functions/fnc_getDisplayConfigName.sqf b/addons/common/functions/fnc_getDisplayConfigName.sqf
index 7a0d9ffa95..1660bbf804 100644
--- a/addons/common/functions/fnc_getDisplayConfigName.sqf
+++ b/addons/common/functions/fnc_getDisplayConfigName.sqf
@@ -16,12 +16,10 @@
params ["_idd"];
-private ["_configNames", "_config"];
-
-_configNames = [];
+private _configNames = [];
for "_index" from 0 to (count configFile - 1) do {
- _config = configFile select _index;
+ private _config = configFile select _index;
if (isClass _config && {isNumber (_config >> "idd")} && {getNumber (_config >> "idd") == _idd}) then {
_configNames pushBack configName _config;
diff --git a/addons/common/functions/fnc_getDoorTurrets.sqf b/addons/common/functions/fnc_getDoorTurrets.sqf
index cab259a214..533e2a7489 100644
--- a/addons/common/functions/fnc_getDoorTurrets.sqf
+++ b/addons/common/functions/fnc_getDoorTurrets.sqf
@@ -14,14 +14,12 @@
params ["_vehicle"];
-private ["_turrets", "_doorTurrets", "_config"];
+private _turrets = allTurrets [_vehicle, true];
-_turrets = allTurrets [_vehicle, true];
-
-_doorTurrets = [];
+private _doorTurrets = [];
{
- _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
+ private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
_config = [_config, _x] call FUNC(getTurretConfigPath);
diff --git a/addons/common/functions/fnc_getFirstObjectIntersection.sqf b/addons/common/functions/fnc_getFirstObjectIntersection.sqf
index 1111094ed0..c4cc46ab9b 100644
--- a/addons/common/functions/fnc_getFirstObjectIntersection.sqf
+++ b/addons/common/functions/fnc_getFirstObjectIntersection.sqf
@@ -17,20 +17,16 @@
params ["_source", "_destination", "_accuracy"];
-private ["_result", "_distance"];
+private _result = [false, [0, 0, 0]];
-_result = [false, [0, 0, 0]];
-
-_distance = _source vectorDistance _destination;
+private _distance = _source vectorDistance _destination;
if !(lineIntersectsWith [_source, _destination] isEqualTo []) then {
- private ["_lower", "_upper", "_mid", "_dir"];
+ private _lower = 0;
+ private _upper = 1;
+ private _mid = 0.5;
- _lower = 0;
- _upper = 1;
- _mid = 0.5;
-
- _dir = _source vectorFromTo _destination;
+ private _dir = _source vectorFromTo _destination;
while {(_upper - _lower) * _distance > _accuracy} do {
_mid = _lower + (_upper - _lower) / 2;
diff --git a/addons/common/functions/fnc_getFirstTerrainIntersection.sqf b/addons/common/functions/fnc_getFirstTerrainIntersection.sqf
index a5065413d9..27a6f3c613 100644
--- a/addons/common/functions/fnc_getFirstTerrainIntersection.sqf
+++ b/addons/common/functions/fnc_getFirstTerrainIntersection.sqf
@@ -17,20 +17,16 @@
params ["_source", "_destination", "_accuracy"];
-private ["_result", "_distance"];
+private _result = [false, [0, 0, 0]];
-_result = [false, [0, 0, 0]];
-
-_distance = _source vectorDistance _destination;
+private _distance = _source vectorDistance _destination;
if (terrainIntersectASL [_source, _destination]) then {
- private ["_lower", "_upper", "_mid", "_dir"];
+ private _lower = 0;
+ private _upper = 1;
+ private _mid = 0.5;
- _lower = 0;
- _upper = 1;
- _mid = 0.5;
-
- _dir = _source vectorFromTo _destination;
+ private _dir = _source vectorFromTo _destination;
while {(_upper - _lower) * _distance > _accuracy} do {
_mid = _lower + (_upper - _lower) / 2;
diff --git a/addons/common/functions/fnc_getForceWalkStatus.sqf b/addons/common/functions/fnc_getForceWalkStatus.sqf
index acdc2f1a05..16eca5ccc7 100644
--- a/addons/common/functions/fnc_getForceWalkStatus.sqf
+++ b/addons/common/functions/fnc_getForceWalkStatus.sqf
@@ -17,15 +17,11 @@
params ["_unit"];
-private ["_forceWalkReasons", "_unitForceWalkNumber", "_unitForceWalkStatus", "_unitForceWalkReasons"];
+private _forceWalkReasons = missionNamespace getVariable ["ACE_forceWalkReasons", []];
+private _unitForceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0];
+private _unitForceWalkStatus = [_unitForceWalkNumber, count _forceWalkReasons] call FUNC(binarizeNumber);
-_forceWalkReasons = missionNamespace getVariable ["ACE_forceWalkReasons", []];
-
-_unitForceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0];
-
-_unitForceWalkStatus = [_unitForceWalkNumber, count _forceWalkReasons] call FUNC(binarizeNumber);
-
-_unitForceWalkReasons = [];
+private _unitForceWalkReasons = [];
{
if (_unitForceWalkStatus select _forEachIndex) then {
diff --git a/addons/common/functions/fnc_getGunner.sqf b/addons/common/functions/fnc_getGunner.sqf
index dac42ce535..fb8c19ce45 100644
--- a/addons/common/functions/fnc_getGunner.sqf
+++ b/addons/common/functions/fnc_getGunner.sqf
@@ -13,14 +13,13 @@
*/
#include "script_component.hpp"
-params ["_vehicle", "_weapon"];
+params [["_vehicle", objNull, [objNull]], ["_weapon", "", [""]]];
// on foot
if (gunner _vehicle == _vehicle && {_weapon in weapons _vehicle || {toLower _weapon in ["throw", "put"]}}) exitWith {gunner _vehicle};
// inside vehicle
-private "_gunner";
-_gunner = objNull;
+private _gunner = objNull;
{
if (_weapon in (_vehicle weaponsTurret _x)) exitWith {
diff --git a/addons/common/functions/fnc_getHitPoints.sqf b/addons/common/functions/fnc_getHitPoints.sqf
index 84099b659a..9fb69dd50c 100644
--- a/addons/common/functions/fnc_getHitPoints.sqf
+++ b/addons/common/functions/fnc_getHitPoints.sqf
@@ -18,8 +18,7 @@ ACE_DEPRECATED("ace_common_fnc_getHitPoints","3.5.0","getAllHitPointsDamage");
params ["_vehicle"];
-private "_hitPointsWithSelections";
-_hitPointsWithSelections = getAllHitPointsDamage _vehicle;
+private _hitPointsWithSelections = getAllHitPointsDamage _vehicle;
// get correct format on vehicles without any hitpoints
if (_hitPointsWithSelections isEqualTo []) then {
diff --git a/addons/common/functions/fnc_getHitPointsWithSelections.sqf b/addons/common/functions/fnc_getHitPointsWithSelections.sqf
index aef415a54f..d1c81ad3a6 100644
--- a/addons/common/functions/fnc_getHitPointsWithSelections.sqf
+++ b/addons/common/functions/fnc_getHitPointsWithSelections.sqf
@@ -19,8 +19,7 @@ ACE_DEPRECATED("ace_common_fnc_getHitPointsWithSelections","3.5.0","getAllHitPoi
params ["_vehicle"];
-private "_hitPointsWithSelections";
-_hitPointsWithSelections = getAllHitPointsDamage _vehicle;
+private _hitPointsWithSelections = getAllHitPointsDamage _vehicle;
// get correct format on vehicles without any hitpoints
if (_hitPointsWithSelections isEqualTo []) then {
diff --git a/addons/common/functions/fnc_getInPosition.sqf b/addons/common/functions/fnc_getInPosition.sqf
index dc3ad38cde..9ab15bacd5 100644
--- a/addons/common/functions/fnc_getInPosition.sqf
+++ b/addons/common/functions/fnc_getInPosition.sqf
@@ -25,15 +25,13 @@ _position = toLower _position;
// general
if (!alive _vehicle || {locked _vehicle > 1}) exitWith {false};
-private ["_config", "_turret", "_isInside", "_script", "_enemiesInVehicle"];
+private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
+private _turret = [];
-_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
-_turret = [];
+private _isInside = vehicle _unit == _vehicle;
-_isInside = vehicle _unit == _vehicle;
-
-_script = {};
-_enemiesInVehicle = false; //Possible Side Restriction
+private _script = {};
+private _enemiesInVehicle = false; //Possible Side Restriction
{
if (side _unit getFriend side _x < 0.6) exitWith {_enemiesInVehicle = true};
@@ -96,8 +94,7 @@ switch (_position) do {
};
case "turret" : {
- private "_turrets";
- _turrets = [_vehicle] call FUNC(getTurretsOther);
+ private _turrets = [_vehicle] call FUNC(getTurretsOther);
if (_index != -1 && {_turret = _turrets select _index; CANGETINTURRETINDEX}) then {
_script = [
@@ -122,8 +119,7 @@ switch (_position) do {
};
case "ffv" : {
- private "_turrets";
- _turrets = [_vehicle] call FUNC(getTurretsFFV);
+ private _turrets = [_vehicle] call FUNC(getTurretsFFV);
if (_index != -1 && {_turret = _turrets select _index; CANGETINTURRETINDEX}) then {
_script = [
@@ -148,8 +144,7 @@ switch (_position) do {
};
case "codriver" : {
- private "_positions";
- _positions = [typeOf _vehicle] call FUNC(getVehicleCodriver);
+ private _positions = [typeOf _vehicle] call FUNC(getVehicleCodriver);
{
if (alive _x) then {_positions deleteAt (_positions find (_vehicle getCargoIndex _x))};
@@ -207,11 +202,9 @@ switch (_position) do {
};
// this will execute all config based event handlers. Not script based ones unfortunately, but atleast we don't use any.
-private "_fnc_getInEH";
-_fnc_getInEH = {
- private "_config";
+private _fnc_getInEH = {
// config based getIn EHs are assigned to the soldier, not the vehicle. Why Bis? Why?
- _config = configFile >> "CfgVehicles" >> typeOf _unit >> "EventHandlers";
+ private _config = configFile >> "CfgVehicles" >> typeOf _unit >> "EventHandlers";
if (isClass _config) then {
//getIn is local effects with global arguments. It doesn't trigger if the unit was already inside and only switched seats
diff --git a/addons/common/functions/fnc_getItemType.sqf b/addons/common/functions/fnc_getItemType.sqf
index ec20b46f74..d3eb511949 100644
--- a/addons/common/functions/fnc_getItemType.sqf
+++ b/addons/common/functions/fnc_getItemType.sqf
@@ -15,23 +15,21 @@
params ["_item"];
-private ["_cfgType", "_config", "_type", "_simulation", "_default"];
-
-_cfgType = [_item] call FUNC(getConfigType);
+private _cfgType = [_item] call FUNC(getConfigType);
if (_cfgType == "") exitWith {["", ""]};
if (_cfgType == "CfgGlasses") exitWith {["item", "glasses"]};
-_config = configFile >> _cfgType >> _item;
-_type = getNumber (_config >> "type");
-_simulation = getText (_config >> "simulation");
+private _config = configFile >> _cfgType >> _item;
+private _type = getNumber (_config >> "type");
+private _simulation = getText (_config >> "simulation");
if (isNumber (_config >> "ItemInfo" >> "type")) then {
_type = getNumber (_config >> "ItemInfo" >> "type");
};
-_default = ["item", "magazine"] select (_cfgType == "CfgMagazines");
+private _default = ["item", "magazine"] select (_cfgType == "CfgMagazines");
switch (true) do {
case (_type == 0): {[_default, "unknown"]};
diff --git a/addons/common/functions/fnc_getLightProperties.sqf b/addons/common/functions/fnc_getLightProperties.sqf
index bbaf955a8b..a376dff841 100644
--- a/addons/common/functions/fnc_getLightProperties.sqf
+++ b/addons/common/functions/fnc_getLightProperties.sqf
@@ -19,14 +19,12 @@
params ["_vehicle", "_light"];
-private ["_config", "_intensity", "_position", "_direction", "_innerAngle", "_outerAngle"];
+private _config = configFile >> "CfgVehicles" >> typeOf _vehicle >> "Reflectors" >> _light;
-_config = configFile >> "CfgVehicles" >> typeOf _vehicle >> "Reflectors" >> _light;
-
-_intensity = getNumber (_config >> "intensity");
-_position = getText (_config >> "position");
-_direction = getText (_config >> "direction");
-_innerAngle = getNumber (_config >> "innerAngle");
-_outerAngle = getNumber (_config >> "outerAngle");
+private _intensity = getNumber (_config >> "intensity");
+private _position = getText (_config >> "position");
+private _direction = getText (_config >> "direction");
+private _innerAngle = getNumber (_config >> "innerAngle");
+private _outerAngle = getNumber (_config >> "outerAngle");
[_intensity, _position, _direction, _innerAngle, _outerAngle]
diff --git a/addons/common/functions/fnc_getLightPropertiesWeapon.sqf b/addons/common/functions/fnc_getLightPropertiesWeapon.sqf
index 01567fee58..44c866e67f 100644
--- a/addons/common/functions/fnc_getLightPropertiesWeapon.sqf
+++ b/addons/common/functions/fnc_getLightPropertiesWeapon.sqf
@@ -18,16 +18,12 @@
params ["_weapon"];
-// @todo: Can weapons themselves still have flashlights (no attachment)?
+private _config = configFile >> "CfgWeapons" >> _weapon >> "ItemInfo" >> "FlashLight";
-private ["_config", "_intensity", "_position", "_direction", "_innerAngle", "_outerAngle"];
-
-_config = configFile >> "CfgWeapons" >> _weapon >> "ItemInfo" >> "FlashLight";
-
-_intensity = getNumber (_config >> "intensity");
-_position = getText (_config >> "position");
-_direction = getText (_config >> "direction");
-_innerAngle = getNumber (_config >> "innerAngle");
-_outerAngle = getNumber (_config >> "outerAngle");
+private _intensity = getNumber (_config >> "intensity");
+private _position = getText (_config >> "position");
+private _direction = getText (_config >> "direction");
+private _innerAngle = getNumber (_config >> "innerAngle");
+private _outerAngle = getNumber (_config >> "outerAngle");
[_intensity, _position, _direction, _innerAngle, _outerAngle]
diff --git a/addons/common/functions/fnc_getMGRSdata.sqf b/addons/common/functions/fnc_getMGRSdata.sqf
index b4f10db8a4..ee6d1e11dc 100644
--- a/addons/common/functions/fnc_getMGRSdata.sqf
+++ b/addons/common/functions/fnc_getMGRSdata.sqf
@@ -18,11 +18,9 @@
params [["_map", worldName]];
-private ["_long", "_lat", "_altitude", "_UTM", "_easting", "_northing", "_zone", "_band", "_GZD"];
-
-_long = getNumber (configFile >> "CfgWorlds" >> _map >> "longitude");
-_lat = getNumber (configFile >> "CfgWorlds" >> _map >> "latitude");
-_altitude = getNumber (configFile >> "CfgWorlds" >> _map >> "elevationOffset");
+private _long = getNumber (configFile >> "CfgWorlds" >> _map >> "longitude");
+private _lat = getNumber (configFile >> "CfgWorlds" >> _map >> "latitude");
+private _altitude = getNumber (configFile >> "CfgWorlds" >> _map >> "elevationOffset");
if (_map in ["Chernarus", "Bootcamp_ACR", "Woodland_ACR", "utes"]) then { _lat = 50; _altitude = 0; };
if (_map in ["Altis", "Stratis"]) then { _lat = 40; _altitude = 0; };
@@ -46,14 +44,14 @@ if (_map in ["lingor"]) then { _lat = -4; _altitude = 0; };
if (_map in ["Panthera3"]) then { _lat = 46; _altitude = 0; };
if (_map in ["Kunduz"]) then { _lat = 37; _altitude = 400; };
-_UTM = [_long,_lat] call BIS_fnc_posDegToUTM;
-_easting = _UTM select 0;
-_northing = _UTM select 1;
-//_zone = _UTM select 2;
+private _UTM = [_long,_lat] call BIS_fnc_posDegToUTM;
+private _easting = _UTM select 0;
+private _northing = _UTM select 1;
+//private _zone = _UTM select 2;
TRACE_4("",_UTM,_easting,_northing,_zone);
/*
-_band = switch (true) do {
+private _band = switch (true) do {
case (_lat<-72): {"C"};
case (_lat<-64): {"D"};
case (_lat<-56): {"E"};
@@ -77,8 +75,8 @@ _band = switch (true) do {
};
*/
-_zone = 1 + (floor ((_long + 180) / 6));
-_band = "Z";
+private _zone = 1 + (floor ((_long + 180) / 6));
+private _band = "Z";
if (_lat <= -80) then {
_band = "A";
@@ -90,17 +88,17 @@ if (_lat <= -80) then {
if (_map == "VR") then {_zone = 0; _band = "RV";};
-_GZD = format ["%1%2",_zone,_band];
+private _GZD = format ["%1%2",_zone,_band];
TRACE_3("",_zone,_band,_GZD);
-private ["_set1", "_set2", "_set3", "_set4", "_set5", "_set6", "_metaE", "_metaN", "_letterE", "_letterN", "_grid100km"];
+private ["_metaE", "_metaN", "_letterE", "_letterN"];
-_set1 = [1,7,13,19,25,31,37,43,49,55];
-_set2 = [2,8,14,20,26,32,38,44,50,56];
-_set3 = [3,9,15,21,27,33,39,45,51,57];
-_set4 = [4,10,16,22,28,34,40,46,52,58];
-_set5 = [5,11,17,23,29,35,41,47,53,59];
-_set6 = [6,12,18,24,30,36,42,48,54,60];
+private _set1 = [1,7,13,19,25,31,37,43,49,55];
+private _set2 = [2,8,14,20,26,32,38,44,50,56];
+private _set3 = [3,9,15,21,27,33,39,45,51,57];
+private _set4 = [4,10,16,22,28,34,40,46,52,58];
+private _set5 = [5,11,17,23,29,35,41,47,53,59];
+private _set6 = [6,12,18,24,30,36,42,48,54,60];
switch (true) do {
case (_zone in _set1): {_metaE = 1; _metaN = 1;};
@@ -154,7 +152,7 @@ switch (true) do {
};
TRACE_1("",_letterN);
-_grid100km = _letterE + _letterN;
+private _grid100km = _letterE + _letterN;
TRACE_1("",_grid100km);
if (_map == worldName) then {
diff --git a/addons/common/functions/fnc_getMapGridData.sqf b/addons/common/functions/fnc_getMapGridData.sqf
index c74f378d75..be87a8585b 100644
--- a/addons/common/functions/fnc_getMapGridData.sqf
+++ b/addons/common/functions/fnc_getMapGridData.sqf
@@ -19,20 +19,18 @@
GVAR(mapGridData) = [];
-private ["_cfgGrid", "_offsetX", "_offsetY", "_zoomMax", "_formatX", "_formatY", "_stepX", "_stepY", "_zoom", "_letterGrid", "_heightOffset", "_startGrid", "_originGrid", "_realOffsetY"];
-
//--- Extract grid values from world config (Borrowed from BIS_fnc_gridToPos)
-_cfgGrid = configFile >> "CfgWorlds" >> worldName >> "Grid";
-_offsetX = getNumber (_cfgGrid >> "offsetX");
-_offsetY = getNumber (_cfgGrid >> "offsetY");
-_zoomMax = 1e99;
-_formatX = "";
-_formatY = "";
-_stepX = 1e10;
-_stepY = 1e10;
+private _cfgGrid = configFile >> "CfgWorlds" >> worldName >> "Grid";
+private _offsetX = getNumber (_cfgGrid >> "offsetX");
+private _offsetY = getNumber (_cfgGrid >> "offsetY");
+private _zoomMax = 1e99;
+private _formatX = "";
+private _formatY = "";
+private _stepX = 1e10;
+private _stepY = 1e10;
{
- _zoom = getnumber (_x >> "zoomMax");
+ private _zoom = getnumber (_x >> "zoomMax");
if (_zoom < _zoomMax) then {
_zoomMax = _zoom;
_formatX = getText (_x >> "formatX");
@@ -43,7 +41,7 @@ _stepY = 1e10;
false
} count configProperties [_cfgGrid, "isClass _x", false];
-_letterGrid = false;
+private _letterGrid = false;
if (toLower _formatX find "a" != -1) then {_letterGrid = true};
if (toLower _formatY find "a" != -1) then {_letterGrid = true};
@@ -53,9 +51,9 @@ if (_letterGrid) exitWith {
};
//Start at [0, 500] and move north until we get a change in grid
-_heightOffset = 500;
-_startGrid = mapGridPosition [0, _heightOffset];
-_originGrid = _startGrid;
+private _heightOffset = 500;
+private _startGrid = mapGridPosition [0, _heightOffset];
+private _originGrid = _startGrid;
while {_startGrid == _originGrid} do {
_heightOffset = _heightOffset + 1;
@@ -63,7 +61,7 @@ while {_startGrid == _originGrid} do {
};
//Calculate the real y offset
-_realOffsetY = (parseNumber (_originGrid select [count _formatX, count _formatY])) * _stepY + _heightOffset - 1;
+private _realOffsetY = (parseNumber (_originGrid select [count _formatX, count _formatY])) * _stepY + _heightOffset - 1;
//Calculate MGRS 10digit step - they should both be 1 meter:
_stepXat5 = _stepX * 10 ^ ((count _formatX) - 5);
diff --git a/addons/common/functions/fnc_getMapGridFromPos.sqf b/addons/common/functions/fnc_getMapGridFromPos.sqf
index 1f946a6e80..8604d68fa6 100644
--- a/addons/common/functions/fnc_getMapGridFromPos.sqf
+++ b/addons/common/functions/fnc_getMapGridFromPos.sqf
@@ -19,24 +19,22 @@
params ["_pos", ["_returnSingleString", false]];
-private ["_nativeGrid", "_count", "_easting", "_northing"];
-
//Fallback, when map data is weird (letters)
if (GVAR(mapGridData) isEqualTo []) exitWith {
- _nativeGrid = mapGridPosition _pos;
+ private _nativeGrid = mapGridPosition _pos;
if (_returnSingleString) then {
_nativeGrid
} else {
- _count = floor ((count _nativeGrid) / 2);
+ private _count = floor ((count _nativeGrid) / 2);
[_nativeGrid select [0, _count], _nativeGrid select [_count, _count]]
};
};
GVAR(mapGridData) params ["_offsetX", "_realOffsetY", "_stepXat5", "_stepYat5"];
-_easting = floor (((_pos select 0) - _offsetX) / _stepXat5);
-_northing = floor (((_pos select 1) - _realOffsetY) / _stepYat5);
+private _easting = floor (((_pos select 0) - _offsetX) / _stepXat5);
+private _northing = floor (((_pos select 1) - _realOffsetY) / _stepYat5);
//Attempt to handle negative east/north (e.g.: moving west of map bounds)
if (_easting > 0) then {
diff --git a/addons/common/functions/fnc_getMapPosFromGrid.sqf b/addons/common/functions/fnc_getMapPosFromGrid.sqf
index 5ba67a40bf..a148679fa9 100644
--- a/addons/common/functions/fnc_getMapPosFromGrid.sqf
+++ b/addons/common/functions/fnc_getMapPosFromGrid.sqf
@@ -25,17 +25,15 @@ if (count GVAR(mapGridData) == 0) exitWith {
GVAR(mapGridData) params ["_offsetX", "_realOffsetY", "_stepXat5", "_stepYat5"];
-private ["_countInput", "_countInputHalf", "_xPart", "_yPart", "_xPos", "_yPos"];
-
-_countInput = count _inputString;
-_countInputHalf = floor (_countInput / 2);
+private _countInput = count _inputString;
+private _countInputHalf = floor (_countInput / 2);
//Split string, ignoring middle
-_xPart = _inputString select [0, _countInputHalf];
-_yPart = _inputString select [ceil (_countInput / 2), _countInputHalf];
+private _xPart = _inputString select [0, _countInputHalf];
+private _yPart = _inputString select [ceil (_countInput / 2), _countInputHalf];
-_xPos = ((parseNumber _xPart) * _stepXat5 * 10 ^ (5 - _countInputHalf)) + _offsetX;
-_yPos = ((parseNumber _yPart) * _stepYat5 * 10 ^ (5 - _countInputHalf)) + _realOffsetY;
+private _xPos = ((parseNumber _xPart) * _stepXat5 * 10 ^ (5 - _countInputHalf)) + _offsetX;
+private _yPos = ((parseNumber _yPart) * _stepYat5 * 10 ^ (5 - _countInputHalf)) + _realOffsetY;
if (_getCenterOfGrid) then {
_xPos = _xPos + 0.5 * _stepXat5 * 10 ^ (5 - _countInputHalf);
diff --git a/addons/common/functions/fnc_getMarkerType.sqf b/addons/common/functions/fnc_getMarkerType.sqf
index 7c99302d8f..0da7f1a46e 100644
--- a/addons/common/functions/fnc_getMarkerType.sqf
+++ b/addons/common/functions/fnc_getMarkerType.sqf
@@ -14,11 +14,9 @@
params ["_group"];
-private ["_leader", "_vehicle", "_side"];
-
-_leader = leader _group;
-_vehicle = vehicle _leader;
-_side = side _leader;
+private _leader = leader _group;
+private _vehicle = vehicle _leader;
+private _side = side _leader;
if (_vehicle == _leader) exitWith {
if (
diff --git a/addons/common/functions/fnc_getNumberMagazinesIn.sqf b/addons/common/functions/fnc_getNumberMagazinesIn.sqf
index df1f7ed64b..87f92979eb 100644
--- a/addons/common/functions/fnc_getNumberMagazinesIn.sqf
+++ b/addons/common/functions/fnc_getNumberMagazinesIn.sqf
@@ -15,8 +15,7 @@
params ["_unit", "_magazine"];
-private "_return";
-_return = 0;
+private _return = 0;
if (_unit isKindOf "CAManBase") then {
_return = {_x == _magazine} count magazines _unit;
diff --git a/addons/common/functions/fnc_getReflectorsWithSelections.sqf b/addons/common/functions/fnc_getReflectorsWithSelections.sqf
index ef2b908bde..248050486c 100644
--- a/addons/common/functions/fnc_getReflectorsWithSelections.sqf
+++ b/addons/common/functions/fnc_getReflectorsWithSelections.sqf
@@ -18,23 +18,18 @@
params ["_vehicle"];
-private ["_config", "_hitpoints", "_selections"];
+private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
-_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
-
-_hitpoints = [];
-_selections = [];
+private _hitpoints = [];
+private _selections = [];
// iterate through all parents
while {isClass _config} do {
- private "_class";
- _class = _config >> "Reflectors";
+ private _class = _config >> "Reflectors";
for "_i" from 0 to (count _class - 1) do {
- private ["_entry", "_selection"];
-
- _entry = _class select _i;
- _selection = getText (_entry >> "hitpoint");
+ private _entry = _class select _i;
+ private _selection = getText (_entry >> "hitpoint");
if (!(_selection in _selections) && {!isNil {_vehicle getHit _selection}}) then {
_hitpoints pushBack configName _entry;
diff --git a/addons/common/functions/fnc_getSelectionsWithoutHitPoints.sqf b/addons/common/functions/fnc_getSelectionsWithoutHitPoints.sqf
index 277155108a..b46ec308ec 100644
--- a/addons/common/functions/fnc_getSelectionsWithoutHitPoints.sqf
+++ b/addons/common/functions/fnc_getSelectionsWithoutHitPoints.sqf
@@ -13,11 +13,9 @@
params ["_vehicle"];
-private ["_hitPointsFull", "_allSelectionsWithoutHitpoints"];
+private _hitPointsFull = getAllHitPointsDamage _vehicle;
-_hitPointsFull = getAllHitPointsDamage _vehicle;
-
-_allSelectionsWithoutHitpoints = [];
+private _allSelectionsWithoutHitpoints = [];
{
if (_x == "") then {
diff --git a/addons/common/functions/fnc_getSettingData.sqf b/addons/common/functions/fnc_getSettingData.sqf
index de9ef40447..ae9dd5351e 100644
--- a/addons/common/functions/fnc_getSettingData.sqf
+++ b/addons/common/functions/fnc_getSettingData.sqf
@@ -23,12 +23,13 @@
params ["_name"];
-private "_value";
-_value = [];
+scopeName "main";
{
- if (_x select 0 == _name) exitWith {_value = _x};
+ if (_x select 0 == _name) then {
+ _x breakOut "main";
+ };
false
} count GVAR(settings);
-_value
+[]
diff --git a/addons/common/functions/fnc_getStringFromMissionSQM.sqf b/addons/common/functions/fnc_getStringFromMissionSQM.sqf
index 6b6a34cfb7..0893b7bb0d 100644
--- a/addons/common/functions/fnc_getStringFromMissionSQM.sqf
+++ b/addons/common/functions/fnc_getStringFromMissionSQM.sqf
@@ -14,13 +14,11 @@
*/
#include "script_component.hpp"
-private ["_path", "_mission", "_class", "_index", "_array", "_entry"];
-
-_path = _this;
+[_this] params ["_path", [], [[]]];
if (missionName == "") exitWith {""};
-_mission = toArray toLower loadFile "mission.sqm";
+private _mission = toArray toLower loadFile "mission.sqm";
_mission resize 65536;
{
@@ -34,11 +32,9 @@ _mission = toString (_mission - [-1]);
{_path set [_forEachIndex, toLower _x]} forEach _path;
for "_a" from 0 to (count _path - 2) do {
- _class = format ["class%1{", _path select _a];
-
- _index = _mission find _class;
-
- _array = toArray _mission;
+ private _class = format ["class%1{", _path select _a];
+ private _index = _mission find _class;
+ private _array = toArray _mission;
for "_b" from 0 to (_index + count toArray _class - 1) do {
_array set [_b, -1];
@@ -49,7 +45,7 @@ for "_a" from 0 to (count _path - 2) do {
_mission = toString _array;
};
-_entry = format ["%1=", _path select (count _path - 1)];
+private _entry = format ["%1=", _path select (count _path - 1)];
_index = _mission find _entry;
if (_index == -1) exitWith {""};
diff --git a/addons/common/functions/fnc_getTargetAzimuthAndInclination.sqf b/addons/common/functions/fnc_getTargetAzimuthAndInclination.sqf
index da23e600aa..0d2343bec9 100644
--- a/addons/common/functions/fnc_getTargetAzimuthAndInclination.sqf
+++ b/addons/common/functions/fnc_getTargetAzimuthAndInclination.sqf
@@ -13,13 +13,11 @@
*/
#include "script_component.hpp"
-private ["_position", "_direction", "_azimuth", "_inclination"];
+private _position = ATLToASL positionCameraToWorld [0, 0, 0];
+private _direction = ATLToASL positionCameraToWorld [0, 0, 1];
-_position = ATLToASL positionCameraToWorld [0, 0, 0];
-_direction = ATLToASL positionCameraToWorld [0, 0, 1];
-
-_azimuth = ((_direction select 0) - (_position select 0)) atan2 ((_direction select 1) - (_position select 1));
-_inclination = asin ((_direction select 2) - (_position select 2));
+private _azimuth = ((_direction select 0) - (_position select 0)) atan2 ((_direction select 1) - (_position select 1));
+private _inclination = asin ((_direction select 2) - (_position select 2));
if (_azimuth < 0) then {_azimuth = _azimuth + 360};
diff --git a/addons/common/functions/fnc_getTargetDistance.sqf b/addons/common/functions/fnc_getTargetDistance.sqf
index fe75268cea..4bd050a2c5 100644
--- a/addons/common/functions/fnc_getTargetDistance.sqf
+++ b/addons/common/functions/fnc_getTargetDistance.sqf
@@ -16,16 +16,14 @@
params ["_interval", "_maxDistance", "_minDistance"];
-private ["_position", "_laser", "_line", "_distance", "_iteration"];
-
-_position = ATLToASL positionCameraToWorld [0, 0, 0];
+private _position = ATLToASL positionCameraToWorld [0, 0, 0];
_position set [2, (_position select 2) - (getTerrainHeightASL _position min 0)];
-_laser = + _position;
-_line = [_position, _laser];
+private _laser = + _position;
+private _line = [_position, _laser];
-_distance = _maxDistance;
-_iteration = _distance;
+private _distance = _maxDistance;
+private _iteration = _distance;
while {
_iteration > _interval / 2
diff --git a/addons/common/functions/fnc_getTargetObject.sqf b/addons/common/functions/fnc_getTargetObject.sqf
index adaaa3e344..ed757dedf4 100644
--- a/addons/common/functions/fnc_getTargetObject.sqf
+++ b/addons/common/functions/fnc_getTargetObject.sqf
@@ -14,15 +14,13 @@
params ["_maxDistance"];
-private ["_position", "_laser", "_intersects"];
-
-_position = ATLToASL positionCameraToWorld [0, 0, 0];
+private _position = ATLToASL positionCameraToWorld [0, 0, 0];
_position set [2, (_position select 2) - (getTerrainHeightASL _position min 0)];
-_laser = ATLToASL positionCameraToWorld [0, 0, _maxDistance];
+private _laser = ATLToASL positionCameraToWorld [0, 0, _maxDistance];
_laser set [2, (_laser select 2) - (getTerrainHeightASL _laser min 0)];
-_intersects = lineIntersectsObjs [_position, _laser, objNull, objNull, true, 2];
+private _intersects = lineIntersectsObjs [_position, _laser, objNull, objNull, true, 2];
if (_intersects isEqualTo []) exitWith {objNull};
diff --git a/addons/common/functions/fnc_getTurnedOnLights.sqf b/addons/common/functions/fnc_getTurnedOnLights.sqf
index 0d71a3362e..a996e146d2 100644
--- a/addons/common/functions/fnc_getTurnedOnLights.sqf
+++ b/addons/common/functions/fnc_getTurnedOnLights.sqf
@@ -16,15 +16,12 @@ params ["_vehicle"];
if (!isLightOn _vehicle) exitWith {[]};
-private ["_reflectorsWithSelections", "_lights", "_hitpoints", "_turnedOnLights"];
-
-_reflectorsWithSelections = [[_vehicle], FUNC(getReflectorsWithSelections), uiNamespace, format [QEGVAR(cache,%1_%2), QUOTE(DFUNC(getReflectorsWithSelections)), typeOf _vehicle], 1E11] call FUNC(cachedCall);
+private _reflectorsWithSelections = [[_vehicle], FUNC(getReflectorsWithSelections), uiNamespace, format [QEGVAR(cache,%1_%2), QUOTE(DFUNC(getReflectorsWithSelections)), typeOf _vehicle], 1E11] call FUNC(cachedCall);
//_reflectorsWithSelections = [_vehicle] call FUNC(getReflectorsWithSelections);
-_lights = _reflectorsWithSelections select 0;
-_hitpoints = _reflectorsWithSelections select 1;
+_reflectorsWithSelections params ["_lights", "_hitpoints"];
-_turnedOnLights = [];
+private _turnedOnLights = [];
{
if (_vehicle getHit _x <= 0.9) then {
diff --git a/addons/common/functions/fnc_getTurretCommander.sqf b/addons/common/functions/fnc_getTurretCommander.sqf
index e045c2d46f..e73795e148 100644
--- a/addons/common/functions/fnc_getTurretCommander.sqf
+++ b/addons/common/functions/fnc_getTurretCommander.sqf
@@ -12,16 +12,14 @@
*/
#include "script_component.hpp"
-params ["_vehicle"];
+params [["_vehicle", objNull, [objNull]]];
-private ["_turrets", "_turret", "_config"];
+private _turrets = allTurrets [_vehicle, true];
-_turrets = allTurrets [_vehicle, true];
-
-_turret = [];
+private _turret = [];
{
- _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
+ private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
_config = [_config, _x] call FUNC(getTurretConfigPath);
diff --git a/addons/common/functions/fnc_getTurretConfigPath.sqf b/addons/common/functions/fnc_getTurretConfigPath.sqf
index 07d7ac4e0c..95d0773fd3 100644
--- a/addons/common/functions/fnc_getTurretConfigPath.sqf
+++ b/addons/common/functions/fnc_getTurretConfigPath.sqf
@@ -15,14 +15,12 @@
params ["_config", "_turretIndex"];
-private ["_offset", "_config2", "_foundClasses"];
-
for "_index" from 0 to (count _turretIndex - 1) do {
_config = _config >> "Turrets";
- _offset = 0;
- _config2 = _config select 0;
- _foundClasses = 0;
+ private _offset = 0;
+ private _config2 = _config select 0;
+ private _foundClasses = 0;
for "_a" from 0 to (count _config - 1) do {
if (isClass _config2) then {
diff --git a/addons/common/functions/fnc_getTurretCopilot.sqf b/addons/common/functions/fnc_getTurretCopilot.sqf
index 94a30b7697..6161f5c4cc 100644
--- a/addons/common/functions/fnc_getTurretCopilot.sqf
+++ b/addons/common/functions/fnc_getTurretCopilot.sqf
@@ -12,16 +12,14 @@
*/
#include "script_component.hpp"
-params ["_vehicle"];
+params [["_vehicle", objNull, [objNull]]];
-private ["_turrets", "_turret", "_config"];
+private _turrets = allTurrets [_vehicle, true];
-_turrets = allTurrets [_vehicle, true];
-
-_turret = [];
+private _turret = [];
{
- _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
+ private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
_config = [_config, _x] call FUNC(getTurretConfigPath);
diff --git a/addons/common/functions/fnc_getTurretDirection.sqf b/addons/common/functions/fnc_getTurretDirection.sqf
index ced29a9a85..92c84cdca9 100644
--- a/addons/common/functions/fnc_getTurretDirection.sqf
+++ b/addons/common/functions/fnc_getTurretDirection.sqf
@@ -16,30 +16,25 @@
params ["_vehicle", "_position"];
-private ["_turret", "_pov", "_gunBeg", "_gunEnd", "_povPos", "_povDir"];
+private _turret = [_vehicle, _position] call CBA_fnc_getTurret;
-_turret = [_vehicle, _position] call CBA_fnc_getTurret;
-
-_pov = getText (_turret >> "memoryPointGunnerOptics");
-_gunBeg = getText (_turret >> "gunBeg");
-_gunEnd = getText (_turret >> "gunEnd");
+private _pov = getText (_turret >> "memoryPointGunnerOptics");
+private _gunBeg = getText (_turret >> "gunBeg");
+private _gunEnd = getText (_turret >> "gunEnd");
TRACE_3("", _pov, _gunBeg, _gunEnd);
// Pull the PIP pov or barrel direction, depending on how the model is set up
-_povPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _pov)); //@todo AGLToASL ?
-_povDir = [0,0,0];
+private _povPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _pov)); //@todo AGLToASL ?
+private _povDir = [0,0,0];
if (_pov == "pip0_pos") then {
- private "_pipDir";
- _pipDir = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition "pip0_dir"));
+ private _pipDir = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition "pip0_dir"));
_povDir = _pipDir vectorDiff _povPos;
} else {
- private ["_gunBeginPos", "_gunEndPos"];
-
- _gunBeginPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunBeg));
- _gunEndPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunEnd));
+ private _gunBeginPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunBeg));
+ private _gunEndPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunEnd));
_povDir = _gunBeginPos vectorDiff _gunEndPos;
};
diff --git a/addons/common/functions/fnc_getTurretGunner.sqf b/addons/common/functions/fnc_getTurretGunner.sqf
index 9a71d292bd..6f59798cc6 100644
--- a/addons/common/functions/fnc_getTurretGunner.sqf
+++ b/addons/common/functions/fnc_getTurretGunner.sqf
@@ -12,16 +12,14 @@
*/
#include "script_component.hpp"
-params ["_vehicle"];
+params [["_vehicle", objNull, [objNull]]];
-private ["_turrets", "_turret", "_config"];
+private _turrets = allTurrets [_vehicle, true];
-_turrets = allTurrets [_vehicle, true];
-
-_turret = [];
+private _turret = [];
{
- _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
+ private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
_config = [_config, _x] call FUNC(getTurretConfigPath);
diff --git a/addons/common/functions/fnc_getTurretIndex.sqf b/addons/common/functions/fnc_getTurretIndex.sqf
index 20ee178bf1..df2d540873 100644
--- a/addons/common/functions/fnc_getTurretIndex.sqf
+++ b/addons/common/functions/fnc_getTurretIndex.sqf
@@ -15,7 +15,7 @@
*/
#include "script_component.hpp"
-params ["_unit"];
+params [["_unit", objNull, [objNull]]];
private _vehicle = vehicle _unit;
if (_unit == _vehicle) exitWith {[]};
diff --git a/addons/common/functions/fnc_getTurrets.sqf b/addons/common/functions/fnc_getTurrets.sqf
index 9a1a48e2bd..229f3ab1f7 100644
--- a/addons/common/functions/fnc_getTurrets.sqf
+++ b/addons/common/functions/fnc_getTurrets.sqf
@@ -16,33 +16,25 @@
params ["_type"];
-private ["_varName", "_turrets"];
-
-_varName = format [QGVAR(CachedTurrets_%1), _type];
-_turrets = + (uiNamespace getVariable _varName);
+private _varName = format [QGVAR(CachedTurrets_%1), _type];
+private _turrets = + (uiNamespace getVariable _varName);
if (!isNil "_turrets") exitWith {_turrets};
-private ["_config", "_fnc_addTurret"];
-
-_config = configFile >> "CfgVehicles" >> _type;
+private _config = configFile >> "CfgVehicles" >> _type;
_turrets = [];
-_fnc_addTurret = {
+private _fnc_addTurret = {
params ["_config", "_path"];
_config = _config >> "Turrets";
- private ["_count", "_offset", "_path2", "_config2"];
+ private _offset = 0;
- _count = count _config;
-
- _offset = 0;
-
- for "_index" from 0 to (_count - 1) do {
- _path2 = _path + [_index - _offset];
- _config2 = _config select _index;
+ for "_index" from 0 to (count _config - 1) do {
+ private _path2 = _path + [_index - _offset];
+ private _config2 = _config select _index;
if (isClass _config2) then {
_turrets pushBack _path2;
diff --git a/addons/common/functions/fnc_getTurretsFFV.sqf b/addons/common/functions/fnc_getTurretsFFV.sqf
index ff7726d1be..8c471824cf 100644
--- a/addons/common/functions/fnc_getTurretsFFV.sqf
+++ b/addons/common/functions/fnc_getTurretsFFV.sqf
@@ -12,16 +12,14 @@
*/
#include "script_component.hpp"
-params ["_vehicle"];
+params [["_vehicle", objNull, [objNull]]];
-private ["_turrets", "_turret", "_config"];
+private _turrets = allTurrets [_vehicle, true];
-_turrets = allTurrets [_vehicle, true];
-
-_turret = [];
+private _turret = [];
{
- _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
+ private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
_config = [_config, _x] call FUNC(getTurretConfigPath);
diff --git a/addons/common/functions/fnc_getTurretsOther.sqf b/addons/common/functions/fnc_getTurretsOther.sqf
index 93ab3f2321..408a5529d5 100644
--- a/addons/common/functions/fnc_getTurretsOther.sqf
+++ b/addons/common/functions/fnc_getTurretsOther.sqf
@@ -12,23 +12,22 @@
*/
#include "script_component.hpp"
-params ["_vehicle"];
+params [["_vehicle", objNull, [objNull]]];
-private ["_turrets", "_turret", "_config"];
+private _turrets = allTurrets [_vehicle, true];
-_turrets = allTurrets [_vehicle, true];
-
-_turret = [];
+private _turret = [];
{
- _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
+ private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
_config = [_config, _x] call FUNC(getTurretConfigPath);
- if ( getNumber (_config >> "isCopilot") != 1
- && {getNumber (_config >> "primaryGunner") != 1}
- && {getNumber (_config >> "primaryObserver") != 1}
- && {getNumber (_config >> "isPersonTurret") != 1}
+ if (
+ getNumber (_config >> "isCopilot") != 1
+ && {getNumber (_config >> "primaryGunner") != 1}
+ && {getNumber (_config >> "primaryObserver") != 1}
+ && {getNumber (_config >> "isPersonTurret") != 1}
) then {
_turret pushBack _x;
};
diff --git a/addons/common/functions/fnc_getUavControlPosition.sqf b/addons/common/functions/fnc_getUavControlPosition.sqf
index a9b5340eb2..c98004c7e7 100644
--- a/addons/common/functions/fnc_getUavControlPosition.sqf
+++ b/addons/common/functions/fnc_getUavControlPosition.sqf
@@ -18,16 +18,14 @@
*/
#include "script_component.hpp"
-params ["_unit"];
+params [["_unit", objNull, [objNull]]];
-private ["_uav", "_positionArray", "_playerIndex"];
-
-_uav = getConnectedUAV _unit;
+private _uav = getConnectedUAV _unit;
if (isNull _uav) exitWith {""};
-_positionArray = UAVControl _uav;
-_playerIndex = _positionArray find _unit;
+private _positionArray = UAVControl _uav;
+private _playerIndex = _positionArray find _unit;
if (_playerIndex == -1) exitWith {""};
diff --git a/addons/common/functions/fnc_getVehicleCargo.sqf b/addons/common/functions/fnc_getVehicleCargo.sqf
index 5be213aa68..68599c919b 100644
--- a/addons/common/functions/fnc_getVehicleCargo.sqf
+++ b/addons/common/functions/fnc_getVehicleCargo.sqf
@@ -12,14 +12,12 @@
*/
#include "script_component.hpp"
-params ["_vehicle"];
+params [["_vehicle", objNull, [objNull]]];
-private ["_config", "_cargo", "_codrivers"];
+private _config = configFile >> "CfgVehicles" >> _vehicle;
-_config = configFile >> "CfgVehicles" >> _vehicle;
-
-_cargo = [];
-_codrivers = getArray (_config >> "cargoIsCoDriver");
+private _cargo = [];
+private _codrivers = getArray (_config >> "cargoIsCoDriver");
for "_index" from 0 to (getNumber (_config >> "transportSoldier") - 1) do {
if !(_index in _codrivers && {_vehicle isKindOf "Car"} && {!(_vehicle isKindOf "Wheeled_APC_F")}) then {
diff --git a/addons/common/functions/fnc_getVehicleCodriver.sqf b/addons/common/functions/fnc_getVehicleCodriver.sqf
index e23cfcd0d4..a1cc5814e1 100644
--- a/addons/common/functions/fnc_getVehicleCodriver.sqf
+++ b/addons/common/functions/fnc_getVehicleCodriver.sqf
@@ -12,14 +12,12 @@
*/
#include "script_component.hpp"
-params ["_vehicle"];
+params [["_vehicle", objNull, [objNull]]];
-private ["_config", "_cargo", "_codrivers"];
+private _config = configFile >> "CfgVehicles" >> _vehicle;
-_config = configFile >> "CfgVehicles" >> _vehicle;
-
-_cargo = [];
-_codrivers = getArray (_config >> "cargoIsCoDriver");
+private _cargo = [];
+private _codrivers = getArray (_config >> "cargoIsCoDriver");
for "_index" from 0 to (getNumber (_config >> "transportSoldier") - 1) do {
if (_index in _codrivers && {_vehicle isKindOf "Car"} && {!(_vehicle isKindOf "Wheeled_APC_F")}) then {
diff --git a/addons/common/functions/fnc_getVehicleCrew.sqf b/addons/common/functions/fnc_getVehicleCrew.sqf
index 58d0067b85..adb0e9701a 100644
--- a/addons/common/functions/fnc_getVehicleCrew.sqf
+++ b/addons/common/functions/fnc_getVehicleCrew.sqf
@@ -15,8 +15,7 @@
params ["_vehicle", ["_types", ["driver", "commander", "gunner", "turret", "cargo", "ffv"]]];
-private "_crew";
-_crew = [];
+private _crew = [];
// iterate through all crew members
{
diff --git a/addons/common/functions/fnc_getVehicleUAVCrew.sqf b/addons/common/functions/fnc_getVehicleUAVCrew.sqf
index 8d9156810a..fcb48ee216 100644
--- a/addons/common/functions/fnc_getVehicleUAVCrew.sqf
+++ b/addons/common/functions/fnc_getVehicleUAVCrew.sqf
@@ -12,6 +12,6 @@
*/
#include "script_component.hpp"
-params ["_vehicle"];
+params [["_vehicle", objNull, [objNull]]];
[crew _vehicle, {getText (configFile >> "CfgVehicles" >> typeOf _this >> "simulation") == "UAVPilot"}] call FUNC(filter) // return
diff --git a/addons/common/functions/fnc_getWeaponAzimuthAndInclination.sqf b/addons/common/functions/fnc_getWeaponAzimuthAndInclination.sqf
index 09968d8e39..f7c7909e01 100644
--- a/addons/common/functions/fnc_getWeaponAzimuthAndInclination.sqf
+++ b/addons/common/functions/fnc_getWeaponAzimuthAndInclination.sqf
@@ -15,12 +15,10 @@
params ["_weapon"];
-private ["_direction", "_azimuth", "_inclination"];
+private _direction = ACE_player weaponDirection _weapon;
-_direction = ACE_player weaponDirection _weapon;
-
-_azimuth = (_direction select 0) atan2 (_direction select 1);
-_inclination = asin (_direction select 2);
+private _azimuth = (_direction select 0) atan2 (_direction select 1);
+private _inclination = asin (_direction select 2);
if (_azimuth < 0) then {_azimuth = _azimuth + 360};
diff --git a/addons/common/functions/fnc_getWeaponModes.sqf b/addons/common/functions/fnc_getWeaponModes.sqf
index a2bb9c3205..48755d3a9b 100644
--- a/addons/common/functions/fnc_getWeaponModes.sqf
+++ b/addons/common/functions/fnc_getWeaponModes.sqf
@@ -12,13 +12,11 @@
*/
#include "script_component.hpp"
-params ["_weapon"];
+params [["_weapon", "", [""]]];
-private ["_config", "_modes"];
+private _config = configFile >> "CfgWeapons" >> _weapon;
-_config = configFile >> "CfgWeapons" >> _weapon;
-
-_modes = [];
+private _modes = [];
{
if (getNumber (_config >> _x >> "showToPlayer") == 1) then {
diff --git a/addons/common/functions/fnc_getWeaponMuzzles.sqf b/addons/common/functions/fnc_getWeaponMuzzles.sqf
index cdfd58f238..d75a01f2e3 100644
--- a/addons/common/functions/fnc_getWeaponMuzzles.sqf
+++ b/addons/common/functions/fnc_getWeaponMuzzles.sqf
@@ -12,13 +12,14 @@
*/
#include "script_component.hpp"
-params ["_weapon"];
+params [["_weapon", "", [""]]];
-private "_muzzles";
-_muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles");
+private _muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles");
-if ("this" in _muzzles) then {
- _muzzles set [_muzzles find "this", _weapon];
-};
+{
+ if (_x == "this") then {
+ _muzzles set [_forEachIndex, _weapon];
+ };
+} forEach _muzzles;
_muzzles
diff --git a/addons/common/functions/fnc_getWeaponState.sqf b/addons/common/functions/fnc_getWeaponState.sqf
index 8ee1610f4e..e7b7bb80ec 100644
--- a/addons/common/functions/fnc_getWeaponState.sqf
+++ b/addons/common/functions/fnc_getWeaponState.sqf
@@ -18,17 +18,13 @@
params ["_unit", "_weapon"];
-private ["_muzzles", "_weaponInfo"];
+private _muzzles = _weapon call FUNC(getWeaponMuzzles);
-_muzzles = [_weapon] call FUNC(getWeaponMuzzles);
-
-_weaponInfo = [["","","",""], primaryWeaponItems _unit, secondaryWeaponItems _unit, handgunItems _unit] select ((["", primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit] find _weapon) max 0);
+private _weaponInfo = [["","","",""], primaryWeaponItems _unit, secondaryWeaponItems _unit, handgunItems _unit] select ((["", primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit] find _weapon) max 0);
// get loaded magazines and ammo
-private ["_magazines", "_ammo"];
-
-_magazines = [];
-_ammo = [];
+private _magazines = [];
+private _ammo = [];
{
_magazines pushBack "";
@@ -38,8 +34,7 @@ _ammo = [];
{
if (_x select 2) then {
- private "_index";
- _index = _muzzles find (_x select 4);
+ private _index = _muzzles find (_x select 4);
if (_index != -1) then {
_magazines set [_index, _x select 0];
diff --git a/addons/common/functions/fnc_getWeaponType.sqf b/addons/common/functions/fnc_getWeaponType.sqf
index f8ee7f9fe4..5666ea5bc0 100644
--- a/addons/common/functions/fnc_getWeaponType.sqf
+++ b/addons/common/functions/fnc_getWeaponType.sqf
@@ -18,11 +18,9 @@
params ["_weapon"];
-private ["_type", "_index"];
+private _type = [getNumber (configFile >> "CfgWeapons" >> _weapon >> "type")] call FUNC(binarizeNumber);
-_type = [getNumber (configFile >> "CfgWeapons" >> _weapon >> "type")] call FUNC(binarizeNumber);
-
-_index = 0;
+private _index = 0;
while {!(_type select _index) && {_index < 16}} do {
_index = _index + 1;
diff --git a/addons/common/functions/fnc_hadamardProduct.sqf b/addons/common/functions/fnc_hadamardProduct.sqf
index b4ed7f9be1..cdaf707395 100644
--- a/addons/common/functions/fnc_hadamardProduct.sqf
+++ b/addons/common/functions/fnc_hadamardProduct.sqf
@@ -16,8 +16,7 @@
params ["_vector1", "_vector2"];
-private "_newVector";
-_newVector = [];
+private _newVector = [];
for "_i" from 0 to ((count _vector1 min count _vector2) - 1) do {
_newVector pushBack ((_vector1 select _i) * (_vector2 select _i));
diff --git a/addons/common/functions/fnc_hasHatch.sqf b/addons/common/functions/fnc_hasHatch.sqf
index a67ad0b0d3..e39c52f897 100644
--- a/addons/common/functions/fnc_hasHatch.sqf
+++ b/addons/common/functions/fnc_hasHatch.sqf
@@ -12,7 +12,7 @@
*/
#include "script_component.hpp"
-params ["_unit"];
+params [["_unit", objNull, [objNull]]];
private _vehicle = vehicle _unit;
diff --git a/addons/common/functions/fnc_hasItem.sqf b/addons/common/functions/fnc_hasItem.sqf
index 526f5a46f2..8ca785d78e 100644
--- a/addons/common/functions/fnc_hasItem.sqf
+++ b/addons/common/functions/fnc_hasItem.sqf
@@ -10,9 +10,11 @@
* has Item
*
* Public: yes
+ *
+ * Note: Case sensitive
*/
#include "script_component.hpp"
-params ["_unit", "_item"];
+params [["_unit", objNull, [objNull]], ["_item", "", [""]]];
_item in items _unit // return
diff --git a/addons/common/functions/fnc_hasMagazine.sqf b/addons/common/functions/fnc_hasMagazine.sqf
index 27150ea5d5..eaa9bc0556 100644
--- a/addons/common/functions/fnc_hasMagazine.sqf
+++ b/addons/common/functions/fnc_hasMagazine.sqf
@@ -10,9 +10,11 @@
* has Magazine
*
* Public: yes
+ *
+ * Note: Case sensitive
*/
#include "script_component.hpp"
-params ["_unit", "_magazine"];
+params [["_unit", objNull, [objNull]], ["_magazine", "", [""]]];
_magazine in magazines _unit // return
diff --git a/addons/common/functions/fnc_hashGet.sqf b/addons/common/functions/fnc_hashGet.sqf
index df5d294beb..d0a5cdf22e 100644
--- a/addons/common/functions/fnc_hashGet.sqf
+++ b/addons/common/functions/fnc_hashGet.sqf
@@ -13,15 +13,13 @@
*/
#include "script_component.hpp"
-private ["_val", "_index"];
-
params ["_hash", "_key"];
ERRORDATA(2);
-_val = nil;
+private _val = nil;
try {
if(VALIDHASH(_hash)) then {
- _index = (_hash select 0) find _key;
+ private _index = (_hash select 0) find _key;
if(_index != -1) then {
_val = (_hash select 1) select _index;
if(IS_STRING(_val) && {_val == "ACREHASHREMOVEDONOTUSETHISVAL"}) then {
diff --git a/addons/common/functions/fnc_hashHasKey.sqf b/addons/common/functions/fnc_hashHasKey.sqf
index 5c6293fc85..b2978f9cc4 100644
--- a/addons/common/functions/fnc_hashHasKey.sqf
+++ b/addons/common/functions/fnc_hashHasKey.sqf
@@ -12,16 +12,15 @@
*/
#include "script_component.hpp"
-private ["_val", "_index"];
// diag_log text format["%1 HASH HAS KEY: %2", ACE_diagTime, _this];
params ["_hash", "_key"];
ERRORDATA(2);
-_val = false;
+private _val = false;
try {
if(VALIDHASH(_hash)) then {
- _index = (_hash select 0) find _key;
+ private _index = (_hash select 0) find _key;
if(_index != -1) then {
_val = true;
};
diff --git a/addons/common/functions/fnc_hashListCreateHash.sqf b/addons/common/functions/fnc_hashListCreateHash.sqf
index d6a94445eb..d5cc323c8d 100644
--- a/addons/common/functions/fnc_hashListCreateHash.sqf
+++ b/addons/common/functions/fnc_hashListCreateHash.sqf
@@ -12,12 +12,10 @@
*/
#include "script_component.hpp"
-private ["_hashKeys"];
-
params ["_hashList"];
ERRORDATA(1);
-_hashKeys = [];
+private _hashKeys = [];
try {
if(VALIDHASH(_hashList)) then {
_hashKeys = (_hashList select 0);
diff --git a/addons/common/functions/fnc_hashListSelect.sqf b/addons/common/functions/fnc_hashListSelect.sqf
index df072d55bd..f5e3d85b31 100644
--- a/addons/common/functions/fnc_hashListSelect.sqf
+++ b/addons/common/functions/fnc_hashListSelect.sqf
@@ -12,18 +12,16 @@
*/
#include "script_component.hpp"
-private ["_hash", "_keys", "_hashes", "_values"];
-
params ["_hashList", "_index"];
ERRORDATA(2);
-_hash = nil;
+private _hash = nil;
try {
if(VALIDHASH(_hashList)) then {
- _keys = _hashList select 0;
- _hashes = _hashList select 1;
+ _hashList params ["_keys", "_hashes"];
+
if(_index < (count _hashes)) then {
- _values = _hashes select _index;
+ private _values = _hashes select _index;
_hash = [_keys, _values, 1];
} else {
diff --git a/addons/common/functions/fnc_hashListSet.sqf b/addons/common/functions/fnc_hashListSet.sqf
index 5fea048327..ee0a8dc7eb 100644
--- a/addons/common/functions/fnc_hashListSet.sqf
+++ b/addons/common/functions/fnc_hashListSet.sqf
@@ -12,15 +12,13 @@
*/
#include "script_component.hpp"
-private ["_vals"];
-
params ["_hashList", "_index", "_value"];
ERRORDATA(3);
try {
if(VALIDHASH(_hashList)) then {
if(VALIDHASH(_value)) then {
- _vals = _value select 1;
+ _value params ["", "_vals"];
(_hashList select 1) set[_index, _vals];
} else {
diff --git a/addons/common/functions/fnc_hashRem.sqf b/addons/common/functions/fnc_hashRem.sqf
index 4346a509cf..bd0c8f2a2d 100644
--- a/addons/common/functions/fnc_hashRem.sqf
+++ b/addons/common/functions/fnc_hashRem.sqf
@@ -12,15 +12,13 @@
*/
#include "script_component.hpp"
-private ["_val", "_index"];
-
params ["_hash", "_key"];
ERRORDATA(2);
-_val = nil;
+private _val = nil;
try {
if(VALIDHASH(_hash)) then {
- _index = (_hash select 0) find _key;
+ private _index = (_hash select 0) find _key;
if(_index != -1) then {
(_hash select 1) set[_index, "ACREHASHREMOVEDONOTUSETHISVAL"];
// is this hash is not part of a hash list?
diff --git a/addons/common/functions/fnc_hashSet.sqf b/addons/common/functions/fnc_hashSet.sqf
index af7a361dd6..10e2881c10 100644
--- a/addons/common/functions/fnc_hashSet.sqf
+++ b/addons/common/functions/fnc_hashSet.sqf
@@ -12,7 +12,6 @@
*/
#include "script_component.hpp"
-private ["_index"];
// diag_log text format["%1 HASH SET: %2", ACE_diagTime, _this];
params ["_hash", "_key", "_val"];
@@ -20,7 +19,7 @@ params ["_hash", "_key", "_val"];
ERRORDATA(3);
try {
if(VALIDHASH(_hash)) then {
- _index = (_hash select 0) find _key;
+ private _index = (_hash select 0) find _key;
if(_index == -1) then {
_index = (_hash select 0) find "ACREHASHREMOVEDONOTUSETHISVAL";
if(_index == -1) then {
diff --git a/addons/common/functions/fnc_headBugFix.sqf b/addons/common/functions/fnc_headBugFix.sqf
index 78b1a602df..dffb28ff4b 100644
--- a/addons/common/functions/fnc_headBugFix.sqf
+++ b/addons/common/functions/fnc_headBugFix.sqf
@@ -14,24 +14,22 @@
*/
#include "script_component.hpp"
-private ["_unit", "_anim", "_pos", "_dir", "_dummy"];
-
-_unit = ACE_player;
-_anim = animationState _unit;
+private _unit = ACE_player;
+private _anim = animationState _unit;
["HeadbugFixUsed", [profileName, _anim]] call FUNC(serverEvent);
["HeadbugFixUsed", [profileName, _anim]] call FUNC(localEvent);
if (_unit != vehicle _unit || {!([_unit, objNull, ["isNotSitting"]] call FUNC(canInteractWith))}) exitWith {false};
-_pos = getPosATL _unit;
-_dir = getDir _unit;
+private _pos = getPosATL _unit;
+private _dir = getDir _unit;
titleCut ["", "BLACK"];
[_unit, "headBugFix"] call FUNC(hideUnit);
// create invisible headbug fix vehicle
-_dummy = createVehicle ["ACE_Headbug_Fix", _pos, [], 0, "NONE"];
+private _dummy = createVehicle ["ACE_Headbug_Fix", _pos, [], 0, "NONE"];
_dummy setDir _dir;
_unit moveInAny _dummy;
sleep 0.1; // @todo
diff --git a/addons/common/functions/fnc_hideUnit.sqf b/addons/common/functions/fnc_hideUnit.sqf
index 7fdd901848..85636a08f7 100644
--- a/addons/common/functions/fnc_hideUnit.sqf
+++ b/addons/common/functions/fnc_hideUnit.sqf
@@ -12,7 +12,7 @@
* Example:
* [ACE_Player, "SpectatorMode"] call ace_common_fnc_hideUnit
*
- * Public: No
+ * Public: Yes
*/
#include "script_component.hpp"
@@ -20,8 +20,7 @@ params ["_unit", "_reason"];
if (isNull _unit) exitWith {};
-private "_setHiddenReasons";
-_setHiddenReasons = _unit getVariable [QGVAR(setHiddenReasons), []];
+private _setHiddenReasons = _unit getVariable [QGVAR(setHiddenReasons), []];
if !(_reason in _setHiddenReasons) then {
_setHiddenReasons pushBack _reason;
diff --git a/addons/common/functions/fnc_inheritsFrom.sqf b/addons/common/functions/fnc_inheritsFrom.sqf
index 7f881ff746..4ec39d8cc3 100644
--- a/addons/common/functions/fnc_inheritsFrom.sqf
+++ b/addons/common/functions/fnc_inheritsFrom.sqf
@@ -24,8 +24,7 @@ params ["_configEntry", "_configMatch"];
if (configName _configEntry == _configMatch) exitWith {true};
if (configName _configEntry == ",") exitWith {false};
-private "_match";
-_match = false;
+private _match = false;
while {configName _configEntry != ""} do {
if (configName _configEntry == _configMatch) exitWith {
diff --git a/addons/common/functions/fnc_insertionSort.sqf b/addons/common/functions/fnc_insertionSort.sqf
index 9f8c95e095..d2f89a039e 100644
--- a/addons/common/functions/fnc_insertionSort.sqf
+++ b/addons/common/functions/fnc_insertionSort.sqf
@@ -17,10 +17,8 @@ params ["_list", ["_ascending", true]];
_list = + _list; // copy array to not alter the original one
-private "_tmp";
-
for "_i" from 1 to (count _list - 1) do {
- _tmp = _list select _i;
+ private _tmp = _list select _i;
_j = _i;
while {_j >= 1 && {_tmp < _list select (_j - 1)}} do {
diff --git a/addons/common/functions/fnc_interpolateFromArray.sqf b/addons/common/functions/fnc_interpolateFromArray.sqf
index 5ce59bde62..07207071e7 100644
--- a/addons/common/functions/fnc_interpolateFromArray.sqf
+++ b/addons/common/functions/fnc_interpolateFromArray.sqf
@@ -15,9 +15,7 @@
params ["_array", "_value"];
-private ["_min", "_max"];
-
-_min = _array select floor _value;
-_max = _array select ceil _value;
+private _min = _array select floor _value;
+private _max = _array select ceil _value;
_min + (_max - _min) * (_value % 1) // return
diff --git a/addons/common/functions/fnc_isInBuilding.sqf b/addons/common/functions/fnc_isInBuilding.sqf
index 577b865aee..e5234b9200 100644
--- a/addons/common/functions/fnc_isInBuilding.sqf
+++ b/addons/common/functions/fnc_isInBuilding.sqf
@@ -14,13 +14,11 @@
#define CHECK_DISTANCE 10
-params ["_unit"];
+params [["_unit", objNull, [objNull]]];
-private ["_position", "_intersections"];
+private _position = eyePos _unit;
-_position = eyePos _unit;
-
-_intersections = 0;
+private _intersections = 0;
if (lineIntersects [_position, _position vectorAdd [0, 0, +CHECK_DISTANCE]]) then {
_intersections = _intersections + 1;
diff --git a/addons/common/functions/fnc_isModLoaded.sqf b/addons/common/functions/fnc_isModLoaded.sqf
index cb62a90440..46e1bc03a8 100644
--- a/addons/common/functions/fnc_isModLoaded.sqf
+++ b/addons/common/functions/fnc_isModLoaded.sqf
@@ -12,6 +12,6 @@
*/
#include "script_component.hpp"
-params ["_modName"];
+params [["_modName", "", [""]]];
isClass (configFile >> "CfgPatches" >> _modName) // return
diff --git a/addons/common/functions/fnc_isUnderwater.sqf b/addons/common/functions/fnc_isUnderwater.sqf
index d2f399b770..637ed49f3d 100644
--- a/addons/common/functions/fnc_isUnderwater.sqf
+++ b/addons/common/functions/fnc_isUnderwater.sqf
@@ -12,14 +12,12 @@
*/
#include "script_component.hpp"
-params ["_unit"];
+params [["_unit", objNull, [objNull]]];
-private "_return";
-_return = false;
+private _return = false;
if (surfaceIsWater getPosASL _unit) then {
- private "_pos";
- _pos = _unit modelToWorldVisual (_unit selectionPosition "head");
+ private _pos = _unit modelToWorldVisual (_unit selectionPosition "head");
if (_pos select 2 < 0) then {
_return = true;
diff --git a/addons/common/functions/fnc_lightIntensityFromObject.sqf b/addons/common/functions/fnc_lightIntensityFromObject.sqf
index df88671405..a495897dea 100644
--- a/addons/common/functions/fnc_lightIntensityFromObject.sqf
+++ b/addons/common/functions/fnc_lightIntensityFromObject.sqf
@@ -15,79 +15,60 @@
params ["_unit", "_lightSource"];
-private ["_unitPos", "_lightLevel"];
-
-_unitPos = _unit modelToWorld (_unit selectionPosition "spine3");
-_lightLevel = 0;
+private _unitPos = _unit modelToWorld (_unit selectionPosition "spine3");
+private _lightLevel = 0;
if (_lightSource isKindOf "CAManBase") then {
// handle persons with flashlights
- private "_weapon";
- _weapon = currentWeapon _lightSource;
+ private _weapon = currentWeapon _lightSource;
if !(_lightSource isFlashlightOn _weapon) exitWith {};
- private ["_flashlight", "_properties", "_intensity", "_innerAngle", "_outerAngle", "_position", "_direction", "_directionToUnit", "_distance", "_angle"];
-
- _flashlight = switch (_weapon) do {
- case (primaryWeapon _lightSource): {
- primaryWeaponItems _lightSource select 1
- };
- case (secondaryWeapon _lightSource): {
- secondaryWeaponItems _lightSource select 1
- };
- case (handgunWeapon _lightSource): {
- handgunItems _lightSource select 1
- };
- default {""};
- };
+ private _flashlight = (_lightSource weaponAccessories _weapon) select 1;
if (getNumber (configFile >> "CfgWeapons" >> _flashlight >> "ACE_laserpointer") == 1) exitWith {_lightLevel = 0};
- _properties = [[_flashlight], FUNC(getLightPropertiesWeapon), uiNamespace, format [QEGVAR(cache,%1_%2), QUOTE(DFUNC(getLightPropertiesWeapon)), _flashlight], 1E11] call FUNC(cachedCall);
+ private _properties = [[_flashlight], FUNC(getLightPropertiesWeapon), uiNamespace, format [QEGVAR(cache,%1_%2), QUOTE(DFUNC(getLightPropertiesWeapon)), _flashlight], 1E11] call FUNC(cachedCall);
//_properties = [_flashlight] call FUNC(getLightPropertiesWeapon);
- _innerAngle = (_properties select 3) / 2;
- _outerAngle = (_properties select 4) / 2;
+ private _innerAngle = (_properties select 3) / 2;
+ private _outerAngle = (_properties select 4) / 2;
- _position = _lightSource modelToWorld (_lightSource selectionPosition "rightHand");
- _direction = _lightSource weaponDirection _weapon;
+ private _position = _lightSource modelToWorld (_lightSource selectionPosition "rightHand");
+ private _direction = _lightSource weaponDirection _weapon;
- _directionToUnit = _position vectorFromTo _unitPos;
+ private _directionToUnit = _position vectorFromTo _unitPos;
- _distance = _unitPos distance _position;
- _angle = acos (_direction vectorDotProduct _directionToUnit);
+ private _distance = _unitPos distance _position;
+ private _angle = acos (_direction vectorDotProduct _directionToUnit);
_lightLevel = (linearConversion [0, 30, _distance, 1, 0, true]) * (linearConversion [_innerAngle, _outerAngle, _angle, 1, 0, true]);
} else {
// handle any object, strcutures, cars, tanks, etc. @todo campfires, burning vehicles
- private "_lights";
- _lights = [_lightSource] call FUNC(getTurnedOnLights);
+ private _lights = _lightSource call FUNC(getTurnedOnLights);
{
- private ["_properties", "_intensity", "_innerAngle", "_outerAngle", "_position", "_direction", "_directionToUnit", "_distance", "_angle"];
-
- _properties = [[_lightSource, _x], FUNC(getLightProperties), uiNamespace, format [QEGVAR(cache,%1_%2_%3), QUOTE(DFUNC(getLightProperties)), typeOf _lightSource, _x], 1E11] call FUNC(cachedCall);
+ private _properties = [[_lightSource, _x], FUNC(getLightProperties), uiNamespace, format [QEGVAR(cache,%1_%2_%3), QUOTE(DFUNC(getLightProperties)), typeOf _lightSource, _x], 1E11] call FUNC(cachedCall);
//_properties = [_lightSource, _x] call FUNC(getLightProperties);
// @todo intensity affects range?
- //_intensity = _properties select 0;
+ //_properties params ["_intensity"];
- _innerAngle = (_properties select 3) / 2;
- _outerAngle = (_properties select 4) / 2;
+ private _innerAngle = (_properties select 3) / 2;
+ private _outerAngle = (_properties select 4) / 2;
// get world position and direction
- _position = _lightSource modelToWorld (_lightSource selectionPosition (_properties select 1));
- _direction = _lightSource modelToWorld (_lightSource selectionPosition (_properties select 2));
+ private _position = _lightSource modelToWorld (_lightSource selectionPosition (_properties select 1));
+ private _direction = _lightSource modelToWorld (_lightSource selectionPosition (_properties select 2));
_direction = _position vectorFromTo _direction;
- _directionToUnit = _position vectorFromTo _unitPos;
+ private _directionToUnit = _position vectorFromTo _unitPos;
- _distance = _unitPos distance _position;
- _angle = acos (_direction vectorDotProduct _directionToUnit);
+ private _distance = _unitPos distance _position;
+ private _angle = acos (_direction vectorDotProduct _directionToUnit);
_lightLevel = _lightLevel max ((linearConversion [0, 30, _distance, 1, 0, true]) * (linearConversion [_innerAngle, _outerAngle, _angle, 1, 0, true]));
@@ -97,8 +78,7 @@ if (_lightSource isKindOf "CAManBase") then {
// handle campfires
if (inflamed _lightSource) then {
- private "_distance";
- _distance = _unitPos distance position _lightSource;
+ private _distance = _unitPos distance position _lightSource;
_lightLevel = _lightLevel max linearConversion [0, 30, _distance, 0.5, 0, true];
};
diff --git a/addons/common/functions/fnc_loadPerson.sqf b/addons/common/functions/fnc_loadPerson.sqf
index 659d63224a..3071ffbd47 100644
--- a/addons/common/functions/fnc_loadPerson.sqf
+++ b/addons/common/functions/fnc_loadPerson.sqf
@@ -17,28 +17,26 @@
params ["_caller", "_unit"];
-private ["_vehicle", "_loadcar", "_loadair", "_loadtank", "_loadboat"];
-
-_vehicle = objNull;
+private _vehicle = objNull;
if (!([_caller, _unit, ["isNotDragging", "isNotCarrying"]] call FUNC(canInteractWith)) || {_caller == _unit}) exitWith {_vehicle};
-_loadcar = nearestObject [_unit, "Car"];
+private _loadcar = nearestObject [_unit, "Car"];
if (_unit distance _loadcar <= 10) then {
_vehicle = _loadcar;
} else {
- _loadair = nearestObject [_unit, "Air"];
+ private _loadair = nearestObject [_unit, "Air"];
if (_unit distance _loadair <= 10) then {
_vehicle = _loadair;
} else {
- _loadtank = nearestObject [_unit, "Tank"];
+ private _loadtank = nearestObject [_unit, "Tank"];
if (_unit distance _loadtank <= 10) then {
_vehicle = _loadtank;
} else {
- _loadboat = nearestObject [_unit, "Ship_F"];
+ private _loadboat = nearestObject [_unit, "Ship_F"];
if (_unit distance _loadboat <= 10) then {
_vehicle = _loadboat;
diff --git a/addons/common/functions/fnc_loadPersonLocal.sqf b/addons/common/functions/fnc_loadPersonLocal.sqf
index 5b52b38b05..db0248a901 100644
--- a/addons/common/functions/fnc_loadPersonLocal.sqf
+++ b/addons/common/functions/fnc_loadPersonLocal.sqf
@@ -20,9 +20,7 @@ if (!alive _unit) then {
// _unit = [_unit, _caller] call FUNC(makeCopyOfBody); //func does not exist
};
-private "_slotsOpen";
-
-_slotsOpen = false;
+private _slotsOpen = false;
if (_vehicle emptyPositions "cargo" > 0) then {
_unit moveInCargo _vehicle;
@@ -35,8 +33,7 @@ if (_vehicle emptyPositions "cargo" > 0) then {
};
if (_slotsOpen) then {
- private "_loaded";
- _loaded = _vehicle getVariable [QGVAR(loaded_persons),[]];
+ private _loaded = _vehicle getVariable [QGVAR(loaded_persons),[]];
_loaded pushBack _unit;
_vehicle setVariable [QGVAR(loaded_persons), _loaded, true];
diff --git a/addons/common/functions/fnc_loadSettingsFromProfile.sqf b/addons/common/functions/fnc_loadSettingsFromProfile.sqf
index a596583a5c..46b0134740 100644
--- a/addons/common/functions/fnc_loadSettingsFromProfile.sqf
+++ b/addons/common/functions/fnc_loadSettingsFromProfile.sqf
@@ -21,8 +21,7 @@
if (_isClientSetable) then {
// If setting is not forced
if !(_isForced) then {
- private "_profileValue";
- _profileValue = profileNamespace getVariable _name;
+ private _profileValue = profileNamespace getVariable _name;
// If the setting is stored on the profile
if !(isNil "_profileValue") then {
diff --git a/addons/common/functions/fnc_loadSettingsLocalizedText.sqf b/addons/common/functions/fnc_loadSettingsLocalizedText.sqf
index 225c2d9675..f846fa9354 100644
--- a/addons/common/functions/fnc_loadSettingsLocalizedText.sqf
+++ b/addons/common/functions/fnc_loadSettingsLocalizedText.sqf
@@ -12,14 +12,12 @@
*/
#include "script_component.hpp"
-private "_fnc_parseConfigForDisplayNames";
-_fnc_parseConfigForDisplayNames = {
+private _fnc_parseConfigForDisplayNames = {
params ["_optionEntry"];
if !(isClass _optionEntry) exitWith {false};
- private "_values";
- _values = getArray (_optionEntry >> "values");
+ private _values = getArray (_optionEntry >> "values");
_x set [3, getText (_optionEntry >> "displayName")];
_x set [4, getText (_optionEntry >> "description")];
@@ -27,8 +25,7 @@ _fnc_parseConfigForDisplayNames = {
_x set [8, getText (_optionEntry >> "category")];
{
- private "_text";
- _text = _x;
+ private _text = _x;
if (_text isEqualType "" && {count _text > 1} && {_text select [0, 1] == "$"}) then {
_text = localize (_text select [1]); //chop off the leading $
diff --git a/addons/common/functions/fnc_loadSettingsOnServer.sqf b/addons/common/functions/fnc_loadSettingsOnServer.sqf
index cdf8b48041..4498c9d058 100644
--- a/addons/common/functions/fnc_loadSettingsOnServer.sqf
+++ b/addons/common/functions/fnc_loadSettingsOnServer.sqf
@@ -15,15 +15,13 @@
GVAR(settings) = [];
-private "_fnc_parseConfigForSettings";
-_fnc_parseConfigForSettings = {
- private ["_config", "_countOptions", "_optionEntry"];
+private _fnc_parseConfigForSettings = {
+ params ["_config"];
- _config = _this select 0;
- _countOptions = count _config;
+ private _countOptions = count _config;
for "_index" from 0 to (_countOptions - 1) do {
- _optionEntry = _config select _index;
+ private _optionEntry = _config select _index;
[_optionEntry] call FUNC(setSettingFromConfig);
};
diff --git a/addons/common/functions/fnc_localEvent.sqf b/addons/common/functions/fnc_localEvent.sqf
index f5a121c088..43f6209d0d 100644
--- a/addons/common/functions/fnc_localEvent.sqf
+++ b/addons/common/functions/fnc_localEvent.sqf
@@ -17,12 +17,10 @@ params ["_eventName", "_eventArgs"];
GVAR(events) params ["_eventNames", "_eventArray"];
-private "_eventIndex";
-_eventIndex = _eventNames find _eventName;
+private _eventIndex = _eventNames find _eventName;
if (_eventIndex != -1) then {
- private "_events";
- _events = _eventArray select _eventIndex;
+ private _events = _eventArray select _eventIndex;
#ifdef DEBUG_EVENTS
ACE_LOGINFO_1("* Local Event: %1",_eventName);
diff --git a/addons/common/functions/fnc_map.sqf b/addons/common/functions/fnc_map.sqf
index a727de08bf..5d24e13b38 100644
--- a/addons/common/functions/fnc_map.sqf
+++ b/addons/common/functions/fnc_map.sqf
@@ -16,7 +16,7 @@
*/
#include "script_component.hpp"
-params ["_array", "_code"];
+params [["_array", [], [[]]], ["_code", {}, [{}]]];
// copy array to not alter the original one
_array = + _array;
diff --git a/addons/common/functions/fnc_muteUnit.sqf b/addons/common/functions/fnc_muteUnit.sqf
index 84d56f92bd..d4648155b6 100644
--- a/addons/common/functions/fnc_muteUnit.sqf
+++ b/addons/common/functions/fnc_muteUnit.sqf
@@ -17,17 +17,15 @@ params ["_unit", "_reason"];
if (isNull _unit) exitWith {};
-private ["_muteUnitReasons", "_speaker"];
-
// add reason to mute to the unit
-_muteUnitReasons = _unit getVariable [QGVAR(muteUnitReasons), []];
+private _muteUnitReasons = _unit getVariable [QGVAR(muteUnitReasons), []];
if !(_reason in _muteUnitReasons) then {
_muteUnitReasons pushBack _reason;
_unit setVariable [QGVAR(muteUnitReasons), _muteUnitReasons, true];
};
-_speaker = speaker _unit;
+private _speaker = speaker _unit;
if (_speaker == "ACE_NoVoice") exitWith {};
diff --git a/addons/common/functions/fnc_numberToDigits.sqf b/addons/common/functions/fnc_numberToDigits.sqf
index c5e1b6d7b6..b90f0eefd7 100644
--- a/addons/common/functions/fnc_numberToDigits.sqf
+++ b/addons/common/functions/fnc_numberToDigits.sqf
@@ -18,8 +18,7 @@ params ["_number", "_minLength"];
_number = _number min 999999;
_number = str _number;
-private "_length";
-_length = count _number;
+private _length = count _number;
if (isNil "_minLength") then {_minLength = _length};
@@ -30,8 +29,7 @@ while {_length < _minLength} do {
_length = _length + 1;
};
-private "_digits";
-_digits = [];
+private _digits = [];
for "_x" from 0 to (_length - 1) do {
_digits pushBack parseNumber (_number select [_x, 1]);
diff --git a/addons/common/functions/fnc_numberToDigitsString.sqf b/addons/common/functions/fnc_numberToDigitsString.sqf
index f8f192e0e3..7e2c78f8b4 100644
--- a/addons/common/functions/fnc_numberToDigitsString.sqf
+++ b/addons/common/functions/fnc_numberToDigitsString.sqf
@@ -18,8 +18,7 @@ params ["_number", "_minLength"];
_number = _number min 999999;
_number = str _number;
-private "_length";
-_length = count _number;
+private _length = count _number;
if (isNil "_minLength") then {_minLength = _length};
diff --git a/addons/common/functions/fnc_numberToString.sqf b/addons/common/functions/fnc_numberToString.sqf
index 4dd810607c..1cb2f521f8 100644
--- a/addons/common/functions/fnc_numberToString.sqf
+++ b/addons/common/functions/fnc_numberToString.sqf
@@ -14,8 +14,7 @@
params ["_number"];
-private "_decimals";
-_decimals = str (abs _number mod 1);
+private _decimals = str (abs _number mod 1);
_decimals = toArray _decimals;
_decimals deleteAt 0;
diff --git a/addons/common/functions/fnc_onAnswerRequest.sqf b/addons/common/functions/fnc_onAnswerRequest.sqf
index 2f7aef43a5..d88969b059 100644
--- a/addons/common/functions/fnc_onAnswerRequest.sqf
+++ b/addons/common/functions/fnc_onAnswerRequest.sqf
@@ -14,17 +14,12 @@
params ["_unit", "_id", "_accepted"];
-private ["_requestID", "_info", "_callBack", "_caller", "_replyParams", "_requestMessage", "_target"];
-
-_info = _unit getVariable _id;
+private _info = _unit getVariable _id;
if (!isNil "_info") then {
- _caller = _info select 0;
- _target = _info select 1;
- _requestID = _info select 2;
- _requestMessage = _info select 3;
- _callBack = _info select 4;
- _replyParams = [_info, _accepted];
+ _info params ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"];
+
+ private _replyParams = [_info, _accepted];
[_replyParams, QFUNC(requestCallback), _caller, false] call FUNC(execRemoteFnc);
_unit setVariable [_id, nil];
};
diff --git a/addons/common/functions/fnc_parseList.sqf b/addons/common/functions/fnc_parseList.sqf
index ef7eaae92a..fc92605682 100644
--- a/addons/common/functions/fnc_parseList.sqf
+++ b/addons/common/functions/fnc_parseList.sqf
@@ -19,36 +19,34 @@
params ["_list", ["_removeWhitespace", false], ["_checkNil", false]];
-private ["_whitespaceList", "_nilCheckedList"];
-
// Split using comma delimiter
_list = _list splitString ",";
TRACE_1("Splitted List",_list);
-
// Remove or Trim Whitespace
-_whitespaceList = [];
+private _whitespaceList = [];
+
{
if (_removeWhitespace) then {
_whitespaceList pushBack ([_x] call FUNC(stringRemoveWhiteSpace));
} else {
_whitespaceList pushBack ([_x] call CBA_fnc_trim);
};
- nil
+ false
} count _list;
_list = _whitespaceList;
TRACE_1("Whitespace List",_list);
-
// Check for object existence
if (_checkNil) then {
- _nilCheckedList = [];
+ private _nilCheckedList = [];
+
{
if !(isNil _x) then {
_nilCheckedList pushBack (missionNamespace getVariable _x);
};
- nil
+ false
} count _list;
_list = _nilCheckedList;
diff --git a/addons/common/functions/fnc_progressBar.sqf b/addons/common/functions/fnc_progressBar.sqf
index 170d0060c0..e842590f35 100644
--- a/addons/common/functions/fnc_progressBar.sqf
+++ b/addons/common/functions/fnc_progressBar.sqf
@@ -24,9 +24,7 @@
params ["_totalTime", "_args", "_onFinish", "_onFail", ["_localizedTitle", ""], ["_condition", {true}], ["_exceptions", []]];
-private ["_player", "_ctrlPos", "_fnc_perFrameFunction"];
-
-_player = ACE_player;
+private _player = ACE_player;
//Open Dialog and set the title
closeDialog 0;
@@ -35,7 +33,7 @@ createDialog QGVAR(ProgressBar_Dialog);
(uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlSetText _localizedTitle;
//Adjust position based on user setting:
-_ctrlPos = ctrlPosition (uiNamespace getVariable QGVAR(ctrlProgressBarTitle));
+private _ctrlPos = ctrlPosition (uiNamespace getVariable QGVAR(ctrlProgressBarTitle));
_ctrlPos set [1, ((0 + 29 * GVAR(SettingProgressBarLocation)) * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2))];
(uiNamespace getVariable QGVAR(ctrlProgressBG)) ctrlSetPosition _ctrlPos;
@@ -45,13 +43,11 @@ _ctrlPos set [1, ((0 + 29 * GVAR(SettingProgressBarLocation)) * ((((safezoneW /
(uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlSetPosition _ctrlPos;
(uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlCommit 0;
-_fnc_perFrameFunction = {
+[{
(_this select 0) params ["_args", "_onFinish", "_onFail", "_condition", "_player", "_startTime", "_totalTime", "_exceptions"];
- private ["_elapsedTime", "_errorCode"];
-
- _elapsedTime = ACE_time - _startTime;
- _errorCode = -1;
+ private _elapsedTime = ACE_time - _startTime;
+ private _errorCode = -1;
// this does not check: target fell unconscious, target died, target moved inside vehicle / left vehicle, target moved outside of players range, target moves at all.
if (isNull (uiNamespace getVariable [QGVAR(ctrlProgressBar), controlNull])) then {
@@ -101,6 +97,4 @@ _fnc_perFrameFunction = {
//Update Progress Bar (ratio of elepased:total)
(uiNamespace getVariable QGVAR(ctrlProgressBar)) progressSetPosition (_elapsedTime / _totalTime);
};
-};
-
-[_fnc_perFrameFunction, 0, [_args, _onFinish, _onFail, _condition, _player, ACE_time, _totalTime, _exceptions]] call CBA_fnc_addPerFrameHandler;
+}, 0, [_args, _onFinish, _onFail, _condition, _player, ACE_time, _totalTime, _exceptions]] call CBA_fnc_addPerFrameHandler;
diff --git a/addons/common/functions/fnc_receiveRequest.sqf b/addons/common/functions/fnc_receiveRequest.sqf
index d4e867e348..75f684f5dd 100644
--- a/addons/common/functions/fnc_receiveRequest.sqf
+++ b/addons/common/functions/fnc_receiveRequest.sqf
@@ -50,8 +50,7 @@ GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT) = [ACE_time, _target, _requestID] spawn {
_time = _time + 40;
- private "_id";
- _id = _target getVariable _requestID;
+ private _id = _target getVariable _requestID;
waitUntil {
_id = _target getVariable _requestID;
diff --git a/addons/common/functions/fnc_removeActionEventHandler.sqf b/addons/common/functions/fnc_removeActionEventHandler.sqf
index b22ed0f152..60e551590d 100644
--- a/addons/common/functions/fnc_removeActionEventHandler.sqf
+++ b/addons/common/functions/fnc_removeActionEventHandler.sqf
@@ -18,10 +18,8 @@ params ["_unit", "_action", "_id"];
if (_id == -1) exitWith {};
-private ["_name", "_actionsVar"];
-
-_name = format ["ACE_Action_%1", _action];
-_actionsVar = _unit getVariable [_name, [-1, [-1, [], []], objNull]];
+private _name = format ["ACE_Action_%1", _action];
+private _actionsVar = _unit getVariable [_name, [-1, [-1, [], []], objNull]];
_actionsVar params ["_actionID", "_actionsArray"];
_actionsArray params ["_currentID", "_actionIDs", "_actions"];
diff --git a/addons/common/functions/fnc_removeActionMenuEventHandler.sqf b/addons/common/functions/fnc_removeActionMenuEventHandler.sqf
index e5adbe0c01..943e3b4e22 100644
--- a/addons/common/functions/fnc_removeActionMenuEventHandler.sqf
+++ b/addons/common/functions/fnc_removeActionMenuEventHandler.sqf
@@ -18,10 +18,8 @@ params ["_unit", "_action", "_id"];
if (_id == -1) exitWith {};
-private ["_name", "_actionsVar"];
-
-_name = format ["ACE_ActionMenu_%1", _action];
-_actionsVar = _unit getVariable [_name, [-1, [-1, [], []]]];
+private _name = format ["ACE_ActionMenu_%1", _action];
+private _actionsVar = _unit getVariable [_name, [-1, [-1, [], []]]];
_actionsVar params ["_currentID", "_actionIDs", "_actions"];
diff --git a/addons/common/functions/fnc_removeAllEventHandlers.sqf b/addons/common/functions/fnc_removeAllEventHandlers.sqf
index 1a1a6e255f..a309d18d02 100644
--- a/addons/common/functions/fnc_removeAllEventHandlers.sqf
+++ b/addons/common/functions/fnc_removeAllEventHandlers.sqf
@@ -16,10 +16,8 @@ params ["_eventName"];
GVAR(events) params ["_eventNames", "_events"];
-private ["_eventFunctions", "_eventIndex"];
-
-_eventFunctions = [];
-_eventIndex = _eventNames find _eventName;
+private _eventFunctions = [];
+private _eventIndex = _eventNames find _eventName;
if (_eventIndex != -1) then {
_events set [_eventIndex, []];
diff --git a/addons/common/functions/fnc_removeBinocularMagazine.sqf b/addons/common/functions/fnc_removeBinocularMagazine.sqf
index ee35f28f1b..487295ccc3 100644
--- a/addons/common/functions/fnc_removeBinocularMagazine.sqf
+++ b/addons/common/functions/fnc_removeBinocularMagazine.sqf
@@ -9,19 +9,16 @@
* None
*
* Example:
- * [player] call ace_common_fnc_removeBinocularMagazine
+ * player call ace_common_fnc_removeBinocularMagazine
*
* Public: Yes
*/
#include "script_component.hpp"
-params ["_unit"];
+params [["_unit", objNull, [objNull]]];
-private ["_binocular", "_selectBinocular"];
-
-_binocular = binocular _unit;
-
-_selectBinocular = currentWeapon _unit == _binocular;
+private _binocular = binocular _unit;
+private _selectBinocular = currentWeapon _unit == _binocular;
_unit addWeapon _binocular;
diff --git a/addons/common/functions/fnc_removeCanInteractWithCondition.sqf b/addons/common/functions/fnc_removeCanInteractWithCondition.sqf
index 6c3fa8354b..b267e84557 100644
--- a/addons/common/functions/fnc_removeCanInteractWithCondition.sqf
+++ b/addons/common/functions/fnc_removeCanInteractWithCondition.sqf
@@ -16,13 +16,11 @@ params ["_conditionName"];
_conditionName = toLower _conditionName;
-private "_conditions";
-_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
+private _conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
_conditions params ["_conditionNames", "_conditionFuncs"];
-private "_index";
-_index = _conditionNames find _conditionName;
+private _index = _conditionNames find _conditionName;
if (_index == -1) exitWith {};
diff --git a/addons/common/functions/fnc_removeEventHandler.sqf b/addons/common/functions/fnc_removeEventHandler.sqf
index 0c70046706..5e307ad896 100644
--- a/addons/common/functions/fnc_removeEventHandler.sqf
+++ b/addons/common/functions/fnc_removeEventHandler.sqf
@@ -17,10 +17,8 @@ params ["_eventName", "_eventCodeIndex"];
GVAR(events) params ["_eventNames", "_events"];
-private ["_eventFunctions", "_eventIndex"];
-
-_eventFunctions = [];
-_eventIndex = _eventNames find _eventName;
+private _eventFunctions = [];
+private _eventIndex = _eventNames find _eventName;
if (_eventIndex != -1) then {
_eventFunctions = _events select _eventIndex;
diff --git a/addons/common/functions/fnc_removeMapMarkerCreatedEventHandler.sqf b/addons/common/functions/fnc_removeMapMarkerCreatedEventHandler.sqf
index d156359ebf..825281c3e0 100644
--- a/addons/common/functions/fnc_removeMapMarkerCreatedEventHandler.sqf
+++ b/addons/common/functions/fnc_removeMapMarkerCreatedEventHandler.sqf
@@ -14,8 +14,7 @@
params ["_id"];
-private "_actionsVar";
-_actionsVar = missionNamespace getVariable ["ACE_EventHandler_MapMarker", [-1, [], []]];
+private _actionsVar = missionNamespace getVariable ["ACE_EventHandler_MapMarker", [-1, [], []]];
_actionsVar params ["_currentId", "_actionIDs", "_actions"];
diff --git a/addons/common/functions/fnc_removeScrollWheelEventHandler.sqf b/addons/common/functions/fnc_removeScrollWheelEventHandler.sqf
index b277467cce..d7a8ae28cc 100644
--- a/addons/common/functions/fnc_removeScrollWheelEventHandler.sqf
+++ b/addons/common/functions/fnc_removeScrollWheelEventHandler.sqf
@@ -14,8 +14,7 @@
params ["_id"];
-private "_actionsVar";
-_actionsVar = missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]];
+private _actionsVar = missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]];
_actionsVar params ["_currentId", "_actionIDs", "_actions"];
diff --git a/addons/common/functions/fnc_removeSpecificMagazine.sqf b/addons/common/functions/fnc_removeSpecificMagazine.sqf
index 46950cc1d8..e703a56296 100644
--- a/addons/common/functions/fnc_removeSpecificMagazine.sqf
+++ b/addons/common/functions/fnc_removeSpecificMagazine.sqf
@@ -14,15 +14,14 @@
*/
#include "script_component.hpp"
-params ["_unit", "_magazineType", "_ammoCount"];
+params [["_unit", objNull, [objNull]], ["_magazineType", "", [""]], ["_ammoCount", 0, [0]]];
-private ["_isRemoved", "_magazines", "_index"];
-
-_isRemoved = false;
+private _isRemoved = false;
// Check uniform
-_magazines = [magazinesAmmoCargo uniformContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter);
-_index = _magazines find [_magazineType, _ammoCount];
+private _magazines = [magazinesAmmoCargo uniformContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter);
+private _index = _magazines find [_magazineType, _ammoCount];
+
if (_index > -1) exitWith {
{
_unit removeItemFromUniform (_x select 0);
@@ -41,7 +40,8 @@ if (_index > -1) exitWith {
// Check vest
_magazines = [magazinesAmmoCargo vestContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter);
-_index = _magazines find [_magazineType,_ammoCount];
+_index = _magazines find [_magazineType, _ammoCount];
+
if (_index > -1) exitWith {
{
_unit removeItemFromVest (_x select 0);
@@ -60,7 +60,8 @@ if (_index > -1) exitWith {
// Check backpack
_magazines = [magazinesAmmoCargo backpackContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter);
-_index = _magazines find [_magazineType,_ammoCount];
+_index = _magazines find [_magazineType, _ammoCount];
+
if (_index > -1) exitWith {
{
_unit removeItemFromBackpack (_x select 0);
diff --git a/addons/common/functions/fnc_removeSyncedEventHandler.sqf b/addons/common/functions/fnc_removeSyncedEventHandler.sqf
index ffc4a364f3..126bf0b70f 100644
--- a/addons/common/functions/fnc_removeSyncedEventHandler.sqf
+++ b/addons/common/functions/fnc_removeSyncedEventHandler.sqf
@@ -19,10 +19,8 @@ if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
false
};
-private ["_data", "_eventId"];
-
-_data = HASH_GET(GVAR(syncedEvents),_name);
-_eventId = _data select 3;
+private _data = HASH_GET(GVAR(syncedEvents),_name);
+_data params ["", "", "", "_eventId"];
[_eventId] call FUNC(removeEventHandler);
HASH_REM(GVAR(syncedEvents),_name);
diff --git a/addons/common/functions/fnc_restoreVariablesJIP.sqf b/addons/common/functions/fnc_restoreVariablesJIP.sqf
index 491ce89bb4..39626514bb 100644
--- a/addons/common/functions/fnc_restoreVariablesJIP.sqf
+++ b/addons/common/functions/fnc_restoreVariablesJIP.sqf
@@ -14,8 +14,7 @@
params ["_unit"];
-private "_respawnVariables";
-_respawnVariables = _unit getVariable ["ACE_respawnVariables", []];
+private _respawnVariables = _unit getVariable ["ACE_respawnVariables", []];
// yes those
_respawnVariables pushBack "ACE_PersistentFunctions";
diff --git a/addons/common/functions/fnc_sanitizeString.sqf b/addons/common/functions/fnc_sanitizeString.sqf
index 2450ba5be5..6e0db2cda2 100644
--- a/addons/common/functions/fnc_sanitizeString.sqf
+++ b/addons/common/functions/fnc_sanitizeString.sqf
@@ -18,8 +18,7 @@
params ["_string", ["_removeTags", false]];
-private "_array";
-_array = [];
+private _array = [];
{
switch _x do {
diff --git a/addons/common/functions/fnc_setCaptivityStatus.sqf b/addons/common/functions/fnc_setCaptivityStatus.sqf
index ecb7b3152a..3e84c1753d 100644
--- a/addons/common/functions/fnc_setCaptivityStatus.sqf
+++ b/addons/common/functions/fnc_setCaptivityStatus.sqf
@@ -10,15 +10,13 @@
* Return Value:
* None
*
- * Public: No
+ * Public: Yes
*/
#include "script_component.hpp"
params ["_unit", "_reason", "_status"];
-private ["_captivityReasons", "_unitCaptivityReasons", "_captivityReasonsBooleans", "_bitmask"];
-
-_captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []];
+private _captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []];
// register new reason (these reasons are shared publicly, since units can change ownership, but keep their captivity status)
if !(_reason in _captivityReasons) then {
@@ -29,16 +27,17 @@ if !(_reason in _captivityReasons) then {
};
// get reasons why the unit is captive already and update to the new status
-_unitCaptivityReasons = [_unit] call FUNC(getCaptivityStatus);
+private _unitCaptivityReasons = _unit call FUNC(getCaptivityStatus);
+
+private _captivityReasonsBooleans = [];
-_captivityReasonsBooleans = [];
{
_captivityReasonsBooleans set [_forEachIndex, (_captivityReasons select _forEachIndex) in _unitCaptivityReasons];
} forEach _captivityReasons;
_captivityReasonsBooleans set [_captivityReasons find _reason, _status];
-_bitmask = _captivityReasonsBooleans call FUNC(toBitmask);
+private _bitmask = _captivityReasonsBooleans call FUNC(toBitmask);
// actually apply the setCaptive command globaly
[[_unit, _bitmask], "{(_this select 0) setCaptive (_this select 1)}", _unit] call FUNC(execRemoteFnc);
diff --git a/addons/common/functions/fnc_setDefinedVariable.sqf b/addons/common/functions/fnc_setDefinedVariable.sqf
index 9b7812ee82..6f1f0c2e58 100644
--- a/addons/common/functions/fnc_setDefinedVariable.sqf
+++ b/addons/common/functions/fnc_setDefinedVariable.sqf
@@ -17,8 +17,7 @@
params ["_unit", "_variable", "_value", "_global"];
if (isNil "_global") then {
- private "_definedVariable";
- _definedVariable = [_variable] call FUNC(getDefinedVariableInfo);
+ private _definedVariable = [_variable] call FUNC(getDefinedVariableInfo);
_definedVariable params ["", "", ["_global", false]];
};
diff --git a/addons/common/functions/fnc_setForceWalkStatus.sqf b/addons/common/functions/fnc_setForceWalkStatus.sqf
index aaa594b9a9..3842457395 100644
--- a/addons/common/functions/fnc_setForceWalkStatus.sqf
+++ b/addons/common/functions/fnc_setForceWalkStatus.sqf
@@ -14,15 +14,13 @@
* Example:
* [ACE_Player, "BrokenLeg", true] call FUNC(setForceWalkStatus)
*
- * Public: No
+ * Public: Yes
*/
#include "script_component.hpp"
params ["_unit", "_reason", "_status"];
-private ["_forceWalkReasons", "_unitForceWalkReasons", "_forceWalkReasonsBooleans", "_bitmaskNumber"];
-
-_forceWalkReasons = missionNamespace getVariable ["ACE_forceWalkReasons", []];
+private _forceWalkReasons = missionNamespace getVariable ["ACE_forceWalkReasons", []];
// register new reason (these reasons are shared publicly, since units can change ownership, but keep their forceWalk status)
if !(_reason in _forceWalkReasons) then {
@@ -32,16 +30,17 @@ if !(_reason in _forceWalkReasons) then {
};
// get reasons why the unit is forceWalking already and update to the new status
-_unitForceWalkReasons = [_unit] call FUNC(getForceWalkStatus);
+private _unitForceWalkReasons = [_unit] call FUNC(getForceWalkStatus);
+
+private _forceWalkReasonsBooleans = [];
-_forceWalkReasonsBooleans = [];
{
_forceWalkReasonsBooleans set [_forEachIndex, (_forceWalkReasons select _forEachIndex) in _unitForceWalkReasons];
} forEach _forceWalkReasons;
_forceWalkReasonsBooleans set [_forceWalkReasons find _reason, _status];
-_bitmaskNumber = _forceWalkReasonsBooleans call FUNC(toBitmask);
+private _bitmaskNumber = _forceWalkReasonsBooleans call FUNC(toBitmask);
_unit setVariable ["ACE_forceWalkStatusNumber", _bitmaskNumber, true];
diff --git a/addons/common/functions/fnc_setHearingCapability.sqf b/addons/common/functions/fnc_setHearingCapability.sqf
index d24f8d0d9d..7bd375a58b 100644
--- a/addons/common/functions/fnc_setHearingCapability.sqf
+++ b/addons/common/functions/fnc_setHearingCapability.sqf
@@ -18,11 +18,10 @@
params ["_id", "_settings", ["_add", true]];
-private ["_map", "_exists", "_lowestVolume"];
+private _map = missionNamespace getVariable [QGVAR(setHearingCapabilityMap),[]];
-_map = missionNamespace getVariable [QGVAR(setHearingCapabilityMap),[]];
+private _exists = false;
-_exists = false;
{
if (_id == _x select 0) exitWith {
_exists = true;
@@ -42,7 +41,8 @@ if (!_exists && _add) then {
missionNamespace setVariable [QGVAR(setHearingCapabilityMap), _map];
// find lowest volume
-_lowestVolume = 1;
+private _lowestVolume = 1;
+
{
_lowestVolume = (_x select 1) min _lowestVolume;
false
diff --git a/addons/common/functions/fnc_setPitchBankYaw.sqf b/addons/common/functions/fnc_setPitchBankYaw.sqf
index ea7f27a906..fecc16208c 100644
--- a/addons/common/functions/fnc_setPitchBankYaw.sqf
+++ b/addons/common/functions/fnc_setPitchBankYaw.sqf
@@ -19,14 +19,12 @@ params ["_object", "_aroundX", "_aroundY", "_aroundZ"];
_aroundZ = - _aroundZ;
-private ["_dirX", "_dirY", "_dirZ", "_upX", "_upY", "_upZ", "_dir", "_up"];
-
-_dirX = 0;
-_dirY = 1;
-_dirZ = 0;
-_upX = 0;
-_upY = 0;
-_upZ = 1;
+private _dirX = 0;
+private _dirY = 1;
+private _dirZ = 0;
+private _upX = 0;
+private _upY = 0;
+private _upZ = 1;
if (_aroundX != 0) then {
_dirY = cos _aroundX;
@@ -43,18 +41,16 @@ if (_aroundY != 0) then {
};
if (_aroundZ != 0) then {
- private ["_dirXTemp", "_upXTemp"];
-
- _dirXTemp = _dirX;
+ private _dirXTemp = _dirX;
_dirX = (_dirXTemp* cos _aroundZ) - (_dirY * sin _aroundZ);
_dirY = (_dirY * cos _aroundZ) + (_dirXTemp * sin _aroundZ);
- _upXTemp = _upX;
+ private _upXTemp = _upX;
_upX = (_upXTemp * cos _aroundZ) - (_upY * sin _aroundZ);
_upY = (_upY * cos _aroundZ) + (_upXTemp * sin _aroundZ);
};
-_dir = [_dirX, _dirY, _dirZ];
-_up = [_upX, _upY, _upZ];
+private _dir = [_dirX, _dirY, _dirZ];
+private _up = [_upX, _upY, _upZ];
_object setVectorDirAndUp [_dir,_up];
diff --git a/addons/common/functions/fnc_setSettingFromConfig.sqf b/addons/common/functions/fnc_setSettingFromConfig.sqf
index 5dc55f51f7..ac7a0f4875 100644
--- a/addons/common/functions/fnc_setSettingFromConfig.sqf
+++ b/addons/common/functions/fnc_setSettingFromConfig.sqf
@@ -14,13 +14,11 @@
params ["_optionEntry"];
-private ["_fnc_getValueWithType", "_value", "_name", "_typeName", "_settingData", "_valueConfig", "_text"];
-
-_fnc_getValueWithType = {
+private _fnc_getValueWithType = {
params ["_optionEntry", "_typeName"];
- _valueConfig = (_optionEntry >> "value");
- _value = if (isNumber (_optionEntry >> "value")) then {getNumber (_optionEntry >> "value")} else {0};
+ private _valueConfig = (_optionEntry >> "value");
+ private _value = if (isNumber (_optionEntry >> "value")) then {getNumber (_optionEntry >> "value")} else {0};
TRACE_3("_fnc_getValueWithType:", configName _optionEntry, _typeName, _value);
if (_typeName == "BOOL") exitWith {
_value > 0
@@ -37,27 +35,27 @@ _fnc_getValueWithType = {
_value
};
-_name = configName _optionEntry;
+private _name = configName _optionEntry;
// Check if the variable is already defined
if (isNil _name) then {
// That setting was not loaded yet
// Get type from config
- _typeName = getText (_optionEntry >> "typeName");
+ private _typeName = getText (_optionEntry >> "typeName");
if (_typeName == "") then {
_typeName = "SCALAR";
};
// Read entry and cast it to the correct type
- _value = [_optionEntry, _typeName] call _fnc_getValueWithType;
+ private _value = [_optionEntry, _typeName] call _fnc_getValueWithType;
// Init the variable
missionNamespace setVariable [_name, _value];
// Add the setting to a list on the server
// Set the variable to not forced
- /*_settingData = [
+ /*private _settingData = [
name,
typeName,
isClientSettable,
@@ -68,7 +66,7 @@ if (isNil _name) then {
defaultValue,
category
];*/
- _settingData = [
+ private _settingData = [
_name,
_typeName,
(getNumber (_optionEntry >> "isClientSettable")) > 0,
@@ -81,10 +79,10 @@ if (isNil _name) then {
];
//Strings in the values array won't be localized from the config, so just do that now:
- /*private "_values";
- _values = _settingData select 5;
+ /*private _values = _settingData select 5;
+
{
- _text = _x;
+ private _text = _x;
if (((typeName _text) == "STRING") && {(count _text) > 1} && {(_text select [0,1]) == "$"}) then {
_text = localize (_text select [1, ((count _text) - 1)]); //chop off the leading $
_values set [_forEachIndex, _text];
@@ -98,13 +96,13 @@ if (isNil _name) then {
// The setting already exists.
// Check if it's already forced and quit
- _settingData = [_name] call FUNC(getSettingData);
+ private _settingData = [_name] call FUNC(getSettingData);
if (_settingData select 6) exitWith {};
// The setting is not forced, so update the value
// Read entry and cast it to the correct type from the existing variable
- _value = [_optionEntry, _settingData select 1] call _fnc_getValueWithType;
+ private _value = [_optionEntry, _settingData select 1] call _fnc_getValueWithType;
// Update the variable
missionNamespace setVariable [_name, _value];
diff --git a/addons/common/functions/fnc_setVariableJIP.sqf b/addons/common/functions/fnc_setVariableJIP.sqf
index d1bd27ea4e..35e8c0d116 100644
--- a/addons/common/functions/fnc_setVariableJIP.sqf
+++ b/addons/common/functions/fnc_setVariableJIP.sqf
@@ -16,8 +16,7 @@
params ["_unit", "_varName", "_value"];
-private "_respawnVariables";
-_respawnVariables = _unit getVariable ["ACE_respawnVariables", []];
+private _respawnVariables = _unit getVariable ["ACE_respawnVariables", []];
if !(_varName in _respawnVariables) then {
_respawnVariables pushBack _varName;
diff --git a/addons/common/functions/fnc_setVariablePublic.sqf b/addons/common/functions/fnc_setVariablePublic.sqf
index 8dbaeffbd6..31d1d23014 100644
--- a/addons/common/functions/fnc_setVariablePublic.sqf
+++ b/addons/common/functions/fnc_setVariablePublic.sqf
@@ -23,13 +23,11 @@ _object setVariable [_varName, _value];
// Exit if in SP
if (!isMultiplayer) exitWith {};
-private ["_idName", "_syncTime"];
-
-_idName = format ["ACE_setVariablePublic_%1", _varName];
+private _idName = format ["ACE_setVariablePublic_%1", _varName];
if (_idName in GVAR(setVariableNames)) exitWith {};
-_syncTime = ACE_diagTime + _sync;
+private _syncTime = ACE_diagTime + _sync;
GVAR(setVariableNames) pushBack _idName;
diff --git a/addons/common/functions/fnc_sortAlphabeticallyBy.sqf b/addons/common/functions/fnc_sortAlphabeticallyBy.sqf
index 9bbec92d40..0bf0c6432f 100644
--- a/addons/common/functions/fnc_sortAlphabeticallyBy.sqf
+++ b/addons/common/functions/fnc_sortAlphabeticallyBy.sqf
@@ -18,34 +18,32 @@ ACE_DEPRECATED("ace_common_fnc_sortAlphabeticallyBy","3.5.0","sort");
params ["_array", "_elementN"];
-private ["_elements", "_indexes", "_theElement", "_tmp", "_tempIndex", "_returnArray"];
-
-_indexes = [];
-_elements = [];
+private _indices = [];
+private _elements = [];
{
- _theElement = toArray (_x select _elementN);
- _indexes pushBack _forEachIndex;
+ private _theElement = toArray (_x select _elementN);
+ _indices pushBack _forEachIndex;
_elements pushBack _theElement;
} forEach _array;
for "_i" from 1 to (count _elements) - 1 do {
- _tmp = _elements select _i;
- _tempIndex = _indexes select _i;
+ private _tmp = _elements select _i;
+ private _tempIndex = _indices select _i;
_j = _i;
while {_j >= 1 && {_tmp < _elements select (_j - 1)}} do {
_elements set [_j, _elements select (_j - 1)];
- _indexes set [_j, _indexes select (_j - 1)];
+ _indices set [_j, _indices select (_j - 1)];
_j = _j - 1;
};
_elements set[_j, _tmp];
- _indexes set [_j, _tempIndex];
+ _indices set [_j, _tempIndex];
};
-_returnArray = [];
+private _returnArray = [];
{
_returnArray pushBack (_array select _x);
-} forEach _indexes;
+} forEach _indices;
_returnArray
diff --git a/addons/common/functions/fnc_stringCompare.sqf b/addons/common/functions/fnc_stringCompare.sqf
index da65c676f8..ad3073eb1e 100644
--- a/addons/common/functions/fnc_stringCompare.sqf
+++ b/addons/common/functions/fnc_stringCompare.sqf
@@ -18,16 +18,14 @@ params ["_string", "_searchTerm"];
_string = toLower _string; // removes case sensitivity
_searchTerm = toLower _searchTerm;
-private ["_arraySearchTerm", "_arrayString", "_sizeSearchTerm", "_sizeString", "_matchingCharacters", "_searchIterator", "_targetIterator"];
+private _arraySearchTerm = toArray _searchTerm; // splits string into array of unicode decimals
+private _arrayString = toArray _string;
+private _sizeSearchTerm = count _arraySearchTerm; // We only measure the array once
+private _sizeString = count _arrayString;
-_arraySearchTerm = toArray _searchTerm; // splits string into array of unicode decimals
-_arrayString = toArray _string;
-_sizeSearchTerm = count _arraySearchTerm; // We only measure the array once
-_sizeString = count _arrayString;
-
-_matchingCharacters = 0;
-_searchIterator = 0;
-_targetIterator = 0;
+private _matchingCharacters = 0;
+private _searchIterator = 0;
+private _targetIterator = 0;
while {_searchIterator < _sizeSearchTerm && _targetIterator < _sizeString} do { // Prevents us from going out of bounds
if (_arraySearchTerm select _searchIterator == _arrayString select _targetIterator) then { // If we have a match, start looking for the next character in the search term
diff --git a/addons/common/functions/fnc_switchToGroupSide.sqf b/addons/common/functions/fnc_switchToGroupSide.sqf
index 7d23e6442a..3a559a7a65 100644
--- a/addons/common/functions/fnc_switchToGroupSide.sqf
+++ b/addons/common/functions/fnc_switchToGroupSide.sqf
@@ -17,29 +17,24 @@
params [["_unit", objNull], ["_switch", false], ["_id", ""], ["_side", side _unit]];
-private "_previousGroupsList";
-_previousGroupsList = _unit getVariable [QGVAR(previousGroupSwitchTo), []];
+private _previousGroupsList = _unit getVariable [QGVAR(previousGroupSwitchTo), []];
if (_switch) then {
// go forward
- private ["_previousGroup", "_originalSide", "_newGroup"];
-
- _previousGroup = group _unit;
- _originalSide = side group _unit;
+ private _previousGroup = group _unit;
+ private _originalSide = side group _unit;
if (count units _previousGroup == 1 && _originalSide == _side) exitWith {
[format ["Current group has only 1 member and is of same side as switch. Not switching unit %1", _id]] call FUNC(debug);
};
- _newGroup = createGroup _side;
+ private _newGroup = createGroup _side;
[_unit] joinSilent _newGroup;
_previousGroupsList pushBack [_previousGroup, _originalSide, _id, true];
_unit setVariable [QGVAR(previousGroupSwitchTo), _previousGroupsList, true];
} else {
// go one back
- private ["_currentGroup", "_newGroup"];
-
{
if (_id == (_x select 2)) exitWith {
_x set [ 3, false];
@@ -53,11 +48,11 @@ if (_switch) then {
{
if (_x select 3) exitWith {}; // stop at first id set to true
if !(_x select 3) then {
- _currentGroup = group _unit;
+ private _currentGroup = group _unit;
if (!isNull (_x select 0)) then {
[_unit] joinSilent (_x select 0);
} else {
- _newGroup = createGroup (_x select 1);
+ private _newGroup = createGroup (_x select 1);
[_unit] joinSilent _newGroup;
};
if (count units _currentGroup == 0) then {
diff --git a/addons/common/functions/fnc_syncedEvent.sqf b/addons/common/functions/fnc_syncedEvent.sqf
index 34043fa8ae..4ed8107330 100644
--- a/addons/common/functions/fnc_syncedEvent.sqf
+++ b/addons/common/functions/fnc_syncedEvent.sqf
@@ -21,7 +21,6 @@ if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
false
};
-private "_eventData";
-_eventData = [_name, _args, _ttl];
+private _eventData = [_name, _args, _ttl];
["SEH", _eventData] call FUNC(globalEvent);
diff --git a/addons/common/functions/fnc_syncedEventPFH.sqf b/addons/common/functions/fnc_syncedEventPFH.sqf
index 1b2f634ace..62df8f10a7 100644
--- a/addons/common/functions/fnc_syncedEventPFH.sqf
+++ b/addons/common/functions/fnc_syncedEventPFH.sqf
@@ -19,21 +19,17 @@ if (!isServer) exitWith {false};
// @TODO: This should be iteration limited to prevent FPS lag
{
- private ["_name", "_data", "_newEventLog"];
+ private _name = _x;
- _name = _x;
-
- _data = HASH_GET(GVAR(syncedEvents),_name);
+ private _data = HASH_GET(GVAR(syncedEvents),_name);
_data params ["_eventTime", "_eventLog", "_globalEventTTL"];
- _newEventLog = [];
+ private _newEventLog = [];
// @TODO: This should be iteration limited to prevent FPS lag
{
- private ["_eventEntry", "_ttlReturn"];
-
- _eventEntry = _x;
- _ttlReturn = true;
+ private _eventEntry = _x;
+ private _ttlReturn = true;
if (_globalEventTTL isEqualType {}) then {
_ttlReturn = [_eventTime, _eventEntry] call _globalEventTTL;
diff --git a/addons/common/functions/fnc_toBin.sqf b/addons/common/functions/fnc_toBin.sqf
index 9f3296597d..f8ec0bac68 100644
--- a/addons/common/functions/fnc_toBin.sqf
+++ b/addons/common/functions/fnc_toBin.sqf
@@ -14,15 +14,13 @@
params ["_number", ["_minLength", 1]];
-private ["_sign", "_bin", "_rest"];
-
-_sign = ["", "-"] select (_number < 0);
+private _sign = ["", "-"] select (_number < 0);
_number = round abs _number;
-_bin = ["", "0"] select (_number == 0);
+private _bin = ["", "0"] select (_number == 0);
while {_number > 0} do {
- _rest = str (_number mod 2);
+ private _rest = str (_number mod 2);
_number = floor (_number / 2);
_bin = _rest + _bin;
};
diff --git a/addons/common/functions/fnc_toBitmask.sqf b/addons/common/functions/fnc_toBitmask.sqf
index 35b1e06f9f..333e5c737b 100644
--- a/addons/common/functions/fnc_toBitmask.sqf
+++ b/addons/common/functions/fnc_toBitmask.sqf
@@ -12,8 +12,7 @@
*/
#include "script_component.hpp"
-private "_result";
-_result = 0;
+private _result = 0;
{
if (_x) then {_result = _result + 2 ^ _forEachIndex};
diff --git a/addons/common/functions/fnc_toHex.sqf b/addons/common/functions/fnc_toHex.sqf
index 80d8757b80..c558aab04b 100644
--- a/addons/common/functions/fnc_toHex.sqf
+++ b/addons/common/functions/fnc_toHex.sqf
@@ -19,16 +19,14 @@ _number = ((round abs _number) max 0) min 255;
if (isNil QGVAR(hexArray)) then {
GVAR(hexArray) = [];
- private ["_minLength", "_num", "_hex", "_rest"];
-
- _minLength = 2;
+ private _minLength = 2;
for [{_i = 0;}, {_i < 256}, {_i = _i + 1}] do {
- _num = _i;
- _hex = ["", "0"] select (_i == 0);
+ private _num = _i;
+ private _hex = ["", "0"] select (_i == 0);
while {_num > 0} do {
- _rest = _num mod 16;
+ private _rest = _num mod 16;
_rest = switch _rest do {
case 10 : {"A"};
case 11 : {"B"};
diff --git a/addons/common/functions/fnc_translateToModelSpace.sqf b/addons/common/functions/fnc_translateToModelSpace.sqf
index b05a19bed6..b9fa35243a 100644
--- a/addons/common/functions/fnc_translateToModelSpace.sqf
+++ b/addons/common/functions/fnc_translateToModelSpace.sqf
@@ -14,8 +14,7 @@
params ["_object", "_matrix", "_offset"];
-private "_origin";
-_origin = getPosASL _object;
+private _origin = getPosASL _object;
_matrix params ["_xVec", "_yVec", "_zVec"];
diff --git a/addons/common/functions/fnc_translateToWeaponSpace.sqf b/addons/common/functions/fnc_translateToWeaponSpace.sqf
index db3a5eaf37..cd360bd874 100644
--- a/addons/common/functions/fnc_translateToWeaponSpace.sqf
+++ b/addons/common/functions/fnc_translateToWeaponSpace.sqf
@@ -14,8 +14,7 @@
params ["_object", "_matrix", "_offset"];
-private "_origin";
-_origin = getPosASL _object;
+private _origin = getPosASL _object;
_matrix params ["_xVec", "_yVec", "_zVec"];
diff --git a/addons/common/functions/fnc_unhideUnit.sqf b/addons/common/functions/fnc_unhideUnit.sqf
index 5bcafc3509..908dbf3dc8 100644
--- a/addons/common/functions/fnc_unhideUnit.sqf
+++ b/addons/common/functions/fnc_unhideUnit.sqf
@@ -20,8 +20,7 @@ params ["_unit", "_reason"];
if (isNull _unit) exitWith {};
-private "_setHiddenReasons";
-_setHiddenReasons = _unit getVariable [QGVAR(setHiddenReasons), []];
+private _setHiddenReasons = _unit getVariable [QGVAR(setHiddenReasons), []];
if (_reason in _setHiddenReasons) then {
_setHiddenReasons deleteAt (_setHiddenReasons find _reason);
diff --git a/addons/common/functions/fnc_uniqueElements.sqf b/addons/common/functions/fnc_uniqueElements.sqf
index 55d8c4ef5f..471ba47457 100644
--- a/addons/common/functions/fnc_uniqueElements.sqf
+++ b/addons/common/functions/fnc_uniqueElements.sqf
@@ -12,6 +12,6 @@
*/
#include "script_component.hpp"
-params ["_array"];
+params [["_array", [], [[]]]];
_array arrayIntersect _array // return
diff --git a/addons/common/functions/fnc_unloadPerson.sqf b/addons/common/functions/fnc_unloadPerson.sqf
index 73e02cd7ce..0c1b53bc61 100644
--- a/addons/common/functions/fnc_unloadPerson.sqf
+++ b/addons/common/functions/fnc_unloadPerson.sqf
@@ -16,15 +16,13 @@
params ["_unit"];
-private "_vehicle";
-_vehicle = vehicle _unit;
+private _vehicle = vehicle _unit;
if (_vehicle == _unit) exitWith {false};
if (speed _vehicle > 1 || getPos _vehicle select 2 > 2) exitWith {false};
-private "_emptyPos";
-_emptyPos = (getPos _vehicle) findEmptyPosition [0, 10, typeOf _unit]; // @todo to small?
+private _emptyPos = (getPos _vehicle) findEmptyPosition [0, 10, typeOf _unit]; // @todo to small?
if (count _emptyPos == 0) exitWith {false};
diff --git a/addons/common/functions/fnc_unloadPersonLocal.sqf b/addons/common/functions/fnc_unloadPersonLocal.sqf
index a7e61a7868..5e8300c139 100644
--- a/addons/common/functions/fnc_unloadPersonLocal.sqf
+++ b/addons/common/functions/fnc_unloadPersonLocal.sqf
@@ -17,9 +17,8 @@
params ["_unit", "_vehicle"];
TRACE_2("params",_unit,_vehicle);
-private ["_validVehiclestate", "_emptyPos", "_loaded"];
-
-_validVehiclestate = true;
+private _validVehiclestate = true;
+private _emptyPos = [];
if (_vehicle isKindOf "Ship") then {
if (speed _vehicle > 1 || {getPos _vehicle select 2 > 2}) then {
@@ -78,8 +77,7 @@ _unit action ["Eject", vehicle _unit];
TRACE_1("Check if isAwake", [_unit] call FUNC(isAwake));
if (driver _unit == _unit) then {
- private "_anim";
- _anim = [_unit] call FUNC(getDeathAnim);
+ private _anim = [_unit] call FUNC(getDeathAnim);
[_unit, _anim, 1, true] call FUNC(doAnimation);
@@ -96,7 +94,7 @@ _unit action ["Eject", vehicle _unit];
[_unit, false, GROUP_SWITCH_ID, side group _unit] call FUNC(switchToGroupSide);
-_loaded = _vehicle getVariable [QGVAR(loaded_persons),[]];
+private _loaded = _vehicle getVariable [QGVAR(loaded_persons),[]];
_loaded deleteAt (_loaded find _unit);
_vehicle setVariable [QGVAR(loaded_persons), _loaded, true];
diff --git a/addons/common/functions/fnc_unmuteUnit.sqf b/addons/common/functions/fnc_unmuteUnit.sqf
index bf02fe676f..a995eed244 100644
--- a/addons/common/functions/fnc_unmuteUnit.sqf
+++ b/addons/common/functions/fnc_unmuteUnit.sqf
@@ -18,8 +18,7 @@ params ["_unit", "_reason"];
if (isNull _unit) exitWith {};
// remove reason to mute to the unit
-private "_muteUnitReasons";
-_muteUnitReasons = _unit getVariable [QGVAR(muteUnitReasons), []];
+private _muteUnitReasons = _unit getVariable [QGVAR(muteUnitReasons), []];
if (_reason in _muteUnitReasons) then {
_muteUnitReasons deleteAt (_muteUnitReasons find _reason);
@@ -29,8 +28,7 @@ if (_reason in _muteUnitReasons) then {
// don't unmute if there is another mute reason!
if (count _muteUnitReasons > 0) exitWith {};
-private "_speaker";
-_speaker = _unit getVariable ["ACE_OriginalSpeaker", ""];
+private _speaker = _unit getVariable ["ACE_OriginalSpeaker", ""];
if (_speaker == "") exitWith {};
diff --git a/addons/common/functions/fnc_useItem.sqf b/addons/common/functions/fnc_useItem.sqf
index acf359813c..2d2116b38f 100644
--- a/addons/common/functions/fnc_useItem.sqf
+++ b/addons/common/functions/fnc_useItem.sqf
@@ -15,8 +15,7 @@
params ["_unit", "_item", ["_vehicleUsage", false]];
-private "_return";
-_return = false;
+private _return = false;
if !(_vehicleUsage) then {
if (_item != "") then {
diff --git a/addons/common/functions/fnc_useMagazine.sqf b/addons/common/functions/fnc_useMagazine.sqf
index 1a77d0b3f3..4dc6136fa6 100644
--- a/addons/common/functions/fnc_useMagazine.sqf
+++ b/addons/common/functions/fnc_useMagazine.sqf
@@ -15,8 +15,7 @@
params ["_unit", "_magazine", ["_vehicleUsage", false]];
-private "_return";
-_return = false;
+private _return = false;
if !(_vehicleUsage) then {
if (_magazine != "") then {
diff --git a/addons/common/functions/fnc_waveHeightAt.sqf b/addons/common/functions/fnc_waveHeightAt.sqf
index a3f2447729..bc278a9b70 100644
--- a/addons/common/functions/fnc_waveHeightAt.sqf
+++ b/addons/common/functions/fnc_waveHeightAt.sqf
@@ -1,6 +1,5 @@
/*
* Author: jaynus
- *
* Gets the wave height at a specific location. Uses a logic, so may be performance iffy
*
* Arguments:
diff --git a/addons/common/functions/fnc_worldToScreenBounds.sqf b/addons/common/functions/fnc_worldToScreenBounds.sqf
index 2de07c7bbd..c9e5551d19 100644
--- a/addons/common/functions/fnc_worldToScreenBounds.sqf
+++ b/addons/common/functions/fnc_worldToScreenBounds.sqf
@@ -1,6 +1,5 @@
/*
* Author: zGuba 2011
- *
* Function helper for framing objects on screen.
*
* Arguments:
@@ -26,14 +25,12 @@
params ["_object", "_margins", "_offsets"];
-private ["_minX", "_minY", "_maxX", "_maxY", "_bounds", "_boundsCorners"];
+private _minX = 10;
+private _minY = 10;
+private _maxX = -10;
+private _maxY = -10;
-_minX = 10;
-_minY = 10;
-_maxX = -10;
-_maxY = -10;
-
-_bounds = boundingBox _object;
+private _bounds = boundingBox _object;
_margins params ["_marginsX", "_marginsY", "_marginsZ"];
_offsets params ["_offsetsX", "_offsetsY", "_offsetsZ"];
@@ -49,22 +46,23 @@ _boundsMaxX = _boundsMaxX + _marginsX + _offsetsX;
_boundsMaxY = _boundsMaxY + _marginsY + _offsetsY;
_boundsMaxZ = _boundsMaxZ + _marginsZ + _offsetsZ;
-_boundsCorners = [
- [_boundsMinX,_boundsMinY,_boundsMinZ],
- [_boundsMinX,_boundsMinY,_boundsMaxZ],
- [_boundsMinX,_boundsMaxY,_boundsMinZ],
- [_boundsMinX,_boundsMaxY,_boundsMaxZ],
- [_boundsMaxX,_boundsMinY,_boundsMinZ],
- [_boundsMaxX,_boundsMinY,_boundsMaxZ],
- [_boundsMaxX,_boundsMaxY,_boundsMinZ],
- [_boundsMaxX,_boundsMaxY,_boundsMaxZ]
+private _boundsCorners = [
+ [_boundsMinX, _boundsMinY, _boundsMinZ],
+ [_boundsMinX, _boundsMinY, _boundsMaxZ],
+ [_boundsMinX, _boundsMaxY, _boundsMinZ],
+ [_boundsMinX, _boundsMaxY, _boundsMaxZ],
+ [_boundsMaxX, _boundsMinY, _boundsMinZ],
+ [_boundsMaxX, _boundsMinY, _boundsMaxZ],
+ [_boundsMaxX, _boundsMaxY, _boundsMinZ],
+ [_boundsMaxX, _boundsMaxY, _boundsMaxZ]
];
{
- private "_ppos";
- _ppos = worldToScreen (_object modelToWorld _x);
+ private _ppos = worldToScreen (_object modelToWorld _x);
+
if (count _ppos >= 2) then {
_ppos params ["_pposX", "_pposY"];
+
if (_pposX < _minX) then {_minX = _pposX};
if (_pposX > _maxX) then {_maxX = _pposX};
if (_pposY < _minY) then {_minY = _pposY};
@@ -73,4 +71,4 @@ _boundsCorners = [
false
} count _boundsCorners;
-[_minX,_minY,_maxX,_maxY]
+[_minX, _minY, _maxX, _maxY]