From cbc7f961b253be8ec069fce9901fd73556cacdb1 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 19 Sep 2015 19:40:56 +0200 Subject: [PATCH] more common code cleanup --- .../common/functions/fnc_requestCallback.sqf | 29 +++++++-------- .../functions/fnc_requestSyncedEvent.sqf | 17 ++++----- .../common/functions/fnc_resetAllDefaults.sqf | 35 +++++++++++-------- .../functions/fnc_restoreVariablesJIP.sqf | 19 +++++----- 4 files changed, 53 insertions(+), 47 deletions(-) diff --git a/addons/common/functions/fnc_requestCallback.sqf b/addons/common/functions/fnc_requestCallback.sqf index 827519b99c..399f50466d 100644 --- a/addons/common/functions/fnc_requestCallback.sqf +++ b/addons/common/functions/fnc_requestCallback.sqf @@ -1,22 +1,19 @@ -/** - * fn_requestCallback.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: Glowbal + * N/A * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * ? + * + * Return Value: + * ? + * + * Public: No */ - #include "script_component.hpp" -private ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"]; -PARAMS_2(_info,_accepted); +params ["_info", "_accepted"]; -_caller = _info select 0; -_target = _info select 1; -_requestID = _info select 2; -_requestMessage = _info select 3; -_callBack = _info select 4; +_info params ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"]; -[_caller, _target, _accepted] call compile _callBack; \ No newline at end of file +[_caller, _target, _accepted] call compile _callBack; diff --git a/addons/common/functions/fnc_requestSyncedEvent.sqf b/addons/common/functions/fnc_requestSyncedEvent.sqf index dea0c7adef..7cbc8f6c8d 100644 --- a/addons/common/functions/fnc_requestSyncedEvent.sqf +++ b/addons/common/functions/fnc_requestSyncedEvent.sqf @@ -1,19 +1,20 @@ /* * Author: jaynus - * * Send a request to synchronize an event name from the client->server. Execute on client only. * - * Argument: - * 0: eventName (String) + * Arguments: + * 0: eventName * - * Return value: + * Return Value: * Boolean of success + * + * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" -PARAMS_1(_eventName); + +params ["_eventName"]; // Only JIP machines on initialization send this off, requesting sync on events with the serverCommand -if(isServer) exitWith { false }; +if (isServer) exitWith {false}; -["SEH_s", [_eventName, ACE_player] ] call ace_common_fnc_serverEvent; \ No newline at end of file +["SEH_s", [_eventName, ACE_player] ] call FUNC(serverEvent); diff --git a/addons/common/functions/fnc_resetAllDefaults.sqf b/addons/common/functions/fnc_resetAllDefaults.sqf index 3040334ad0..83e62fcf8b 100644 --- a/addons/common/functions/fnc_resetAllDefaults.sqf +++ b/addons/common/functions/fnc_resetAllDefaults.sqf @@ -1,39 +1,44 @@ -/** - * fn_resetAllDefaults_f.sqf - * @Descr: reset all variables that have been defined - * @Author: Glowbal +/* + * Author: Glowbal + * reset all variables that have been defined * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * ? + * + * Return Value: + * ? + * + * Public: No */ - #include "script_component.hpp" -PARAMS_1(_unit); +params ["_unit"]; -_unit setvariable ["ACE_isDead",nil,true]; +_unit setvariable ["ACE_isDead", nil, true]; _unit setvariable ["ACE_isUnconscious", nil, true]; if (isPlayer _unit) then { [true] call FUNC(setVolume); [false] call FUNC(disableKeyInput); + if (["ace_medical"] call FUNC(isModLoader)) then { [false] call EFUNC(medical,effectBlackOut); }; - if !(isnil QGVAR(DISABLE_USER_INPUT_COLLECTION)) then { + if !(isNil QGVAR(DISABLE_USER_INPUT_COLLECTION)) then { // clear all disable user input { [_x, false] call FUNC(setDisableUserInputStatus); - }foreach GVAR(DISABLE_USER_INPUT_COLLECTION); + false + } count GVAR(DISABLE_USER_INPUT_COLLECTION); }; }; { - if (!(_x select 4)) then { - _unit setvariable [(_x select 0),nil,_x select 3]; + if !(_x select 4) then { + _unit setvariable [_x select 0, nil, _x select 3]; }; -} forEach ([_unit] call FUNC(getAllDefinedSetVariables)); + false +} count ([_unit] call FUNC(getAllDefinedSetVariables)); _unit setVariable ["ACE_forceWalkStatusNumber", 0, true]; diff --git a/addons/common/functions/fnc_restoreVariablesJIP.sqf b/addons/common/functions/fnc_restoreVariablesJIP.sqf index 9ca911d79c..1937c615a4 100644 --- a/addons/common/functions/fnc_restoreVariablesJIP.sqf +++ b/addons/common/functions/fnc_restoreVariablesJIP.sqf @@ -3,18 +3,19 @@ * * Called from respawn eventhandler. Resets all public object namespace variables that are added via FUNC(setVariableJIP). * - * Argument: - * 0: Object (Object) + * Arguments: + * 0: Object * - * Return value: - * Nothing. + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" +params ["_unit"]; + private "_respawnVariables"; - -PARAMS_1(_unit); - _respawnVariables = _unit getVariable ["ACE_respawnVariables", []]; // yes those @@ -22,4 +23,6 @@ _respawnVariables pushBack "ACE_PersistentFunctions"; { _unit setVariable [_x, _unit getVariable _x, true]; -} forEach _respawnVariables; + false +} count _respawnVariables; +nil