diff --git a/addons/ai/functions/fnc_garrison.sqf b/addons/ai/functions/fnc_garrison.sqf index dfde0e7634d..d6428d9263d 100644 --- a/addons/ai/functions/fnc_garrison.sqf +++ b/addons/ai/functions/fnc_garrison.sqf @@ -31,11 +31,13 @@ private _currentUnitMoveList = missionNamespace getVariable [QGVAR(garrison_unit if (_startingPos isEqualTo [0,0,0]) exitWith { TRACE_1("fnc_garrison: StartingPos error",_startingPos); [LSTRING(GarrisonInvalidPosition)] call EFUNC(common,displayTextStructured); + _unitsArray }; if (_unitsArray isEqualTo [] || {isNull (_unitsArray select 0)}) exitWith { TRACE_1("fnc_garrison: Units error",_unitsArray); [LSTRING(GarrisonNoUnits)] call EFUNC(common,displayTextStructured); + _unitsArray }; private _buildings = nearestObjects [_startingPos, _buildingTypes, ([_fillingRadius, 50] select (_fillingRadius < 50))]; @@ -46,6 +48,7 @@ if (_fillingRadius >= 50) then { if (_buildings isEqualTo []) exitWith { TRACE_1("fnc_garrison: Building error",_buildings); [LSTRING(GarrisonNoBuilding)] call EFUNC(common,displayTextStructured); + _unitsArray }; private _buildingsIndex = []; diff --git a/addons/artillerytables/functions/fnc_adjustFire.sqf b/addons/artillerytables/functions/fnc_adjustFire.sqf index 1e07c5ca212..00714401ff9 100644 --- a/addons/artillerytables/functions/fnc_adjustFire.sqf +++ b/addons/artillerytables/functions/fnc_adjustFire.sqf @@ -34,7 +34,7 @@ params ["_gunPos", "_targetPos", "_adjustEast", "_adjustNorth", "_adjustUp", "_m //DEFAULT_AIR_FRICTION == -0.00006 //MK6_82mm_AIR_FRICTION == -0.0001 -private _resultPos = [_adjustEast + _targetPos select 0, _adjustNorth + _targetPos select 1, _adjustUp + _targetPos select 2]; +private _resultPos = _targetPos vectorAdd [_adjustEast, _adjustNorth, _adjustUp]; private _returns = [_gunPos, _resultPos, _muzzleVelocity, _highAngle, _airFriction, _temperature, _airDensity, _windDir, _windSpeed] call FUNC(calculateSolution); diff --git a/addons/common/functions/fnc_removeSyncedEventHandler.sqf b/addons/common/functions/fnc_removeSyncedEventHandler.sqf index 615f50ce49b..647ec8c379f 100644 --- a/addons/common/functions/fnc_removeSyncedEventHandler.sqf +++ b/addons/common/functions/fnc_removeSyncedEventHandler.sqf @@ -25,5 +25,5 @@ if !(_name in GVAR(syncedEvents)) exitWith { private _data = GVAR(syncedEvents) get _name; _data params ["", "", "", "_eventId"]; -[_eventId] call CBA_fnc_removeEventHandler; +[_name, _eventId] call CBA_fnc_removeEventHandler; GVAR(syncedEvents) deleteAt _name; diff --git a/addons/common/functions/fnc_requestSyncedEvent.sqf b/addons/common/functions/fnc_requestSyncedEvent.sqf index 8e566c0e67a..2944672bea7 100644 --- a/addons/common/functions/fnc_requestSyncedEvent.sqf +++ b/addons/common/functions/fnc_requestSyncedEvent.sqf @@ -21,3 +21,4 @@ params ["_eventName"]; if (isServer) exitWith {false}; ["ACEs", [_eventName, ACE_player]] call CBA_fnc_serverEvent; +true diff --git a/addons/common/functions/fnc_syncedEvent.sqf b/addons/common/functions/fnc_syncedEvent.sqf index d0789decdce..96fc0136293 100644 --- a/addons/common/functions/fnc_syncedEvent.sqf +++ b/addons/common/functions/fnc_syncedEvent.sqf @@ -27,3 +27,4 @@ if !(_name in GVAR(syncedEvents)) exitWith { private _eventData = [_name, _args, _ttl]; ["ACEe", _eventData] call CBA_fnc_globalEvent; +true diff --git a/addons/frag/functions/fnc_frago.sqf b/addons/frag/functions/fnc_frago.sqf index 9e9716a5428..1419bfbe312 100644 --- a/addons/frag/functions/fnc_frago.sqf +++ b/addons/frag/functions/fnc_frago.sqf @@ -122,7 +122,7 @@ if (GVAR(reflectionsEnabled)) then { if (_fragCount > _maxFrags) exitWith {}; } forEach _targets; TRACE_1("targeted",_fragCount); -if (_fragCount > _maxFrags) exitWith {}; +if (_fragCount > _maxFrags) exitWith { _fragCount }; private _randomCount = ceil ((_maxFrags - _fragCount) * 0.35); TRACE_1("",_randomCount); private _sectorSize = 360 / (_randomCount max 1); diff --git a/addons/interaction/functions/fnc_getGlassDoor.sqf b/addons/interaction/functions/fnc_getGlassDoor.sqf index 2aea74f82d4..92c5984af18 100644 --- a/addons/interaction/functions/fnc_getGlassDoor.sqf +++ b/addons/interaction/functions/fnc_getGlassDoor.sqf @@ -9,7 +9,7 @@ * 2: Door name * * Return Value: - * 0: Door Name + * 0: Door Name * * Example: * [player, target] call ace_interaction_fnc_getGlassDoor @@ -61,6 +61,6 @@ private _lowestDistance = 0; } forEach _doorPos; // Check if we have a door or if it is the glass part -if ((isNil "_door") || ((_door find "glass") != -1)) exitWith {}; +if ((isNil "_door") || ((_door find "glass") != -1)) exitWith {}; // line has never worked? _door diff --git a/addons/medical/functions/fnc_setUnconscious.sqf b/addons/medical/functions/fnc_setUnconscious.sqf index 091e4837a83..050cfa0ce2d 100644 --- a/addons/medical/functions/fnc_setUnconscious.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -10,7 +10,7 @@ * 3: Force wakeup at given time if vitals are stable (default: false) * * Return Value: - * Success? + * Success? or if called before settings are initialized * * Example: * [bob, true] call ace_medical_fnc_setUnconscious; @@ -22,6 +22,7 @@ // only run this after the settings are initialized if !(EGVAR(common,settingsInitFinished)) exitWith { EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(setUnconscious), _this]; + nil }; params [["_unit", objNull, [objNull]], ["_knockOut", true, [false]], ["_minWaitingTime", 0, [0]], ["_forcedWakup", false, [false]]]; diff --git a/addons/medical_treatment/functions/fnc_treatment.sqf b/addons/medical_treatment/functions/fnc_treatment.sqf index c15de4f70e2..897db73c211 100644 --- a/addons/medical_treatment/functions/fnc_treatment.sqf +++ b/addons/medical_treatment/functions/fnc_treatment.sqf @@ -10,7 +10,7 @@ * 3: Treatment * * Return Value: - * Treatment Started + * Treatment Started or if cursor menu is open * * Example: * [player, cursorObject, "Head", "BasicBandage"] call ace_medical_treatment_fnc_treatment @@ -23,6 +23,7 @@ params ["_medic", "_patient", "_bodyPart", "_classname"]; // Delay by a frame if cursor menu is open to prevent progress bar failing if (uiNamespace getVariable [QEGVAR(interact_menu,cursorMenuOpened), false]) exitWith { [FUNC(treatment), _this] call CBA_fnc_execNextFrame; + nil }; if !(call FUNC(canTreat)) exitWith {false}; diff --git a/addons/slideshow/functions/fnc_createSlideshow.sqf b/addons/slideshow/functions/fnc_createSlideshow.sqf index c24d3023467..ad18193669e 100644 --- a/addons/slideshow/functions/fnc_createSlideshow.sqf +++ b/addons/slideshow/functions/fnc_createSlideshow.sqf @@ -34,9 +34,11 @@ params [ // Verify data if (_objects isEqualTo []) exitWith { ERROR("Slideshow Objects field must NOT be empty!"); + -1 }; if (count _images != count _names || {_images isEqualTo []} || {_names isEqualTo []}) exitWith { ERROR("Slideshow Images or Names fields must NOT be empty and must have equal number of items!"); + -1 }; // If no controllers use objects as controllers diff --git a/addons/spectator/functions/fnc_updateCameraModes.sqf b/addons/spectator/functions/fnc_updateCameraModes.sqf index b188f5d747a..44917019523 100644 --- a/addons/spectator/functions/fnc_updateCameraModes.sqf +++ b/addons/spectator/functions/fnc_updateCameraModes.sqf @@ -14,7 +14,7 @@ * 1: Camera modes to remove * * Return Value: - * Available camera modes + * Available camera modes or if called before settings are initialized * * Example: * [[0], [1,2]] call ace_spectator_fnc_updateCameraModes @@ -24,6 +24,7 @@ if !(EGVAR(common,settingsInitFinished)) exitWith { EGVAR(common,runAtSettingsInitialized) pushBack [DFUNC(updateCameraModes),_this]; + nil }; params [["_addModes",[],[[]]], ["_removeModes",[],[[]]]]; diff --git a/addons/spectator/functions/fnc_updateVisionModes.sqf b/addons/spectator/functions/fnc_updateVisionModes.sqf index 1265ff12fc2..4ad21534560 100644 --- a/addons/spectator/functions/fnc_updateVisionModes.sqf +++ b/addons/spectator/functions/fnc_updateVisionModes.sqf @@ -22,7 +22,7 @@ * 1: Vision modes to remove * * Return Value: - * Available vision modes + * Available vision modes or if called before settings are initialized * * Example: * [[0], [1,2]] call ace_spectator_fnc_updateVisionModes @@ -32,6 +32,7 @@ if !(EGVAR(common,settingsInitFinished)) exitWith { EGVAR(common,runAtSettingsInitialized) pushBack [DFUNC(updateVisionModes),_this]; + nil }; params [["_addModes",[],[[]]], ["_removeModes",[],[[]]]]; diff --git a/addons/spike/functions/fnc_camera_init.sqf b/addons/spike/functions/fnc_camera_init.sqf index 91df5ff66e1..ba367d395c7 100644 --- a/addons/spike/functions/fnc_camera_init.sqf +++ b/addons/spike/functions/fnc_camera_init.sqf @@ -21,7 +21,7 @@ params ["_projectile", "_cameraArray", "_shooter", "_switchOnFireInit"]; _cameraArray params ["_enabled", "_fovLevels", "_initialFOV", "_thermalTypes", "_initialThermalType", "_switchOnFire", "_lerpFOV", "_fovChangeTime", "", "_gimbalData", "_reticleData", "_designating"]; _gimbalData params ["_hasGimbal", "_maxGimbalX", "_maxGimbalY", "_gimbalSpeedX", "_gimbalSpeedY", "_initGimbalAngleX", "_initGimbalAngleY", "_gimbalZoomSpeedModifiers"]; -if !(_enabled) exitWith {}; +if !(_enabled) exitWith { objNull }; private _activeCameraNamespace = [] call CBA_fnc_createNamespace; _activeCameraNamespace setVariable [QGVAR(fovLevels), _fovLevels]; diff --git a/addons/tagging/functions/fnc_createTag.sqf b/addons/tagging/functions/fnc_createTag.sqf index cefc48f5a7d..fe5fdc92dbf 100644 --- a/addons/tagging/functions/fnc_createTag.sqf +++ b/addons/tagging/functions/fnc_createTag.sqf @@ -36,6 +36,7 @@ if (_isVehicleTag) exitWith { _object setVariable [QGVAR(hasTag), true, true]; // if (_material != "") then { _object setObjectMaterialGlobal ["clan", _material] }; // ?? ["ace_tagCreated", [objNull, _texture, _object, _unit]] call CBA_fnc_globalEvent; + true }; private _tag = createSimpleObject [_tagModel, _tagPosASL]; diff --git a/addons/tagging/functions/fnc_tag.sqf b/addons/tagging/functions/fnc_tag.sqf index d73b4f796d5..e7956d5ce98 100644 --- a/addons/tagging/functions/fnc_tag.sqf +++ b/addons/tagging/functions/fnc_tag.sqf @@ -27,6 +27,7 @@ params [ if (isNull _unit || {_texture == ""}) exitWith { ERROR_2("Tag parameters invalid. Unit: %1, Texture: %2",_unit,_texture); + false }; private _isVehicleTag = false; diff --git a/addons/ui/functions/fnc_setAdvancedElement.sqf b/addons/ui/functions/fnc_setAdvancedElement.sqf index 86a11348020..6bf222a5e61 100644 --- a/addons/ui/functions/fnc_setAdvancedElement.sqf +++ b/addons/ui/functions/fnc_setAdvancedElement.sqf @@ -23,7 +23,7 @@ params ["_element", "_show", ["_showHint", false, [true]], ["_force", false, [tr _element = toLowerANSI _element; private _cachedElement = GVAR(configCache) get _element; -if (isNil "_cachedElement") exitWith {TRACE_1("nil element",_this)}; +if (isNil "_cachedElement") exitWith {TRACE_1("nil element",_this); false }; if (!_force && {!GVAR(allowSelectiveUI)}) exitWith { TRACE_1("not allowed",_this); diff --git a/addons/ui/functions/fnc_setElementVisibility.sqf b/addons/ui/functions/fnc_setElementVisibility.sqf index 938fb2da7de..625788ffac7 100644 --- a/addons/ui/functions/fnc_setElementVisibility.sqf +++ b/addons/ui/functions/fnc_setElementVisibility.sqf @@ -27,6 +27,7 @@ params [ if (_source == "" || {_element == ""}) exitWith { WARNING("Source or Element may not be empty strings!"); + false }; _element = toLowerANSI _element; @@ -34,6 +35,7 @@ _element = toLowerANSI _element; // Verify element is bound if !(_element in GVAR(configCache)) exitWith { WARNING_2("Element '%1' does not exist - modification by '%2' failed.",_element,_source); + false }; private _setElement = GVAR(elementsSet) get _element; diff --git a/addons/vehicle_damage/functions/fnc_processHit.sqf b/addons/vehicle_damage/functions/fnc_processHit.sqf index a74100e0e30..261c3c99c2d 100644 --- a/addons/vehicle_damage/functions/fnc_processHit.sqf +++ b/addons/vehicle_damage/functions/fnc_processHit.sqf @@ -307,7 +307,7 @@ switch (_hitArea) do { case "track": { private _damage = (0.1 max (0.1 * _addedDamage / _minDamage)) min 1; - [_vehicle, _hitPoint, _hitIndex, (_currentPartDamage + _damage) * _penChance] call FUNC(setDamage); + [_vehicle, _hitPoint, _hitIndex, (_currentPartDamage + _damage) * _penChance, _source, _instigator] call FUNC(setDamage); TRACE_3("damaged track",_damage,_addedDamage,_minDamage); diff --git a/docs/wiki/development/coding-guidelines.md b/docs/wiki/development/coding-guidelines.md index eee658d0293..ef3b9f59ff6 100644 --- a/docs/wiki/development/coding-guidelines.md +++ b/docs/wiki/development/coding-guidelines.md @@ -210,7 +210,7 @@ This is not the case for inline functions or functions not contained in their ow To keep the syntax in the header consistent, we set some rules: 1. Each argument must have a type that is enclosed in brackets ``. The type must be in UPPERCASE. -2. Use one of the following types only: `OBJECT`, `NUMBER`, `STRING`, `BOOL`, `ARRAY`, `CONTROL`, `DISPLAY`, `CONFIG`, `CODE`, `ANY`, `LOGIC`, `SIDE`, `GROUP`, `HASHMAP`, `NAMESPACE`, `LOCATION`, `TEXT`. +2. Use one of the following types only: `OBJECT`, `NUMBER`, `STRING`, `BOOL`, `ARRAY`, `CONTROL`, `DISPLAY`, `CONFIG`, `CODE`, `ANY`, `SIDE`, `GROUP`, `HASHMAP`, `NAMESPACE`, `LOCATION`, `STRUCTUREDTEXT`, `NIL`. 3. If an argument can have multiple types, concatenate types using `or`. Example: ``. 4. Arrays with the same value types are written in the format ``. The nested type has a small `s` appended at the end. 5. If an argument is optional, the default value must be written after the type in the format `(default: value)`.