replace private with private keyword in other half of common

This commit is contained in:
commy2 2015-12-14 13:08:19 +01:00
parent 2839cff753
commit bfa29246be
57 changed files with 195 additions and 296 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,8 +13,7 @@
disableSerialization;
private "_dlg";
_dlg = ctrlParent _this;
private _dlg = ctrlParent _this;
_dlg displayAddEventHandler ["unload", {
if (_this select 1 == 1) then {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -12,7 +12,7 @@
* Example:
* [ACE_Player, "SpectatorMode"] call ace_common_fnc_hideUnit
*
* Public: No
* Public: Yes
*/
#include "script_component.hpp"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,8 +15,7 @@
params ["_string", ["_removeTags", false]];
private "_array";
_array = [];
private _array = [];
{
switch _x do {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -12,8 +12,7 @@
*/
#include "script_component.hpp"
private "_result";
_result = 0;
private _result = 0;
{
if (_x) then {_result = _result + 2 ^ _forEachIndex};

View File

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

View File

@ -14,8 +14,7 @@
params ["_object", "_matrix", "_offset"];
private "_origin";
_origin = getPosASL _object;
private _origin = getPosASL _object;
_matrix params ["_xVec", "_yVec", "_zVec"];

View File

@ -14,8 +14,7 @@
params ["_object", "_matrix", "_offset"];
private "_origin";
_origin = getPosASL _object;
private _origin = getPosASL _object;
_matrix params ["_xVec", "_yVec", "_zVec"];

View File

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

View File

@ -12,6 +12,6 @@
*/
#include "script_component.hpp"
params ["_array"];
params [["_array", [], [[]]]];
_array arrayIntersect _array // return

View File

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

View File

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

View File

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

View File

@ -15,8 +15,7 @@
params ["_unit", "_item", ["_vehicleUsage", false]];
private "_return";
_return = false;
private _return = false;
if !(_vehicleUsage) then {
if (_item != "") then {

View File

@ -15,8 +15,7 @@
params ["_unit", "_magazine", ["_vehicleUsage", false]];
private "_return";
_return = false;
private _return = false;
if !(_vehicleUsage) then {
if (_magazine != "") then {

View File

@ -1,6 +1,5 @@
/*
* Author: jaynus
*
* Gets the wave height at a specific location. Uses a logic, so may be performance iffy
*
* Arguments:

View File

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