Cleanup using SQFLint (#6485)

* Use private
* Fix wrong spacing
* Fix wrong variable being used
* Cleanup empty line after header
* ace_common_fnc_getCountOfItem
* Remove useless _return variable
* Naming
This commit is contained in:
Dedmen Miller 2018-08-02 16:02:10 +02:00 committed by SilentSpike
parent 60a8158246
commit 7a0a00ea09
30 changed files with 102 additions and 28 deletions

View File

@ -57,6 +57,7 @@ PREP(fixLoweredRifleAnimation);
PREP(fixPosition);
PREP(getAllDefinedSetVariables);
PREP(getAwakeAnim);
PREP(getCountOfItem);
PREP(getDeathAnim);
PREP(getDefaultAnim);
PREP(getDefinedVariable);

View File

@ -0,0 +1,31 @@
#include "script_component.hpp"
/*
* Author: Dedmen
* Return how many items of type _itemType the player has in his containers (Uniform, Vest, Backpack)
* Doesn't count assignedItems, weapons, weapon attachments, magazines in weapons
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Classname of item (Case-Sensitive) <STRING>
*
* Return Value:
* Item Count <NUMBER>
*
* Example:
* [bob, "FirstAidKit"] call ace_common_fnc_getCountOfItem
*
* Public: Yes
*/
params ["_unit", "_itemType"];
private _countItemsInContainer = {
(getItemCargo _this) params ["_itemTypes", "_itemCounts"];
private _index = _itemTypes find _itemType;
_itemCounts param [_index, 0]
};
((uniformContainer _unit) call _countItemsInContainer) +
((vestContainer _unit) call _countItemsInContainer) +
((backpackContainer _unit) call _countItemsInContainer)

View File

@ -1,3 +1,4 @@
#include "script_component.hpp"
/*
* Author: PabstMirror
* Manually Apply Damage to a unit (can cause lethal damage)
@ -21,7 +22,6 @@
*/
// #define DEBUG_MODE_FULL
// #define DEBUG_TESTRESULTS
#include "script_component.hpp"
params [["_unit", objNull, [objNull]], ["_damageToAdd", -1, [0]], ["_bodyPart", "", [""]], ["_typeOfDamage", "", [""]], ["_instigator", objNull, [objNull]]];
TRACE_5("params",_unit,_damageToAdd,_bodyPart,_typeOfDamage,_instigator);

View File

@ -1,3 +1,4 @@
#include "script_component.hpp"
/*
* Author: Glowbal
* Sets a unit in the unconscious state.
@ -19,7 +20,6 @@
* Public: yes
*/
// #define DEBUG_MODE_FULL
#include "script_component.hpp"
// only run this after the settings are initialized
if !(EGVAR(common,settingsInitFinished)) exitWith {

View File

@ -16,6 +16,7 @@
*
* Public: No
*/
params ["_unit", "_isBandage", "_isSelfTreatment"];
if (vehicle _unit != _unit) exitWith {};

View File

@ -16,7 +16,6 @@
*
* Public: No
*/
#define MAXIMUM_DROPS 4
#define DISTANCE_BETWEEN_DROPS 0.20
#define OFFSET 0.25

View File

@ -11,7 +11,6 @@
*
* Public: No
*/
// for travis
#define HIT_STRUCTURAL QGVAR($#structural)
#define HIT_CRASH QGVAR($#crash)

View File

@ -10,6 +10,7 @@
* Return Value:
* None
*/
params ["_enable", "_bloodloss"];
if (isNull findDisplay 46) exitWith {};

View File

@ -10,6 +10,7 @@
* Return Value:
* None
*/
params ["_enable", "_intensity"];
if ((!_enable) || {_intensity == 0}) exitWith {

View File

@ -9,6 +9,7 @@
* Return Value:
* None
*/
params ["_heartRate"];
if (_heartRate == 0) exitWith {

View File

@ -10,6 +10,7 @@
* Return Value:
* None
*/
params ["_enable", "_intensity"];
if (!_enable || {_intensity == 0}) exitWith {

View File

@ -10,6 +10,7 @@
* Return Value:
* None
*/
params ["_enable", "_mode"];
switch (_mode) do {

View File

@ -17,7 +17,6 @@
*
* Public: No
*/
#define TIME_OUT_HIT 1
#define TIME_OUT_MOAN 5

View File

@ -29,7 +29,7 @@ private _display = uiNamespace getVariable QGVAR(medicalMenu);
if (isNil "_display") exitWith {}; // no valid dialog present
if (_name isEqualTo "toggle") exitWith {
_newTarget = ACE_player;
private _newTarget = ACE_player;
//If we are on the player, and only if our old target is still valid, switch to it:
if ((GVAR(INTERACTION_TARGET) == ACE_player) &&
{[ACE_player, GVAR(INTERACTION_TARGET_PREVIOUS), ["isNotInside", "isNotSwimming"]] call EFUNC(common,canInteractWith)} &&
@ -89,12 +89,12 @@ if (_name isEqualTo "triage") exitWith {
ctrlEnable [212, false];
_entries = [ACE_player, GVAR(INTERACTION_TARGET), _name] call FUNC(getTreatmentOptions);
private _entries = [ACE_player, GVAR(INTERACTION_TARGET), _name] call FUNC(getTreatmentOptions);
{
//player sidechat format["TRIGGERED: %1",_x];
if (_forEachIndex > END_IDC) exitWith {};
_ctrl = (_display displayCtrl (START_IDC + _forEachIndex));
private _ctrl = (_display displayCtrl (START_IDC + _forEachIndex));
if (!(_forEachIndex > AMOUNT_OF_ENTRIES)) then {
_ctrl ctrlSetText (_x select 0);
private _code = format ["ace_medical_menu_pendingReopen = true; call %1;", (_x select 3)];

View File

@ -11,6 +11,7 @@
*
* Public: No
*/
params ["_unit"];
private _startTime = _unit getVariable [QGVAR(cardiacArrestStart), CBA_missionTime];

View File

@ -11,6 +11,7 @@
*
* Public: No
*/
params ["_unit"];
(GVAR(fatalInjuryCondition) < 2) && {!(_unit getVariable [QGVAR(deathBlocked), false])}

View File

@ -11,6 +11,7 @@
*
* Public: No
*/
params ["_unit"];
[QEGVAR(medical,FatalInjuryInstantTransition), _unit] call CBA_fnc_localEvent;

View File

@ -1,7 +1,18 @@
#include "script_component.hpp"
/*
* Author: BaerMitUmlaut
*
*
* Arguments:
* 0: The Unit <OBJECT>
*
* Return Value:
* None
*
* Public: No
*/
params ["_unit", "_stateName"];
params ["_unit"];
// If the unit died the loop is finished
if (!alive _unit) exitWith {};

View File

@ -1,7 +1,18 @@
#include "script_component.hpp"
/*
* Author: BaerMitUmlaut
*
*
* Arguments:
* 0: The Unit <OBJECT>
*
* Return Value:
* None
*
* Public: No
*/
params ["_unit", "_stateName"];
params ["_unit"];
// If the unit died the loop is finished
if (!alive _unit) exitWith {};
@ -19,4 +30,3 @@ private _painLevel = GET_PAIN_PERCEIVED(_unit);
if (_painLevel > 0) then {
[QEGVAR(medical,moan), [_unit, _painLevel]] call CBA_fnc_localEvent;
};

View File

@ -1,7 +1,18 @@
#include "script_component.hpp"
/*
* Author: BaerMitUmlaut
*
*
* Arguments:
* 0: The Unit <OBJECT>
*
* Return Value:
* None
*
* Public: No
*/
params ["_unit", "_stateName"];
params ["_unit"];
// If the unit died the loop is finished
if (!alive _unit) exitWith {};

View File

@ -11,6 +11,7 @@
*
* Public: No
*/
params ["_unit"];
_unit setVariable [QEGVAR(medical,deathBlocked), true];

View File

@ -12,6 +12,7 @@
* Return Value:
* None
*/
params ["_unit", "_change", "_timeToMaxEffect", "_maxTimeInSystem"];
private _adjustments = _unit getVariable [VAR_HEART_RATE_ADJ,[]];

View File

@ -10,7 +10,7 @@
* None
*
* Example:
* call ACE_medical_fnc_bodyCleanupLoop
* call ACE_medical_treatment_fnc_bodyCleanupLoop
*
* Public: No
*/

View File

@ -14,10 +14,10 @@
params ["_unit"];
private _countFirstAidKit = {_x == "FirstAidKit"} count items _unit;
private _countFirstAidKit = [_unit, "FirstAidKit"] call EFUNC(common,getCountOfItem);
_unit removeItems "FirstAidKit";
private _countMedikit = {_x == "Medikit"} count items _unit;
private _countMedikit = [_unit, "Medikit"] call EFUNC(common,getCountOfItem);
_unit removeItems "Medikit";
for "_i" from 1 to _countFirstAidKit do {

View File

@ -14,14 +14,15 @@
* Public: Yes
*/
private ["_unit","_return","_status"];
params ["_unit"];
_status = _unit getVariable [QEGVAR(medical,triageLevel), -1];
_return = switch (_status) do {
private _status = _unit getVariable [QEGVAR(medical,triageLevel), -1];
//return
switch (_status) do {
case 1: {[localize ELSTRING(medical_treatment,Triage_Status_Minor), 1, [0, 0.5, 0, 0.9]]};
case 2: {[localize ELSTRING(medical_treatment,Triage_Status_Delayed), 2, [0.7, 0.5, 0, 0.9]]};
case 3: {[localize ELSTRING(medical_treatment,Triage_Status_Immediate), 3, [0.4, 0.07, 0.07, 0.9]]};
case 4: {[localize ELSTRING(medical_treatment,Triage_Status_Deceased), 4, [0, 0, 0, 0.9]]};
default {[localize ELSTRING(medical_treatment,Triage_Status_None), 0, [0, 0, 0, 0.9]]};
};
_return
}

View File

@ -16,6 +16,7 @@
*/
params ["_unit"];
private _vehicle = vehicle _unit;
if (_unit == _vehicle) exitWith {false};

View File

@ -10,7 +10,7 @@
* None
*
* Example:
* call ACE_medical_fnc_litterCleanupLoop
* call ACE_medical_treatment_fnc_litterCleanupLoop
*
* Public: No
*/

View File

@ -11,7 +11,7 @@
* None
*
* Example:
* [cursorTarget] call ace_medical_fnc_serverRemoveBody
* [cursorTarget] call ace_medical_treatment_fnc_serverRemoveBody
*
* Public: No
*/

View File

@ -16,8 +16,8 @@ params ["_target"];
if (!alive _target) exitWith {};
_unit setVariable [VAR_PAIN, 0, true];
_unit setVariable [VAR_BLOOD_VOL, DEFAULT_BLOOD_VOLUME, true];
_target setVariable [VAR_PAIN, 0, true];
_target setVariable [VAR_BLOOD_VOL, DEFAULT_BLOOD_VOLUME, true];
// tourniquets
_target setVariable [VAR_TOURNIQUET, DEFAULT_TOURNIQUET_VALUES, true];

View File

@ -1,3 +1,4 @@
#include "script_component.hpp"
/*
* Author: Glowbal
* Updates the vitals. Called from the statemachine's onState functions.
@ -14,7 +15,6 @@
* Public: No
*/
// #define DEBUG_MODE_FULL
#include "script_component.hpp"
params ["_unit"];