Skip to content

Commit

Permalink
Merge pull request #1647 from CBATeam/hemttCleanup
Browse files Browse the repository at this point in the history
General - Cleanup warnings for HEMTT
  • Loading branch information
PabstMirror committed Mar 2, 2024
2 parents 0e93bf0 + 36f3b9d commit a136100
Show file tree
Hide file tree
Showing 45 changed files with 110 additions and 109 deletions.
2 changes: 1 addition & 1 deletion addons/accessory/fnc_addAttachmentCondition.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Author:

params [["_item", "", [""]], ["_condition", {true}, [{}]]];

if (!isClass (configfile >> "CfgWeapons" >> _item)) exitWith { ERROR_1("Item not found [%1]", _item); };
if (!isClass (configfile >> "CfgWeapons" >> _item)) exitWith { ERROR_1("Item not found [%1]",_item); };

private _usageArray = GVAR(usageHash) getOrDefault [_item, [], true];
_usageArray pushBack _condition;
2 changes: 1 addition & 1 deletion addons/ai/fnc_taskDefend.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ if (_patrol isEqualType true) then {
};

if (_hold isEqualType true) then {
_hold = [0,1] select _hold;
_hold = parseNumber _hold;
};

// Start of the actual function
Expand Down
2 changes: 1 addition & 1 deletion addons/ai/fnc_taskSearchArea.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ _args params ["_area", "_behaviour", "_combat", "_speed", "_formation", "_onComp
private _pos = [_area] call CBA_fnc_randPosArea;

// Exit if any bad input was used (has to run after all the above code)
if ((_pos isEqualTo []) || {_area isEqualTo ""} || {isNull _group}) exitWith {ERROR_3("Bad Input [_pos: %1][_area: %2][_group: %3]", _pos, _area, _group);};
if ((_pos isEqualTo []) || {_area isEqualTo ""} || {isNull _group}) exitWith {ERROR_3("Bad Input [_pos: %1][_area: %2][_group: %3]",_pos,_area,_group);};

// Prepare recursive function call statement
private _statements = ["[this] call CBA_fnc_taskSearchArea"];
Expand Down
2 changes: 1 addition & 1 deletion addons/common/fnc_addPlayerAction.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private _return = if (isDedicated) then {
};
GVAR(actionListUpdated) = false;
[GVAR(actionList), {
TRACE_3("Inside the code for the hashPair",(vehicle player),GVAR(actionIndexes), _value);
TRACE_3("Inside the code for the hashPair",(vehicle player),GVAR(actionIndexes),_value);
if ((!isNil "_value") && {_value isEqualType []}) then {
GVAR(actionIndexes) pushBack (_curVic addAction _value);
};
Expand Down
2 changes: 1 addition & 1 deletion addons/common/init_addMiscItemsToArsenal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Author:

// We only need to directly add the items to the display list once per mission as we also modify the data array
if (missionNamespace getVariable [QGVAR(arsenalDataModified), false]) exitWith {
TRACE_1("Already set", bis_fnc_arsenal_data select 24);
TRACE_1("Already set",bis_fnc_arsenal_data select 24);
};


Expand Down
6 changes: 4 additions & 2 deletions addons/common/test_config.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ TEST_TRUE(_result isEqualTo [ARR_2("Single","FullAuto")],_funcName);
_result = ["arifle_MX_GL_F"] call CBA_fnc_getWeaponModes;
TEST_TRUE(_result isEqualTo [ARR_2("Single","FullAuto")],_funcName);

_result = ["arifle_MX_F", true] call CBA_fnc_getWeaponModes;
TEST_TRUE(_result isEqualTo [ARR_5("Single","FullAuto","fullauto_medium","single_medium_optics1","single_far_optics2")],_funcName);
if (!isClass (configFile >> "CfgPatches" >> "ace_ai")) then { // ace modifies config so don't bother when it's loaded
_result = ["arifle_MX_F", true] call CBA_fnc_getWeaponModes;
TEST_TRUE(_result isEqualTo [ARR_5("Single","FullAuto","fullauto_medium","single_medium_optics1","single_far_optics2")],_funcName);
};

_result = ["FirstAidKit", true] call CBA_fnc_getWeaponModes;
TEST_TRUE(_result isEqualTo ["FirstAidKit"],_funcName);
Expand Down
12 changes: 8 additions & 4 deletions addons/common/test_position.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ TEST_TRUE(_result isEqualTo EXPECTED,_funcName);

////////////////////////////////////////////////////////////////////////////////////////////////////
#undef EXPECTED
#define EXPECTED [1,2,0] // Pos 3D
// Pos 3D
#define EXPECTED [1,2,0]

_value = EXPECTED;
_result = _value call CBA_fnc_getPos;
Expand All @@ -51,7 +52,8 @@ TEST_TRUE(_result isEqualTo EXPECTED,_funcName);

////////////////////////////////////////////////////////////////////////////////////////////////////
#undef EXPECTED
#define EXPECTED [1,2] // Pos 2D
// Pos 2D
#define EXPECTED [1,2]

_value = EXPECTED;
_result = _value call CBA_fnc_getPos;
Expand All @@ -63,7 +65,8 @@ TEST_TRUE(_result isEqualTo EXPECTED,_funcName);

////////////////////////////////////////////////////////////////////////////////////////////////////
#undef EXPECTED
#define EXPECTED [1,1,0] //Pos nearest to [0,0,0]
//Pos nearest to [0,0,0]
#define EXPECTED [1,1,0]

_value = [[0,0,0], [[10,10,0],[1,1,0], [5,5,0]]];
_result = _value call CBA_fnc_getNearest;
Expand All @@ -72,7 +75,8 @@ TEST_TRUE(_result isEqualTo EXPECTED,_funcName);

////////////////////////////////////////////////////////////////////////////////////////////////////
#undef EXPECTED
#define EXPECTED [[1,1,0], [5,5,0]] //Pos within distance 10
//Pos within distance 10
#define EXPECTED [[1,1,0], [5,5,0]]

_value = [[0,0,0], [[30,30,0],[1,1,0], [5,5,0]], 10];
_result = _value call CBA_fnc_getNearest;
Expand Down
7 changes: 2 additions & 5 deletions addons/disposable/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,11 @@ private _cfgMagazines = configFile >> "CfgMagazines";
private _massUsedLauncher = getNumber (_cfgWeapons >> _usedLauncher >> "WeaponSlotsInfo" >> "mass");

if (_massLauncher != _massUsedLauncher) then {
WARNING_4("Mass of launcher %1 (%2) is different from mass of used launcher %3 (%4).", _launcher, _massLauncher, _usedLauncher, _massUsedLauncher);
WARNING_4("Mass of launcher %1 (%2) is different from mass of used launcher %3 (%4).",_launcher,_massLauncher,_usedLauncher,_massUsedLauncher);
};

if (_massLauncher + _massMagazine != _massLoadedLauncher) then {
WARNING_7("Sum of mass of launcher %1 and mass of magazine %2 (%3+%4=%5) is different from mass of loaded launcher %6 (%7).",
_launcher, _magazine, _massLauncher, _massMagazine, _massLauncher + _massMagazine,
_loadedLauncher, _massLoadedLauncher
);
WARNING_7("Sum of mass of launcher %1 and mass of magazine %2 (%3+%4=%5) is different from mass of loaded launcher %6 (%7).",_launcher,_magazine,_massLauncher,_massMagazine,_massLauncher + _massMagazine,_loadedLauncher,_massLoadedLauncher);
};
} forEach configProperties [configFile >> "CBA_DisposableLaunchers", "isArray _x"];

Expand Down
2 changes: 1 addition & 1 deletion addons/events/fnc_mouseWheelHandler.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SCRIPT(mouseWheelHandler);

params ["_display", "_inputDirection"];

private _inputDirection = [0, 1] select (_inputDirection < 0);
private _inputDirection = parseNumber (_inputDirection < 0);

[_display, MOUSE_WHEEL_OFFSET + _inputDirection, GVAR(shift), GVAR(control), GVAR(alt)] call FUNC(keyHandlerDown);
[_display, MOUSE_WHEEL_OFFSET + _inputDirection, GVAR(shift), GVAR(control), GVAR(alt)] call FUNC(keyHandlerUp);
2 changes: 1 addition & 1 deletion addons/jr/fnc_compatibleItems.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if (isNil QGVAR(namespace)) then {
};

// Get cached result, if it exists
private _cachekey = format ["%1#%2", _weapon, if (_typeFilterExists) then {_typefilter} else {"all"} ];
private _cachekey = format ["%1#%2", _weapon, ["all", _typefilter] select _typeFilterExists];
private _compatibleItems = GVAR(namespace) get _cachekey;

if (!isNil "_compatibleItems") exitWith {
Expand Down
2 changes: 1 addition & 1 deletion addons/music/fnc_getMusicData.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ params [
if (_config isEqualTo "") exitWith {ERROR("Config not given"); _default};
if (IS_STRING(_config)) then {_config = [_config] call CBA_fnc_getMusicPath;};

if ((isNil "_config") || {!IS_CONFIG(_config)}) exitWith {ERROR_1("Config not found for %1", _config); nil};
if ((isNil "_config") || {!IS_CONFIG(_config)}) exitWith {ERROR_1("Config not found for %1",_config); nil};

//Now we have a config, grab the data
private _return = [_config, _dataType, nil] call BIS_fnc_returnConfigEntry;
Expand Down
2 changes: 1 addition & 1 deletion addons/optics/fnc_animateScriptedOptic.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ _ctrlMagnification ctrlCommit 0;

// Calculate lighting.
private _dayOpacity = AMBIENT_BRIGHTNESS;
private _nightOpacity = [1,0] select (_dayOpacity == 1);
private _nightOpacity = parseNumber (_dayOpacity != 1);

private _useReticleNight = GVAR(useReticleNight);

Expand Down
2 changes: 1 addition & 1 deletion addons/settings/fnc_gui_settingOverwrite.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ _ctrlOverwriteMission ctrlAddEventHandler ["CheckedChanged", {
_ctrlOverwriteClient cbSetChecked _wasChecked;
_ctrlOverwriteClient ctrlEnable (_ctrlOverwriteClient getVariable [QGVAR(enabled), true]);

_state = [0, 1] select _wasChecked;
_state = parseNumber _wasChecked;
SET_TEMP_NAMESPACE_PRIORITY(_setting,_state,_source);
};

Expand Down
4 changes: 2 additions & 2 deletions addons/settings/fnc_set.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ switch (toLower _source) do {

if (_store) then {
if (!is3DEN) exitWith {
WARNING_1("Source is mission, but not in 3DEN editor. Setting: %1",_setting);
WARNING_1("Source is mission,but not in 3DEN editor. Setting: %1",_setting);
};

if (!isNil {GVAR(missionConfig) getVariable _setting}) exitWith {
Expand Down Expand Up @@ -135,7 +135,7 @@ switch (toLower _source) do {
if ([] call FUNC(whitelisted)) then {
[QGVAR(setSettingServer), [_setting, _value, _priority, _store]] call CBA_fnc_serverEvent;
} else {
WARNING_1("Source is server, but no admin access. Setting: %1",_setting);
WARNING_1("Source is server,but no admin access. Setting: %1",_setting);
_return = false;
};
};
Expand Down
12 changes: 6 additions & 6 deletions addons/settings/test_parse.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ _funcName = QFUNC(parse);
TEST_DEFINED(QFUNC(parse),"");

// Purposely weird formatting, must remain this way because newlines remain part of result
_settings = (preprocessFile "x\cba\addons\settings\test_settings_regular.sqf") call FUNC(parse);
_settings = (preprocessFile "x\cba\addons\settings\test_settings_regular.inc.sqf") call FUNC(parse);
_result = _settings isEqualTo [
["ace_advanced_ballistics_ammoTemperatureEnabled", true, 0],
["ace_advanced_ballistics_barrelLengthInfluenceEnabled", false, 2],
Expand All @@ -27,7 +27,7 @@ _result = _settings isEqualTo [
];
TEST_TRUE(_result,_funcName);

_settings = (preprocessFile "x\cba\addons\settings\test_settings_multiline.sqf") call FUNC(parse);
_settings = (preprocessFile "x\cba\addons\settings\test_settings_multiline.inc.sqf") call FUNC(parse);
_result = _settings isEqualTo [
["test1", "[
"" item_1 "",
Expand All @@ -51,11 +51,11 @@ _result = _settings isEqualTo [
];
TEST_TRUE(_result,_funcName);

_settings = (preprocessFile "x\cba\addons\settings\test_settings_unicode.sqf") call FUNC(parse);
_settings = (preprocessFile "x\cba\addons\settings\test_settings_unicode.inc.sqf") call FUNC(parse);
_result = _settings isEqualTo [["test1", "[Āā, Ăă, Ҙ, привет]", 1]];
TEST_TRUE(_result,_funcName);

_settings = (preprocessFile "x\cba\addons\settings\test_settings_strings.sqf") call FUNC(parse);
_settings = (preprocessFile "x\cba\addons\settings\test_settings_strings.inc.sqf") call FUNC(parse);
_result = _settings isEqualTo [
["test1", "", 0],
["test2", "", 0],
Expand All @@ -75,7 +75,7 @@ _result = _settings isEqualTo [
TEST_TRUE(_result,_funcName);

// Don't preprocess for testing comments
_settings = (loadFile "x\cba\addons\settings\test_settings_comments.sqf") call FUNC(parse);
_settings = (loadFile "x\cba\addons\settings\test_settings_comments.inc.sqf") call FUNC(parse);
_result = _settings isEqualTo [
["test2", "[true,false]", 1],
["test4", "[ ' t e s t ' , "" T E S T "" ]", 0],
Expand All @@ -85,7 +85,7 @@ _result = _settings isEqualTo [
];
TEST_TRUE(_result,_funcName);

_settings = (loadFile "x\cba\addons\settings\test_settings_comments_eof.sqf") call FUNC(parse);
_settings = (loadFile "x\cba\addons\settings\test_settings_comments_eof.inc.sqf") call FUNC(parse);
_result = _settings isEqualTo [
["test1", "[""item_1"",""item_2""]", 1]
];
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion addons/strings/fnc_prettyFormat.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ params [
["_depth", 0, [0]]
];

private _indents = STRING_REPEAT(_indent, _depth);
private _indents = STRING_REPEAT(_indent,_depth);

if (_array isEqualTo []) exitWith {
_indents + "[]" // return
Expand Down
40 changes: 20 additions & 20 deletions addons/strings/test_strings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -42,51 +42,51 @@ TEST_DEFINED("CBA_fnc_split","");

_array = ["", "\"] call CBA_fnc_split;
_expected = [];
TEST_OP(str _array, ==, str _expected, _fn);
TEST_OP(str _array,==,str _expected,_fn);

_array = ["", ""] call CBA_fnc_split;
_expected = [];
TEST_OP(str _array, ==, str _expected, _fn);
TEST_OP(str _array,==,str _expected,_fn);

_array = ["\", "\"] call CBA_fnc_split;
_expected = ["", ""];
TEST_OP(str _array, ==, str _expected, _fn);
TEST_OP(str _array,==,str _expected,_fn);

_array = ["\frog", "\"] call CBA_fnc_split;
_expected = ["", "frog"];
TEST_OP(str _array, ==, str _expected, _fn);
TEST_OP(str _array,==,str _expected,_fn);

_array = ["\frog\", "\"] call CBA_fnc_split;
_expected = ["", "frog", ""];
TEST_OP(str _array, ==, str _expected, _fn);
TEST_OP(str _array,==,str _expected,_fn);

_array = ["cheese\frog\fish", "\"] call CBA_fnc_split;
_expected = ["cheese", "frog", "fish"];
TEST_OP(str _array, ==, str _expected, _fn);
TEST_OP(str _array,==,str _expected,_fn);

_array = ["peas", ""] call CBA_fnc_split;
_expected = ["p", "e", "a", "s"];
TEST_OP(str _array, ==, str _expected, _fn);
TEST_OP(str _array,==,str _expected,_fn);

_array = ["abc", "abc"] call CBA_fnc_split;
_expected = ["", ""];
TEST_OP(str _array, ==, str _expected, _fn);
TEST_OP(str _array,==,str _expected,_fn);

_array = ["abc", "long"] call CBA_fnc_split;
_expected = ["abc"];
TEST_OP(str _array, ==, str _expected, _fn);
TEST_OP(str _array,==,str _expected,_fn);

_array = ["this\is\a\path\to\fnc_test.sqf","\fnc_"] call CBA_fnc_split;
_expected = ["this\is\a\path\to", "test.sqf"];
TEST_OP(str _array, ==, str _expected, _fn);
TEST_OP(str _array,==,str _expected,_fn);

_array = ["babab", "bab"] call CBA_fnc_split;
_expected = ["", "ab"];
TEST_OP(str _array, ==, str _expected, _fn);
TEST_OP(str _array,==,str _expected,_fn);

_array = ["BbabTabAbabbabababab", "bab"] call CBA_fnc_split;
_expected = ["B","TabA","","a","ab"];
TEST_OP(str _array, ==, str _expected, _fn);
TEST_OP(str _array,==,str _expected,_fn);

// ----------------------------------------------------------------------------
// UNIT TESTS (stringReplace)
Expand Down Expand Up @@ -275,28 +275,28 @@ _fn = "CBA_fnc_compare";
TEST_DEFINED("CBA_fnc_compare","");
_result = ["", ""] call CBA_fnc_compare;
TEST_OP(_result, ==, 0, _fn);
TEST_OP(_result,==,0,_fn);
_result = ["", "a"] call CBA_fnc_compare;
TEST_OP(_result, ==, -1, _fn);
TEST_OP(_result,==,-1,_fn);
_result = ["a", ""] call CBA_fnc_compare;
TEST_OP(_result, ==, +1, _fn);
TEST_OP(_result,==,+1,_fn);
_result = ["a", "a"] call CBA_fnc_compare;
TEST_OP(_result, ==, 0, _fn);
TEST_OP(_result,==,0,_fn);
_result = ["a", "b"] call CBA_fnc_compare;
TEST_OP(_result, ==, -1, _fn);
TEST_OP(_result,==,-1,_fn);
_result = ["b", "a"] call CBA_fnc_compare;
TEST_OP(_result, ==, +1, _fn);
TEST_OP(_result,==,+1,_fn);
_result = ["aardvark", "aardwolf"] call CBA_fnc_compare;
TEST_OP(_result, ==, -1, _fn);
TEST_OP(_result,==,-1,_fn);
_result = ["aardwolf", "aardvark"] call CBA_fnc_compare;
TEST_OP(_result, ==, +1, _fn);
TEST_OP(_result,==,+1,_fn);
*/

// ----------------------------------------------------------------------------
Expand Down
12 changes: 6 additions & 6 deletions addons/ui/flexiMenu/fnc_add.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ _msg = format ["Error: invalid params. %1 (%2)", _this, __FILE__];

if (isNil "_msg") then {_msg = "FLEXIMENU: Unknown Error in fnc_add.sqf"};
if (isNil QUOTE(GVAR(typeMenuSources))) exitWith {diag_log "Error: TypeMenuSources invalid"};
if (typeName _this != typeName []) exitWith {diag_log _msg};
if (typeName _this != "ARRAY") exitWith {diag_log _msg};
if (count _this < 4 || {count _this > 5}) exitWith {diag_log "Error: Too few or too many arguments"};
if !(toLower typeName (_this select _flexiMenu_typeMenuSources_ID_type) in [toLower typeName "", toLower typeName []]) exitWith {diag_log _msg};
if (typeName (_this select _flexiMenu_typeMenuSources_ID_DIKCodes) != typeName []) exitWith {diag_log _msg};
if (typeName (_this select _flexiMenu_typeMenuSources_ID_priority) != typeName 2) exitWith {diag_log _msg};
if !(typeName (_this select _flexiMenu_typeMenuSources_ID_menuSource) in [typeName [], typeName ""]) exitWith {diag_log _msg};
if !(toLower typeName (_this select _flexiMenu_typeMenuSources_ID_type) in [toLower "STRING", toLower "ARRAY"]) exitWith {diag_log _msg};
if (typeName (_this select _flexiMenu_typeMenuSources_ID_DIKCodes) != "ARRAY") exitWith {diag_log _msg};
if (typeName (_this select _flexiMenu_typeMenuSources_ID_priority) != "SCALAR") exitWith {diag_log _msg};
if !(typeName (_this select _flexiMenu_typeMenuSources_ID_menuSource) in ["ARRAY", "STRING"]) exitWith {diag_log _msg};

// common bug: invalid DIK code (type any) when missing #include "dikCodes.h"
//TODO: still not detecting nil?
Expand All @@ -32,7 +32,7 @@ if (count (_this select _flexiMenu_typeMenuSources_ID_DIKCodes) != 0) then {
for "_i" from 0 to (count (_this select _flexiMenu_typeMenuSources_ID_DIKCodes) - 1) do {
_key = (_this select _flexiMenu_typeMenuSources_ID_DIKCodes) select _i;
// if not an already an array (eg: simple DIK integer)
if (typeName _key != typeName []) then {
if (typeName _key != "ARRAY") then {
_key = [_key, [false, false, false]];
(_this select _flexiMenu_typeMenuSources_ID_DIKCodes) set [_i, _key];
};
Expand Down
2 changes: 1 addition & 1 deletion addons/ui/flexiMenu/fnc_execute.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ if (_subMenuSource != "") then {
// TODO: Find a way to combine the menu and list scripts together.
#define PATHTO_SUB(var1,var2,var3,var4) MAINPREFIX\##var1\SUBPREFIX\##var2\##var3\##var4.sqf
private _pathName = QUOTE(PATHTO_SUB(PREFIX,COMPONENT_F,flexiMenu,%1));
_pathName = format [_pathName, if (_useListBox == 0) then {'fnc_menu'} else {'fnc_list'}];
_pathName = format [_pathName, ["fnc_list", "fnc_menu"] select (_useListBox == 0)];

[GVAR(target), [[_subMenuSource, _params]]] call COMPILE_FILE2_SYS(_pathName);
// TODO: DEBUG switch to recompile menus always?
Expand Down
Loading

0 comments on commit a136100

Please sign in to comment.