Skip to content

Commit e13339f

Browse files
General - Various small code fixes (#11144)
* General - Various small code fixes * Update fnc_removeSyncedEventHandler.sqf * more return fixes * Update addons/artillerytables/functions/fnc_adjustFire.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * Update addons/interaction/functions/fnc_getGlassDoor.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * Update coding-guidelines.md --------- Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
1 parent 9dc2c60 commit e13339f

File tree

19 files changed

+28
-13
lines changed

19 files changed

+28
-13
lines changed

addons/ai/functions/fnc_garrison.sqf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ private _currentUnitMoveList = missionNamespace getVariable [QGVAR(garrison_unit
3131
if (_startingPos isEqualTo [0,0,0]) exitWith {
3232
TRACE_1("fnc_garrison: StartingPos error",_startingPos);
3333
[LSTRING(GarrisonInvalidPosition)] call EFUNC(common,displayTextStructured);
34+
_unitsArray
3435
};
3536

3637
if (_unitsArray isEqualTo [] || {isNull (_unitsArray select 0)}) exitWith {
3738
TRACE_1("fnc_garrison: Units error",_unitsArray);
3839
[LSTRING(GarrisonNoUnits)] call EFUNC(common,displayTextStructured);
40+
_unitsArray
3941
};
4042

4143
private _buildings = nearestObjects [_startingPos, _buildingTypes, ([_fillingRadius, 50] select (_fillingRadius < 50))];
@@ -46,6 +48,7 @@ if (_fillingRadius >= 50) then {
4648
if (_buildings isEqualTo []) exitWith {
4749
TRACE_1("fnc_garrison: Building error",_buildings);
4850
[LSTRING(GarrisonNoBuilding)] call EFUNC(common,displayTextStructured);
51+
_unitsArray
4952
};
5053

5154
private _buildingsIndex = [];

addons/artillerytables/functions/fnc_adjustFire.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ params ["_gunPos", "_targetPos", "_adjustEast", "_adjustNorth", "_adjustUp", "_m
3434
//DEFAULT_AIR_FRICTION == -0.00006
3535
//MK6_82mm_AIR_FRICTION == -0.0001
3636

37-
private _resultPos = [_adjustEast + _targetPos select 0, _adjustNorth + _targetPos select 1, _adjustUp + _targetPos select 2];
37+
private _resultPos = _targetPos vectorAdd [_adjustEast, _adjustNorth, _adjustUp];
3838

3939
private _returns = [_gunPos, _resultPos, _muzzleVelocity, _highAngle, _airFriction, _temperature, _airDensity, _windDir, _windSpeed] call FUNC(calculateSolution);
4040

addons/common/functions/fnc_removeSyncedEventHandler.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ if !(_name in GVAR(syncedEvents)) exitWith {
2525
private _data = GVAR(syncedEvents) get _name;
2626
_data params ["", "", "", "_eventId"];
2727

28-
[_eventId] call CBA_fnc_removeEventHandler;
28+
[_name, _eventId] call CBA_fnc_removeEventHandler;
2929
GVAR(syncedEvents) deleteAt _name;

addons/common/functions/fnc_requestSyncedEvent.sqf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ params ["_eventName"];
2121
if (isServer) exitWith {false};
2222

2323
["ACEs", [_eventName, ACE_player]] call CBA_fnc_serverEvent;
24+
true

addons/common/functions/fnc_syncedEvent.sqf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ if !(_name in GVAR(syncedEvents)) exitWith {
2727
private _eventData = [_name, _args, _ttl];
2828

2929
["ACEe", _eventData] call CBA_fnc_globalEvent;
30+
true

addons/frag/functions/fnc_frago.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ if (GVAR(reflectionsEnabled)) then {
122122
if (_fragCount > _maxFrags) exitWith {};
123123
} forEach _targets;
124124
TRACE_1("targeted",_fragCount);
125-
if (_fragCount > _maxFrags) exitWith {};
125+
if (_fragCount > _maxFrags) exitWith { _fragCount };
126126
private _randomCount = ceil ((_maxFrags - _fragCount) * 0.35);
127127
TRACE_1("",_randomCount);
128128
private _sectorSize = 360 / (_randomCount max 1);

addons/interaction/functions/fnc_getGlassDoor.sqf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* 2: Door name <STRING>
1010
*
1111
* Return Value:
12-
* 0: Door Name <STRING>
12+
* 0: Door Name <STRING or NIL>
1313
*
1414
* Example:
1515
* [player, target] call ace_interaction_fnc_getGlassDoor
@@ -61,6 +61,6 @@ private _lowestDistance = 0;
6161
} forEach _doorPos;
6262

6363
// Check if we have a door or if it is the glass part
64-
if ((isNil "_door") || ((_door find "glass") != -1)) exitWith {};
64+
if ((isNil "_door") || ((_door find "glass") != -1)) exitWith {}; // line has never worked?
6565

6666
_door

addons/medical/functions/fnc_setUnconscious.sqf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* 3: Force wakeup at given time if vitals are stable <BOOL> (default: false)
1111
*
1212
* Return Value:
13-
* Success? <BOOL>
13+
* Success? <BOOL> or <NIL> if called before settings are initialized
1414
*
1515
* Example:
1616
* [bob, true] call ace_medical_fnc_setUnconscious;
@@ -22,6 +22,7 @@
2222
// only run this after the settings are initialized
2323
if !(EGVAR(common,settingsInitFinished)) exitWith {
2424
EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(setUnconscious), _this];
25+
nil
2526
};
2627

2728
params [["_unit", objNull, [objNull]], ["_knockOut", true, [false]], ["_minWaitingTime", 0, [0]], ["_forcedWakup", false, [false]]];

addons/medical_treatment/functions/fnc_treatment.sqf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* 3: Treatment <STRING>
1111
*
1212
* Return Value:
13-
* Treatment Started <BOOL>
13+
* Treatment Started <BOOL> or <NIL> if cursor menu is open
1414
*
1515
* Example:
1616
* [player, cursorObject, "Head", "BasicBandage"] call ace_medical_treatment_fnc_treatment
@@ -23,6 +23,7 @@ params ["_medic", "_patient", "_bodyPart", "_classname"];
2323
// Delay by a frame if cursor menu is open to prevent progress bar failing
2424
if (uiNamespace getVariable [QEGVAR(interact_menu,cursorMenuOpened), false]) exitWith {
2525
[FUNC(treatment), _this] call CBA_fnc_execNextFrame;
26+
nil
2627
};
2728

2829
if !(call FUNC(canTreat)) exitWith {false};

addons/slideshow/functions/fnc_createSlideshow.sqf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ params [
3434
// Verify data
3535
if (_objects isEqualTo []) exitWith {
3636
ERROR("Slideshow Objects field must NOT be empty!");
37+
-1
3738
};
3839
if (count _images != count _names || {_images isEqualTo []} || {_names isEqualTo []}) exitWith {
3940
ERROR("Slideshow Images or Names fields must NOT be empty and must have equal number of items!");
41+
-1
4042
};
4143

4244
// If no controllers use objects as controllers

0 commit comments

Comments
 (0)