From 3136ba80144c1b296c752c2f5ef180ed13505683 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 29 Feb 2024 15:19:20 -0600 Subject: [PATCH 1/3] General - Cleanup warnings for HEMTT --- .../accessory/fnc_addAttachmentCondition.sqf | 2 +- addons/ai/fnc_taskDefend.sqf | 2 +- addons/ai/fnc_taskSearchArea.sqf | 2 +- addons/common/fnc_addPlayerAction.sqf | 2 +- addons/common/init_addMiscItemsToArsenal.sqf | 2 +- addons/common/test_position.sqf | 12 ++++-- addons/disposable/XEH_preInit.sqf | 7 +--- addons/events/fnc_mouseWheelHandler.sqf | 2 +- addons/jr/fnc_compatibleItems.sqf | 2 +- addons/music/fnc_getMusicData.sqf | 2 +- addons/optics/fnc_animateScriptedOptic.sqf | 2 +- addons/settings/fnc_gui_settingOverwrite.sqf | 2 +- addons/settings/fnc_set.sqf | 4 +- addons/settings/test_parse.sqf | 12 +++--- ...nts.sqf => test_settings_comments.inc.sqf} | 0 ...sqf => test_settings_comments_eof.inc.sqf} | 0 ...ne.sqf => test_settings_multiline.inc.sqf} | 0 ...ular.sqf => test_settings_regular.inc.sqf} | 0 ...ings.sqf => test_settings_strings..incsqf} | 0 ...code.sqf => test_settings_unicode.inc.sqf} | 0 addons/strings/fnc_prettyFormat.sqf | 2 +- addons/strings/test_strings.sqf | 40 +++++++++---------- addons/ui/flexiMenu/fnc_add.sqf | 12 +++--- addons/ui/flexiMenu/fnc_execute.sqf | 2 +- addons/ui/flexiMenu/fnc_getMenuDef.sqf | 8 ++-- addons/ui/flexiMenu/fnc_getMenuOption.sqf | 24 +++++------ addons/ui/flexiMenu/fnc_keyDown.sqf | 5 +-- addons/ui/flexiMenu/fnc_list.sqf | 2 +- addons/ui/flexiMenu/fnc_menu.sqf | 8 ++-- addons/ui/flexiMenu/fnc_mouseButtonDown.sqf | 2 +- addons/ui/flexiMenu/fnc_openMenuByDef.sqf | 3 +- addons/ui/flexiMenu/fnc_remove.sqf | 10 ++--- addons/ui/fnc_getFov.sqf | 2 +- addons/vectors/test_vectors.sqf | 16 ++++---- addons/versioning/XEH_postInit.sqf | 2 +- addons/versioning/XEH_postInitClient.sqf | 2 +- addons/versioning/fnc_version_check.sqf | 2 +- addons/xeh/fnc_addClassEventHandler.sqf | 2 +- addons/xeh/fnc_compileEventHandlers.sqf | 2 +- addons/xeh/fnc_initDisplay3DEN.sqf | 2 +- addons/xeh/fnc_isRecompileEnabled.sqf | 2 +- addons/xeh/fnc_preInit.sqf | 2 +- addons/xeh/fnc_preStart.sqf | 4 +- addons/xeh/script_component.hpp | 2 +- 44 files changed, 106 insertions(+), 107 deletions(-) rename addons/settings/{test_settings_comments.sqf => test_settings_comments.inc.sqf} (100%) rename addons/settings/{test_settings_comments_eof.sqf => test_settings_comments_eof.inc.sqf} (100%) rename addons/settings/{test_settings_multiline.sqf => test_settings_multiline.inc.sqf} (100%) rename addons/settings/{test_settings_regular.sqf => test_settings_regular.inc.sqf} (100%) rename addons/settings/{test_settings_strings.sqf => test_settings_strings..incsqf} (100%) rename addons/settings/{test_settings_unicode.sqf => test_settings_unicode.inc.sqf} (100%) diff --git a/addons/accessory/fnc_addAttachmentCondition.sqf b/addons/accessory/fnc_addAttachmentCondition.sqf index fa0169aba2..cad7f8820b 100644 --- a/addons/accessory/fnc_addAttachmentCondition.sqf +++ b/addons/accessory/fnc_addAttachmentCondition.sqf @@ -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; diff --git a/addons/ai/fnc_taskDefend.sqf b/addons/ai/fnc_taskDefend.sqf index f3c311fa63..ee325bba4c 100644 --- a/addons/ai/fnc_taskDefend.sqf +++ b/addons/ai/fnc_taskDefend.sqf @@ -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 diff --git a/addons/ai/fnc_taskSearchArea.sqf b/addons/ai/fnc_taskSearchArea.sqf index f5be3b40a1..db3f5318d3 100644 --- a/addons/ai/fnc_taskSearchArea.sqf +++ b/addons/ai/fnc_taskSearchArea.sqf @@ -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"]; diff --git a/addons/common/fnc_addPlayerAction.sqf b/addons/common/fnc_addPlayerAction.sqf index 45465de09b..d59da6b5bb 100644 --- a/addons/common/fnc_addPlayerAction.sqf +++ b/addons/common/fnc_addPlayerAction.sqf @@ -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); }; diff --git a/addons/common/init_addMiscItemsToArsenal.sqf b/addons/common/init_addMiscItemsToArsenal.sqf index 68410966b1..d6769e45d3 100644 --- a/addons/common/init_addMiscItemsToArsenal.sqf +++ b/addons/common/init_addMiscItemsToArsenal.sqf @@ -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); }; diff --git a/addons/common/test_position.sqf b/addons/common/test_position.sqf index fabe0af65f..83967a2773 100644 --- a/addons/common/test_position.sqf +++ b/addons/common/test_position.sqf @@ -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; @@ -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; @@ -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; @@ -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; diff --git a/addons/disposable/XEH_preInit.sqf b/addons/disposable/XEH_preInit.sqf index 123957c902..fd5954f112 100644 --- a/addons/disposable/XEH_preInit.sqf +++ b/addons/disposable/XEH_preInit.sqf @@ -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"]; diff --git a/addons/events/fnc_mouseWheelHandler.sqf b/addons/events/fnc_mouseWheelHandler.sqf index 6dee4d0234..84ef1674d2 100644 --- a/addons/events/fnc_mouseWheelHandler.sqf +++ b/addons/events/fnc_mouseWheelHandler.sqf @@ -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); diff --git a/addons/jr/fnc_compatibleItems.sqf b/addons/jr/fnc_compatibleItems.sqf index fb2db72d4a..afe9556b05 100644 --- a/addons/jr/fnc_compatibleItems.sqf +++ b/addons/jr/fnc_compatibleItems.sqf @@ -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 { diff --git a/addons/music/fnc_getMusicData.sqf b/addons/music/fnc_getMusicData.sqf index c96bd632d3..23e27c52af 100644 --- a/addons/music/fnc_getMusicData.sqf +++ b/addons/music/fnc_getMusicData.sqf @@ -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; diff --git a/addons/optics/fnc_animateScriptedOptic.sqf b/addons/optics/fnc_animateScriptedOptic.sqf index 957a4a4fbb..658d1fc592 100644 --- a/addons/optics/fnc_animateScriptedOptic.sqf +++ b/addons/optics/fnc_animateScriptedOptic.sqf @@ -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); diff --git a/addons/settings/fnc_gui_settingOverwrite.sqf b/addons/settings/fnc_gui_settingOverwrite.sqf index b4bee7dcbf..c43f3bb7b7 100644 --- a/addons/settings/fnc_gui_settingOverwrite.sqf +++ b/addons/settings/fnc_gui_settingOverwrite.sqf @@ -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); }; diff --git a/addons/settings/fnc_set.sqf b/addons/settings/fnc_set.sqf index 1ace681f5a..6563dd0cc5 100644 --- a/addons/settings/fnc_set.sqf +++ b/addons/settings/fnc_set.sqf @@ -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 { @@ -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; }; }; diff --git a/addons/settings/test_parse.sqf b/addons/settings/test_parse.sqf index fbcc49b7fe..162b1813b7 100644 --- a/addons/settings/test_parse.sqf +++ b/addons/settings/test_parse.sqf @@ -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], @@ -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 "", @@ -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], @@ -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], @@ -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] ]; diff --git a/addons/settings/test_settings_comments.sqf b/addons/settings/test_settings_comments.inc.sqf similarity index 100% rename from addons/settings/test_settings_comments.sqf rename to addons/settings/test_settings_comments.inc.sqf diff --git a/addons/settings/test_settings_comments_eof.sqf b/addons/settings/test_settings_comments_eof.inc.sqf similarity index 100% rename from addons/settings/test_settings_comments_eof.sqf rename to addons/settings/test_settings_comments_eof.inc.sqf diff --git a/addons/settings/test_settings_multiline.sqf b/addons/settings/test_settings_multiline.inc.sqf similarity index 100% rename from addons/settings/test_settings_multiline.sqf rename to addons/settings/test_settings_multiline.inc.sqf diff --git a/addons/settings/test_settings_regular.sqf b/addons/settings/test_settings_regular.inc.sqf similarity index 100% rename from addons/settings/test_settings_regular.sqf rename to addons/settings/test_settings_regular.inc.sqf diff --git a/addons/settings/test_settings_strings.sqf b/addons/settings/test_settings_strings..incsqf similarity index 100% rename from addons/settings/test_settings_strings.sqf rename to addons/settings/test_settings_strings..incsqf diff --git a/addons/settings/test_settings_unicode.sqf b/addons/settings/test_settings_unicode.inc.sqf similarity index 100% rename from addons/settings/test_settings_unicode.sqf rename to addons/settings/test_settings_unicode.inc.sqf diff --git a/addons/strings/fnc_prettyFormat.sqf b/addons/strings/fnc_prettyFormat.sqf index bfef377751..cad7700ff1 100644 --- a/addons/strings/fnc_prettyFormat.sqf +++ b/addons/strings/fnc_prettyFormat.sqf @@ -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 diff --git a/addons/strings/test_strings.sqf b/addons/strings/test_strings.sqf index 269b67bbaa..c0c2bfccfc 100644 --- a/addons/strings/test_strings.sqf +++ b/addons/strings/test_strings.sqf @@ -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) @@ -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); */ // ---------------------------------------------------------------------------- diff --git a/addons/ui/flexiMenu/fnc_add.sqf b/addons/ui/flexiMenu/fnc_add.sqf index c3ee34b73c..d37917c290 100644 --- a/addons/ui/flexiMenu/fnc_add.sqf +++ b/addons/ui/flexiMenu/fnc_add.sqf @@ -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? @@ -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]; }; diff --git a/addons/ui/flexiMenu/fnc_execute.sqf b/addons/ui/flexiMenu/fnc_execute.sqf index 06793a0967..44ad764471 100644 --- a/addons/ui/flexiMenu/fnc_execute.sqf +++ b/addons/ui/flexiMenu/fnc_execute.sqf @@ -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? diff --git a/addons/ui/flexiMenu/fnc_getMenuDef.sqf b/addons/ui/flexiMenu/fnc_getMenuDef.sqf index 10a89f5d98..ccadfd2679 100644 --- a/addons/ui/flexiMenu/fnc_getMenuDef.sqf +++ b/addons/ui/flexiMenu/fnc_getMenuDef.sqf @@ -19,14 +19,14 @@ private _menuDefs = []; private _menuParams = [_target]; // Syntax 1 - if (typeName _params == typeName "") then { + if (typeName _params == "STRING") then { _menuSource = _params; }; // Syntax 2 - if (typeName _params == typeName [] && {count _params > 0}) then { + if (typeName _params == "ARRAY" && {count _params > 0}) then { _menuSource = _params select 0; - if (typeName _menuSource == typeName "") then { // check for syntax: function, code string or sqf filename + if (typeName _menuSource == "STRING") then { // check for syntax: function, code string or sqf filename _menuParams = if (count _params > 1) then {[_target, _params select 1]}; } else { _menuSource = _params; @@ -36,7 +36,7 @@ private _menuDefs = []; TRACE_1("",_menuSource); //----------------------------------------------------------------------------- // determine if string represents an executable statement or actual data (via variable). - if (typeName _menuSource == typeName []) then { + if (typeName _menuSource == "ARRAY") then { // _menuSource is _menuDefs. a single menuDef array LOG("_menuSource Single Definition"); _menuDef = _menuSource; //somtimes Nil diff --git a/addons/ui/flexiMenu/fnc_getMenuOption.sqf b/addons/ui/flexiMenu/fnc_getMenuOption.sqf index 0c98ba8869..2708501451 100644 --- a/addons/ui/flexiMenu/fnc_getMenuOption.sqf +++ b/addons/ui/flexiMenu/fnc_getMenuOption.sqf @@ -17,7 +17,7 @@ IfCountDefault(_fastPartialResult,_this,2,false); // return a faster partial res IfCountDefault(_iconFolder,_menuDefs0,_flexiMenu_menuProperty_ID_iconFolder,""); // base icon folder (eg: "\ca\ui\data\") IfCountDefault(_multiReselect,_menuDefs0,_flexiMenu_menuProperty_ID_multiReselect,0); // menuStayOpenUponSelect: 0/1 type boolean -if (typeName _multiReselect == typeName true) then {_multiReselect = if (_multiReselect) then {1} else {0}}; // convert boolean to integer +if (typeName _multiReselect == "BOOL") then {_multiReselect = parseNumber _multiReselect}; // convert boolean to integer _caption = ""; IfCountDefault(_action,_menuDef,_flexiMenu_menuDef_ID_action,""); @@ -36,17 +36,17 @@ IfCountDefault(_tooltip,_menuDef,_flexiMenu_menuDef_ID_tooltip,""); IfCountDefault(_enabled,_menuDef,_flexiMenu_menuDef_ID_enabled,1); if (isNil "_enabled") then { hint ("Error logged: 'enabled' menu property returned nil.\n\n" + format ["Source data: %1", _this]); - ERROR_WITH_TITLE("'enabled' menu property returned nil.", str _this); + ERROR_WITH_TITLE("'enabled' menu property returned nil.",str _this); _enabled = 0; _caption = "Error: " + _caption; }; -if (typeName _enabled != typeName 2) then { +if (typeName _enabled != "SCALAR") then { switch (true) do { - case (typeName _enabled == typeName ""): { + case (typeName _enabled == "STRING"): { _enabled = parseNumber _enabled; // allow "0"/"1" like BIS does }; - case (typeName _enabled == typeName true): { - _enabled = if (_enabled) then {1} else {0}; // convert boolean to number + case (typeName _enabled == "BOOL"): { + _enabled = parseNumber _enabled; // convert boolean to number }; }; }; @@ -55,17 +55,17 @@ if (typeName _enabled != typeName 2) then { IfCountDefault(_visible,_menuDef,_flexiMenu_menuDef_ID_visible,1); if (isNil "_visible") then { hint ("Error logged: 'visible' menu property returned nil.\n\n" + format["Source data: %1", _this]); - ERROR_WITH_TITLE("'visible' menu property returned nil.", str _this); + ERROR_WITH_TITLE("'visible' menu property returned nil.",str _this); _visible = 0; _caption = "Error: " + _caption; }; -if (typeName _visible != typeName 2) then { +if (typeName _visible != "SCALAR") then { switch (true) do { - case (typeName _visible == typeName ""): { + case (typeName _visible == "STRING"): { _visible = parseNumber _visible; // allow "0"/"1"/"2" like BIS does }; - case (typeName _visible == typeName true): { - _visible = if (_visible) then {1} else {0}; + case (typeName _visible == "BOOL"): { + _visible = parseNumber _visible; }; }; }; @@ -117,7 +117,7 @@ if (_index >= 0) then { if (_enabled != 0) then { // TODO: Read an appropriate color from the menu class. - private _offset = (if (_containCaret) then {1} else {0}); + private _offset = parseNumber _containCaret; if (!_fastPartialResult) then { _caption = [_array, _index, _offset, format ["", GVAR(hotKeyColor)]] call FUNC(highlightCaretKey); }; diff --git a/addons/ui/flexiMenu/fnc_keyDown.sqf b/addons/ui/flexiMenu/fnc_keyDown.sqf index af49a868ec..35bbda7e42 100644 --- a/addons/ui/flexiMenu/fnc_keyDown.sqf +++ b/addons/ui/flexiMenu/fnc_keyDown.sqf @@ -99,8 +99,7 @@ if (!GVAR(optionSelected) || !GVAR(holdKeyDown)) then { if (({_potentialTarget isKindOf _x} count _typesList > 0) || {({_vehicleTarget isKindOf _x} count _typesList > 0)} || {("player" in _typesList)}) then { if (count _potentialMenuSources == 0) then { _isTypeTarget = true; - _target = if ((_vehicleTarget != player) && - {({_vehicleTarget isKindOf _x} count _typesList > 0)}) then {_vehicleTarget} else {_potentialTarget}; + _target = [_potentialTarget, _vehicleTarget] select ((_vehicleTarget != player) && {({_vehicleTarget isKindOf _x} count _typesList > 0)}); if ("player" in _typesList) then { _target = player; }; @@ -119,7 +118,7 @@ if (!GVAR(optionSelected) || !GVAR(holdKeyDown)) then { _menuSources pushBack _x; } forEach _potentialMenuSources; - TRACE_2("",_target, _menuSources); + TRACE_2("",_target,_menuSources); if (count _menuSources > 0) then { // show menu dialog and load menu data GVAR(target) = _target; // global variable used since passing an object as a string is too difficult. diff --git a/addons/ui/flexiMenu/fnc_list.sqf b/addons/ui/flexiMenu/fnc_list.sqf index d19865c847..21dd924191 100644 --- a/addons/ui/flexiMenu/fnc_list.sqf +++ b/addons/ui/flexiMenu/fnc_list.sqf @@ -23,7 +23,7 @@ private _menuRsc = _menuDefs select 0 select _flexiMenu_menuProperty_ID_menuReso private _msg = format ["%1: Invalid params c4: %2", __FILE__, _this]; if (isNil "_msg") then {_msg = "FLEXIMENU: Unknown Error in fnc_list.sqf"}; -if (typeName _menuRsc != typeName "") exitWith {diag_log _msg}; +if (typeName _menuRsc != "STRING") exitWith {diag_log _msg}; if (!isClass (configFile >> _menuRsc) && {!isClass (missionConfigFile >> _menuRsc)}) then { // if not a full class name _menuRsc = __menuRscPrefix + _menuRsc; // attach standard flexi menu prefix diff --git a/addons/ui/flexiMenu/fnc_menu.sqf b/addons/ui/flexiMenu/fnc_menu.sqf index c5997cda5e..8809ff986b 100644 --- a/addons/ui/flexiMenu/fnc_menu.sqf +++ b/addons/ui/flexiMenu/fnc_menu.sqf @@ -96,8 +96,8 @@ _msg = ""; _msg = format ["%1: Invalid params type: %2", __FILE__, _this]; if (isNil "_msg") then {_msg = "FLEXIMENU: Unknown Error in fnc_menu.sqf"}; -if !(typeName _this in [typeName [], typeName ""]) exitWith {diag_log _msg}; -TRACE_2("INPUT Params",_this select 0, _this select 1); +if !(typeName _this in ["ARRAY", "STRING"]) exitWith {diag_log _msg}; +TRACE_2("INPUT Params",_this select 0,_this select 1); _menuDefs = _this call FUNC(getMenuDef); TRACE_1("Get Menu Defs",_menuDefs); @@ -105,7 +105,7 @@ TRACE_1("Get Menu Defs",_menuDefs); //Array must be returned. if (isNil "_menuDefs") then {diag_log format ["%1: Nil Warning: Expected type array from _menuDefs from target: %2 from source: %3", __FILE__, _this select 0, _this select 1]}; -if (typeName _menuDefs != typeName []) exitWith {diag_log format ["%1: Invalid params c5: %2", __FILE__, _this]}; +if (typeName _menuDefs != "ARRAY") exitWith {diag_log format ["%1: Invalid params c5: %2", __FILE__, _this]}; // Empty Array is allowed to signify that nothing should happen if (count _menuDefs == 0) exitWith { @@ -120,7 +120,7 @@ _menuRsc = _menuDefs select 0 select _flexiMenu_menuProperty_ID_menuResource; // TRACE_2("Determined which dialog to show",_flexiMenu_menuProperty_ID_menuResource,_menuRsc); -if (typeName _menuRsc != typeName "") exitWith {diag_log format ["%1: Invalid params c4: %2", __FILE__, _this]}; +if (typeName _menuRsc != "STRING") exitWith {diag_log format ["%1: Invalid params c4: %2", __FILE__, _this]}; if (!isClass (configFile >> _menuRsc) && {!isClass (missionConfigFile >> _menuRsc)}) then { // if not a full class name _menuRsc = __menuRscPrefix + _menuRsc; // attach standard flexi menu prefix }; diff --git a/addons/ui/flexiMenu/fnc_mouseButtonDown.sqf b/addons/ui/flexiMenu/fnc_mouseButtonDown.sqf index 6a541526ed..0d8b531ca7 100644 --- a/addons/ui/flexiMenu/fnc_mouseButtonDown.sqf +++ b/addons/ui/flexiMenu/fnc_mouseButtonDown.sqf @@ -14,7 +14,7 @@ if (dialog && {!GVAR(holdKeyDown)} && {_button == _rightMouseButton} && {!_shift // [interactKey] + shift + right click to toggle menu lock if (_button == _rightMouseButton && {_shiftKey}) then { GVAR(holdKeyDown) = !GVAR(holdKeyDown); - hint format ["Menu lock toggled %1", (if (GVAR(holdKeyDown)) then {"off"} else {"on"})]; + hint format ["Menu lock toggled %1", ["on", "off"] select GVAR(holdKeyDown)]; if (dialog) then { closeDialog 0; }; diff --git a/addons/ui/flexiMenu/fnc_openMenuByDef.sqf b/addons/ui/flexiMenu/fnc_openMenuByDef.sqf index f0e06bbca4..28310bd304 100644 --- a/addons/ui/flexiMenu/fnc_openMenuByDef.sqf +++ b/addons/ui/flexiMenu/fnc_openMenuByDef.sqf @@ -66,8 +66,7 @@ if (!GVAR(optionSelected) || !GVAR(holdKeyDown)) then { if (({_potentialTarget isKindOf _x} count _typesList > 0) || {({_vehicleTarget isKindOf _x} count _typesList > 0)} || {("player" in _typesList)}) then { if (count _potentialMenuSources == 0) then { _isTypeTarget = true; - _target = if ((_vehicleTarget != player) && - {({_vehicleTarget isKindOf _x} count _typesList > 0)}) then {_vehicleTarget} else {_potentialTarget}; + _target = [_potentialTarget, _vehicleTarget] select ((_vehicleTarget != player) && {({_vehicleTarget isKindOf _x} count _typesList > 0)}); if ("player" in _typesList) then { _target = player; }; diff --git a/addons/ui/flexiMenu/fnc_remove.sqf b/addons/ui/flexiMenu/fnc_remove.sqf index 38ced8aa42..1fe6989013 100644 --- a/addons/ui/flexiMenu/fnc_remove.sqf +++ b/addons/ui/flexiMenu/fnc_remove.sqf @@ -9,12 +9,12 @@ _msg = format ["Error: invalid params. %1 (%2)", _this, __FILE__ ]; if (isNil "_msg") then {_msg = "FLEXIMENU: Unknown Error in fnc_remove.sqf"}; if (isNil QGVAR(typeMenuSources)) exitWith {diag_log _msg}; -if (typeName _this != typeName []) exitWith {diag_log _msg}; +if (typeName _this != "ARRAY") exitWith {diag_log _msg}; if (count _this != 5) exitWith {diag_log _msg}; -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}; private _i = 0; { diff --git a/addons/ui/fnc_getFov.sqf b/addons/ui/fnc_getFov.sqf index d4ad1b71aa..6e6c7fb9ac 100644 --- a/addons/ui/fnc_getFov.sqf +++ b/addons/ui/fnc_getFov.sqf @@ -25,7 +25,7 @@ Authors: streamlined by commy2 ---------------------------------------------------------------------------- */ -private _baseFOV = if (IS_SCALAR(_this)) then {_this} else {0.75}; +private _baseFOV = [0.75, _this] select (IS_SCALAR(_this)); private _trigRatio = safeZoneW / 2 / ((worldToScreen positionCameraToWorld [10000, 0, 10000] select 0) - 0.5); diff --git a/addons/vectors/test_vectors.sqf b/addons/vectors/test_vectors.sqf index 986e6fc727..90c409a677 100644 --- a/addons/vectors/test_vectors.sqf +++ b/addons/vectors/test_vectors.sqf @@ -27,7 +27,7 @@ private _fnc_matrixEquals = { if ((count _matrix1) != (count _matrix2)) exitWith {false}; private _equal = true; { - if !([ARR_2(_x, _matrix2 select _forEachIndex)] call _fnc_vectorEquals) exitWith { + if !([ARR_2(_x,_matrix2 select _forEachIndex)] call _fnc_vectorEquals) exitWith { _equal = false; }; } forEach _matrix1; @@ -303,12 +303,12 @@ TEST_TRUE([ARR_2(_result,_expected)] call _fnc_vectorEquals,_fn); _expected = [100,30,45]; private _temp = (+_expected) call CBA_fnc_polar2vect; _result = _temp call CBA_fnc_vect2Polar; -TEST_TRUE([ARR_2(_result,_expected)] call _fnc_vectorEquals, "complex polar 1"); +TEST_TRUE([ARR_2(_result,_expected)] call _fnc_vectorEquals,"complex polar 1"); _expected = [1,4,-9]; _temp = (+_expected) call CBA_fnc_vect2Polar; _result = _temp call CBA_fnc_polar2vect; -TEST_TRUE([ARR_2(_result,_expected)] call _fnc_vectorEquals, "complex polar 2"); +TEST_TRUE([ARR_2(_result,_expected)] call _fnc_vectorEquals,"complex polar 2"); // UNIT TESTS (vectMap3D) @@ -317,11 +317,11 @@ TEST_DEFINED("CBA_fnc_vectMap3D",""); _result = [[[0,1,0],[0,0,1],[1,0,0]], [1,2,3]] call CBA_fnc_vectMap3D; _expected = [2,3,1]; -TEST_TRUE([ARR_2(_result,_expected)] call _fnc_vectorEquals, _fn); +TEST_TRUE([ARR_2(_result,_expected)] call _fnc_vectorEquals,_fn); _result = [[[1,2,5],[2,-1,3],[5,6,-1]], [1,2,3]] call CBA_fnc_vectMap3D; _expected = [20,9,14]; -TEST_TRUE([ARR_2(_result,_expected)] call _fnc_vectorEquals, _fn); +TEST_TRUE([ARR_2(_result,_expected)] call _fnc_vectorEquals,_fn); // UNIT TESTS (matrixTranspose) _fn = "CBA_fnc_matrixTranspose"; @@ -329,7 +329,7 @@ TEST_DEFINED("CBA_fnc_matrixTranspose",""); _result = [[[1,2,5],[-2,4,3],[5,6,8]]] call CBA_fnc_matrixTranspose; _expected = [[1,-2,5],[2,4,6],[5,3,8]]; -TEST_TRUE([ARR_2(_result,_expected)] call _fnc_matrixEquals, _fn); +TEST_TRUE([ARR_2(_result,_expected)] call _fnc_matrixEquals,_fn); // UNIT TESTS (matrixProduct3D) _fn = "CBA_fnc_matrixProduct3D"; @@ -337,13 +337,13 @@ TEST_DEFINED("CBA_fnc_matrixProduct3D",""); _result = [[[1,2,5],[2,-1,3],[5,6,-1]], [[1,2,3],[3,1,2],[2,3,1]]] call CBA_fnc_matrixProduct3D; _expected = [[17,19,12],[5,12,7],[21,13,26]]; -TEST_TRUE([ARR_2(_result,_expected)] call _fnc_matrixEquals, _fn); +TEST_TRUE([ARR_2(_result,_expected)] call _fnc_matrixEquals,_fn); private _orthogonalMatrix = [[2/3,-1/3,2/3],[2/3,2/3,-1/3],[-1/3,2/3,2/3]]; private _orthogonalMatrixTransposed = [_orthogonalMatrix] call CBA_fnc_matrixTranspose; _result = [_orthogonalMatrix, _orthogonalMatrixTransposed] call CBA_fnc_matrixProduct3D; _expected = [[1,0,0],[0,1,0],[0,0,1]]; -TEST_TRUE([ARR_2(_result,_expected)] call _fnc_matrixEquals, _fn); +TEST_TRUE([ARR_2(_result,_expected)] call _fnc_matrixEquals,_fn); nil; diff --git a/addons/versioning/XEH_postInit.sqf b/addons/versioning/XEH_postInit.sqf index 517ddabab7..65c5860c6f 100644 --- a/addons/versioning/XEH_postInit.sqf +++ b/addons/versioning/XEH_postInit.sqf @@ -11,7 +11,7 @@ if (!SLX_XEH_DisableLogging) then { [GVAR(versions), { _logMsgs pushBack format["%1=%2", _key, ([_value select 0, _filter] call CBA_fnc_filter) joinString "."]}] call CBA_fnc_hashEachPair; private _logMsg = _logMsgs joinString ", "; - INFO_2("%1 VERSIONING:%2", [ARR_3(diag_frameNo, diag_tickTime, time)], _logMsg); + INFO_2("%1 VERSIONING:%2",[ARR_3(diag_frameNo,diag_tickTime,time)],_logMsg); }; // Dependency check and warn diff --git a/addons/versioning/XEH_postInitClient.sqf b/addons/versioning/XEH_postInitClient.sqf index 1b521466cc..e1f0970dda 100644 --- a/addons/versioning/XEH_postInitClient.sqf +++ b/addons/versioning/XEH_postInitClient.sqf @@ -9,7 +9,7 @@ SLX_XEH_STR spawn { [GVAR(versions_serv), { _logMsgs pushBack format["%1=%2", _key, (_value select 0) joinString "."]}] call CBA_fnc_hashEachPair; private _logMsg = _logMsgs joinString ", "; - INFO_2("%1 VERSIONING_SERVER:%2", [ARR_3(diag_frameNo, diag_tickTime, time)], _logMsg); + INFO_2("%1 VERSIONING_SERVER:%2",[ARR_3(diag_frameNo,diag_tickTime,time)],_logMsg); }; [GVAR(versions_serv), {call FUNC(version_check)}] call CBA_fnc_hashEachPair; }; diff --git a/addons/versioning/fnc_version_check.sqf b/addons/versioning/fnc_version_check.sqf index c07b514594..a216462281 100644 --- a/addons/versioning/fnc_version_check.sqf +++ b/addons/versioning/fnc_version_check.sqf @@ -11,7 +11,7 @@ _value params ["_remoteVersion", "_level"]; private _lc = count _localVersion; private _rc = count _remoteVersion; switch _level do { case -1: { _level = _rc }; // All must match - case -2: { _level = if (_lc == 0) then { 0 } else { _rc } }; // All must match, IF the addon is installed, otherwise ignore + case -2: { _level = [_rc, 0] select (_lc == 0) }; // All must match, IF the addon is installed, otherwise ignore }; if (_level == 0) exitWith {}; diff --git a/addons/xeh/fnc_addClassEventHandler.sqf b/addons/xeh/fnc_addClassEventHandler.sqf index 03ad03c19c..726514b6c4 100644 --- a/addons/xeh/fnc_addClassEventHandler.sqf +++ b/addons/xeh/fnc_addClassEventHandler.sqf @@ -33,7 +33,7 @@ private _config = configFile >> "CfgVehicles" >> _className; // init fallback loop when executing on incompatible class for the first time if (!GVAR(fallbackRunning) && {ISINCOMP(_className)}) then { - WARNING_1("One or more children of class %1 do not support Extended Event Handlers. Fall back to loop.", configName _config); + WARNING_1("One or more children of class %1 do not support Extended Event Handlers. Fall back to loop.",configName _config); call CBA_fnc_startFallbackLoop; }; diff --git a/addons/xeh/fnc_compileEventHandlers.sqf b/addons/xeh/fnc_compileEventHandlers.sqf index 939ae188c4..25cae376db 100644 --- a/addons/xeh/fnc_compileEventHandlers.sqf +++ b/addons/xeh/fnc_compileEventHandlers.sqf @@ -125,7 +125,7 @@ if (_allowRecompile) then { if (_eventName == "fired") then { // generate backwards compatible format of _this _eventFuncBase = "private _this = [_this select 0, _this select 1, _this select 2, _this select 3, _this select 4, _this select 6, _this select 5];"; - WARNING_4("Usage of deprecated Extended Event Handler ""fired"". Use ""firedBIS"" instead. Path: %1\%2\%3\%4.", configSourceMod _x, _baseConfig, XEH_FORMAT_CONFIG_NAME(_eventName), _className); + WARNING_4("Usage of deprecated Extended Event Handler ""fired"". Use ""firedBIS"" instead. Path: %1\%2\%3\%4.",configSourceMod _x,_baseConfig,XEH_FORMAT_CONFIG_NAME(_eventName),_className); }; { diff --git a/addons/xeh/fnc_initDisplay3DEN.sqf b/addons/xeh/fnc_initDisplay3DEN.sqf index 9534f5d044..f47b106f79 100644 --- a/addons/xeh/fnc_initDisplay3DEN.sqf +++ b/addons/xeh/fnc_initDisplay3DEN.sqf @@ -4,7 +4,7 @@ params ["_display"]; private _fnc_watchDog = { if (!ISPROCESSED(missionNamespace)) then { - INFO_1("missionNamespace processed [%1]", ISPROCESSED(missionNamespace)); + INFO_1("missionNamespace processed [%1]",ISPROCESSED(missionNamespace)); [] call CBA_fnc_preInit; }; }; diff --git a/addons/xeh/fnc_isRecompileEnabled.sqf b/addons/xeh/fnc_isRecompileEnabled.sqf index 2ced9f14d0..7229818120 100644 --- a/addons/xeh/fnc_isRecompileEnabled.sqf +++ b/addons/xeh/fnc_isRecompileEnabled.sqf @@ -33,7 +33,7 @@ if (isNil "_return") then { // Normally, full caching is enabled. If not, log an informative message. if (_return) then { - XEH_LOG(PFORMAT_1("CBA CACHE DISABLED? (Disable caching with cba_cache_disable.pbo)", _compileType)); + XEH_LOG(PFORMAT_1("CBA CACHE DISABLED? (Disable caching with cba_cache_disable.pbo)",_compileType)); }; }; diff --git a/addons/xeh/fnc_preInit.sqf b/addons/xeh/fnc_preInit.sqf index 7a57e6e518..e0cac3c1e6 100644 --- a/addons/xeh/fnc_preInit.sqf +++ b/addons/xeh/fnc_preInit.sqf @@ -41,7 +41,7 @@ SLX_XEH_MACHINE = [ // backwards compatibility, deprecated false, // 7 - PreInit passed false, // 8 - PostInit passed isMultiplayer, // 9 - Multiplayer && respawn - if (isDedicated) then {0} else {if (isServer) then {1} else {2}}, // 10 - Machine type (only 3 possible configurations) + if (isDedicated) then {0} else {[2, 1] select isServer}, // 10 - Machine type (only 3 possible configurations) 0, // 11 - SESSION_ID 0, // 12 - LEVEL - Used for version determination false, // 13 - TIMEOUT - PostInit timedOut, always false diff --git a/addons/xeh/fnc_preStart.sqf b/addons/xeh/fnc_preStart.sqf index 832e3b0ae2..aed10d34e5 100644 --- a/addons/xeh/fnc_preStart.sqf +++ b/addons/xeh/fnc_preStart.sqf @@ -60,9 +60,9 @@ with uiNamespace do { _x params ["_classname", "_addon"]; if (_addon == "") then { - WARNING_1("%1 does not support Extended Event Handlers!", _classname); + WARNING_1("%1 does not support Extended Event Handlers!",_classname); } else { - WARNING_2("%1 does not support Extended Event Handlers! Addon: %2", _classname, _addon); + WARNING_2("%1 does not support Extended Event Handlers! Addon: %2",_classname,_addon); }; } forEach (true call CBA_fnc_supportMonitor); diff --git a/addons/xeh/script_component.hpp b/addons/xeh/script_component.hpp index 12b163f39a..b938db0165 100644 --- a/addons/xeh/script_component.hpp +++ b/addons/xeh/script_component.hpp @@ -14,7 +14,7 @@ #define DEBUG_SYNCHRONOUS #include "\x\cba\addons\main\script_macros.hpp" -#define XEH_LOG(msg) if (!SLX_XEH_DisableLogging) then { INFO_2("%1 %2",[ARR_3(diag_frameNo, diag_tickTime, time)], msg); } +#define XEH_LOG(msg) if (!SLX_XEH_DisableLogging) then { INFO_2("%1 %2",[ARR_3(diag_frameNo,diag_tickTime,time)],msg); } #define SYS_EVENTHANDLERS(type,class) format [QGVAR(%1:%2), type, class] #define EVENTHANDLERS(type,class) (missionNamespace getVariable [SYS_EVENTHANDLERS(type,class), []]) From cb999dc300a12b4224c1790414941337299ac5b4 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 29 Feb 2024 15:26:05 -0600 Subject: [PATCH 2/3] Common - Skip static config test when ace loaded --- addons/common/test_config.sqf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/common/test_config.sqf b/addons/common/test_config.sqf index 1379764452..5a436b95c7 100644 --- a/addons/common/test_config.sqf +++ b/addons/common/test_config.sqf @@ -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); From 36f3b9d48e50a7f42933e156c78b3016f508a2de Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 29 Feb 2024 16:05:02 -0600 Subject: [PATCH 3/3] fix inc --- ...est_settings_strings..incsqf => test_settings_strings.inc.sqf} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename addons/settings/{test_settings_strings..incsqf => test_settings_strings.inc.sqf} (100%) diff --git a/addons/settings/test_settings_strings..incsqf b/addons/settings/test_settings_strings.inc.sqf similarity index 100% rename from addons/settings/test_settings_strings..incsqf rename to addons/settings/test_settings_strings.inc.sqf