Skip to content

Commit 1e404cf

Browse files
BrettMaysonDystopianPabstMirrorLinkIsGrim
authored
General - SQF Improvements (#9698)
Co-authored-by: Dystopian <sddex@ya.ru> Co-authored-by: PabstMirror <pabstmirror@gmail.com> Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
1 parent 8d6555a commit 1e404cf

55 files changed

Lines changed: 114 additions & 113 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ INFO_2("Starting Terrain Extension [cells: %1] [world: %2]", _gridCells, worldNa
5353
private _gridCenter = [_x + 25, _y + 25];
5454
private _gridHeight = round(getTerrainHeightASL _gridCenter);
5555
private _gridNumObjects = count (_gridCenter nearObjects ["Building", 50]);
56-
private _gridSurfaceIsWater = if (surfaceIsWater _gridCenter) then {1} else {0};
56+
private _gridSurfaceIsWater = parseNumber (surfaceIsWater _gridCenter);
5757
"ace_advanced_ballistics" callExtension format["set:%1:%2:%3", _gridHeight, _gridNumObjects, _gridSurfaceIsWater];
5858
GVAR(currentGrid) = GVAR(currentGrid) + 1;
5959
if (GVAR(currentGrid) >= _gridCells) exitWith {};

addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
private _weaponConfig = (configFile >> "CfgWeapons" >> _this);
2222

2323
private _barrelTwist = 0 max getNumber(_weaponConfig >> "ACE_barrelTwist");
24-
private _twistDirection = [0, 1] select (_barrelTwist != 0);
24+
private _twistDirection = parseNumber (_barrelTwist != 0);
2525
if (isNumber (_weaponConfig >> "ACE_twistDirection")) then {
2626
_twistDirection = getNumber (_weaponConfig >> "ACE_twistDirection");
2727
if !(_twistDirection in [-1, 0, 1]) then {

addons/aircraft/functions/fnc_droneSetWaypoint.sqf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ private _currentLoiterRadius = waypointLoiterRadius _waypoint;
2929
private _currentLoiterType = waypointLoiterType _waypoint;
3030

3131
// Set pos to ATL
32-
_pos set [2, if (_currentHeight >= 50) then { _currentHeight } else { 0 }];
32+
_pos set [
33+
2,
34+
[0, _currentHeight] select (_currentHeight >= 50)
35+
];
3336

3437
// [_group] call CBA_fnc_clearWaypoints;
3538
_waypoint = _group addWaypoint [_pos, 0];

addons/arsenal/functions/fnc_addStat.sqf

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,10 @@ private _tabToChange = [];
109109
{
110110
_x params ["_tab", "_tabSide"];
111111

112-
_tabToChange = if (_tabSide == "R") then {
112+
_tabToChange = [
113+
GVAR(statsListLeftPanel),
113114
GVAR(statsListRightPanel)
114-
} else {
115-
GVAR(statsListLeftPanel)
116-
};
115+
] select (_tabSide == "R");
117116

118117
_stats = _tabToChange select _tab;
119118

addons/arsenal/functions/fnc_fillRightPanel.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ private _fnc_fillRightContainer = {
8787
_ctrlPanel lnbSetText [[_lbAdd, 1], _displayName];
8888
_ctrlPanel lnbSetData [[_lbAdd, 0], _className];
8989
_ctrlPanel lnbSetPicture [[_lbAdd, 0], _picture];
90-
_ctrlPanel lnbSetValue [[_lbAdd, 2], [0, 1] select _isUnique];
90+
_ctrlPanel lnbSetValue [[_lbAdd, 2], parseNumber _isUnique];
9191
_ctrlPanel lnbSetTooltip [[_lbAdd, 0], format ["%1\n%2", _displayName, _className]];
9292
if ((toLower _className) in GVAR(favorites)) then {
9393
_ctrlPanel lnbSetColor [[_lbAdd, 1], FAVORITES_COLOR];

addons/arsenal/functions/fnc_onKeyDown.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ if (!isNull _loadoutsDisplay) then {
147147
// Right panel lnb + and - buttons
148148
case (_keyPressed in [DIK_LEFT, DIK_RIGHT]): {
149149
if (GVAR(rightTabLnBFocus)) then {
150-
[_display, [1, 0] select (_keyPressed == DIK_LEFT)] call FUNC(buttonCargo);
150+
[_display, parseNumber (_keyPressed != DIK_LEFT)] call FUNC(buttonCargo);
151151
};
152152
};
153153
};

addons/arsenal/functions/fnc_statTextStatement_illuminators.sqf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ if (_allItems isEqualTo []) then { _allItems = [configName _config] };
3131
|| {_illum && {([_xCfg >> "Flashlight" >> "irLight", "NUMBER", 0] call CBA_fnc_getConfigEntry) == 1}};
3232

3333
private _text = switch (true) do { // shorthand roughly based on PEQ-15
34-
case (_laser && _illum): { if (_isIR) then { "IR-DUAL" } else { "VIS-DUAL" } };
35-
case (_laser): { if (_isIR) then { "IR-AIM" } else { "VIS-AIM" } }; // AIM
36-
case (_illum): { if (_isIR) then { "IR-ILM" } else { "VIS-ILM" } }; // ILLUMIATION
34+
case (_laser && _illum): { ["VIS-DUAL", "IR-DUAL"] select _isIR }; // DUAL
35+
case (_laser): { ["VIS-AIM", "IR-AIM"] select _isIR }; // AIM
36+
case (_illum): { ["VIS-ILM", "IR-ILM"] select _isIR }; // ILLUMIATION
3737
default { "_" }; // there are some purely cosmetic attachements
3838
};
3939
_allModes pushBackUnique _text;

addons/arsenal/functions/fnc_verifyLoadout.sqf

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,7 @@ private _fnc_toConfigCase = {
4646

4747
// If item doesn't exist in config, "" is returned
4848
// Just return unaltered item name in that case, so it can be documented as being unavailable
49-
if (_name != "") then {
50-
_name
51-
} else {
52-
_x
53-
};
49+
[_x, _name] select (_name != "");
5450
} else {
5551
_x
5652
};

addons/artillerytables/functions/fnc_rangeTableOpen.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ GVAR(magModeData) = [];
6565
{
6666
_x params ["_xDisplayNameShort", "_xDisplayName", "_xInitSpeed", "_xAirFriction"];
6767
if (_allSameCharge) then {
68-
_ctrlChargeList lbAdd format ["%1", _xDisplayNameShort];
68+
_ctrlChargeList lbAdd _xDisplayNameShort;
6969
_ctrlChargeList lbSetTooltip [count GVAR(magModeData), format ["%1\n%2 m/s\n%3", _xDisplayName, _xInitSpeed toFixed 1, _xAirFriction]];
7070
GVAR(magModeData) pushBack [_xInitSpeed, _xAirFriction];
7171
} else {

addons/atragmx/functions/fnc_update_result.sqf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ if (GVAR(showWind2)) then {
9090

9191
_elevationAbs = Round(_elevationAbs * 100) / 100;
9292
if (_elevationAbs > 0) then {
93-
ctrlSetText [400, format["%1", abs(_elevationAbs)]];
93+
ctrlSetText [400, str abs _elevationAbs];
9494
} else {
9595
if (_elevationAbs < 0) then {
9696
ctrlSetText [400, format["%1D", abs(_elevationAbs)]];
@@ -100,7 +100,7 @@ if (_elevationAbs > 0) then {
100100
};
101101
_elevationRel = Round(_elevationRel * 100) / 100;
102102
if (_elevationRel > 0) then {
103-
ctrlSetText [401, format["%1", abs(_elevationRel)]];
103+
ctrlSetText [401, str abs _elevationRel];
104104
} else {
105105
if (_elevationRel < 0) then {
106106
ctrlSetText [401, format["%1D", abs(_elevationRel)]];
@@ -110,7 +110,7 @@ if (_elevationRel > 0) then {
110110
};
111111
_elevationCur = Round(_elevationCur * 100) / 100;
112112
if (_elevationCur > 0) then {
113-
ctrlSetText [402, format["%1", abs(_elevationCur)]];
113+
ctrlSetText [402, str abs _elevationCur];
114114
} else {
115115
if (_elevationCur < 0) then {
116116
ctrlSetText [402, format["%1D", abs(_elevationCur)]];

0 commit comments

Comments
 (0)