From 69b53af1d32c67d067a27a81d90913f1b5261118 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 20 Nov 2015 11:40:31 -0600 Subject: [PATCH 1/3] 1.54 - Replace typeName with isEqualType --- addons/backpacks/functions/fnc_isBackpack.sqf | 2 +- addons/cargo/XEH_postInit.sqf | 2 +- addons/cargo/functions/fnc_canLoadItemIn.sqf | 2 +- addons/cargo/functions/fnc_canUnloadItem.sqf | 2 +- addons/cargo/functions/fnc_getSizeItem.sqf | 2 +- addons/cargo/functions/fnc_handleDestroyed.sqf | 2 +- addons/cargo/functions/fnc_loadItem.sqf | 2 +- addons/cargo/functions/fnc_onMenuOpen.sqf | 2 +- addons/cargo/functions/fnc_startUnload.sqf | 2 +- addons/cargo/functions/fnc_unloadItem.sqf | 4 ++-- addons/cargo/functions/fnc_validateCargoSpace.sqf | 2 +- addons/common/functions/fnc_addActionEventHandler.sqf | 4 ++-- .../common/functions/fnc_addActionMenuEventHandler.sqf | 8 ++++---- .../functions/fnc_addMapMarkerCreatedEventHandler.sqf | 2 +- .../functions/fnc_addScrollWheelEventHandler.sqf | 2 +- addons/common/functions/fnc_assignObjectsInList.sqf | 4 ++-- addons/common/functions/fnc_blurScreen.sqf | 2 +- addons/common/functions/fnc_codeToString.sqf | 2 +- addons/common/functions/fnc_defineVariable.sqf | 2 +- .../common/functions/fnc_deviceKeyFindValidIndex.sqf | 2 +- addons/common/functions/fnc_displayTextPicture.sqf | 6 +++--- addons/common/functions/fnc_displayTextStructured.sqf | 6 +++--- addons/common/functions/fnc_errorMessage.sqf | 2 +- addons/common/functions/fnc_execRemoteFnc.sqf | 2 +- addons/common/functions/fnc_executePersistent.sqf | 2 +- addons/common/functions/fnc_exportConfig.sqf | 4 ++-- .../common/functions/fnc_loadSettingsFromProfile.sqf | 2 +- .../common/functions/fnc_loadSettingsLocalizedText.sqf | 2 +- addons/common/functions/fnc_progressBar.sqf | 4 ++-- addons/common/functions/fnc_setParameter.sqf | 2 +- addons/common/functions/fnc_setSetting.sqf | 4 ++-- addons/common/functions/fnc_syncedEventPFH.sqf | 4 ++-- addons/common/functions/fnc_toNumber.sqf | 2 +- addons/interact_menu/functions/fnc_compileMenu.sqf | 2 +- .../functions/fnc_compileMenuSelfAction.sqf | 2 +- addons/interact_menu/functions/fnc_render.sqf | 4 ++-- .../map_gestures/functions/fnc_isValidColorArray.sqf | 4 ++-- addons/markers/XEH_preInit.sqf | 2 +- addons/markers/functions/fnc_mapDrawEH.sqf | 2 +- .../medical/functions/fnc_addUnconsciousCondition.sqf | 4 ++-- addons/medical/functions/fnc_canTreat.sqf | 4 ++-- addons/medical/functions/fnc_createLitter.sqf | 10 +++++----- .../functions/fnc_displayPatientInformation.sqf | 2 +- .../medical/functions/fnc_getUnconsciousCondition.sqf | 2 +- addons/medical/functions/fnc_handleDamage.sqf | 2 +- addons/medical/functions/fnc_hasItems.sqf | 4 ++-- addons/medical/functions/fnc_treatment.sqf | 6 +++--- addons/medical/functions/fnc_useItems.sqf | 4 ++-- .../medical_menu/functions/fnc_updateActivityLog.sqf | 2 +- .../medical_menu/functions/fnc_updateQuickViewLog.sqf | 2 +- .../optionsmenu/functions/fnc_debugDumpToClipboard.sqf | 4 ++-- addons/optionsmenu/functions/fnc_exportSettings.sqf | 4 ++-- .../functions/fnc_serverSettingsMenuUpdateList.sqf | 2 +- addons/reload/functions/fnc_displayAmmo.sqf | 2 +- addons/repair/functions/fnc_addRepairActions.sqf | 6 +++--- addons/repair/functions/fnc_canRepair.sqf | 4 ++-- addons/repair/functions/fnc_canRepairTrack.sqf | 2 +- addons/repair/functions/fnc_canReplaceTrack.sqf | 2 +- addons/repair/functions/fnc_canReplaceWheel.sqf | 2 +- addons/repair/functions/fnc_hasItems.sqf | 4 ++-- addons/repair/functions/fnc_isEngineer.sqf | 2 +- addons/repair/functions/fnc_repair.sqf | 6 +++--- addons/repair/functions/fnc_useItems.sqf | 4 ++-- addons/safemode/functions/fnc_lockSafety.sqf | 2 +- addons/vector/functions/fnc_convertToTexturesFOS.sqf | 2 +- addons/vehiclelock/functions/fnc_lockpick.sqf | 2 +- 66 files changed, 101 insertions(+), 101 deletions(-) diff --git a/addons/backpacks/functions/fnc_isBackpack.sqf b/addons/backpacks/functions/fnc_isBackpack.sqf index fab82c505f..68b59f803e 100644 --- a/addons/backpacks/functions/fnc_isBackpack.sqf +++ b/addons/backpacks/functions/fnc_isBackpack.sqf @@ -14,7 +14,7 @@ params ["_backpack"]; -if (typeName _backpack == "OBJECT") then { +if (_backpack isEqualType objNull) then { _backpack = typeOf _backpack; }; diff --git a/addons/cargo/XEH_postInit.sqf b/addons/cargo/XEH_postInit.sqf index 2aeb3ab630..064c941d37 100644 --- a/addons/cargo/XEH_postInit.sqf +++ b/addons/cargo/XEH_postInit.sqf @@ -27,7 +27,7 @@ _unloaded = [_item, _vehicle] call FUNC(unloadItem); - _itemClass = if (typeName _item == "STRING") then {_item} else {typeOf _item}; + _itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; // Show hint as feedback _hint = [LSTRING(UnloadingFailed), LSTRING(UnloadedItem)] select _unloaded; diff --git a/addons/cargo/functions/fnc_canLoadItemIn.sqf b/addons/cargo/functions/fnc_canLoadItemIn.sqf index fda60aaf65..b446c4b589 100644 --- a/addons/cargo/functions/fnc_canLoadItemIn.sqf +++ b/addons/cargo/functions/fnc_canLoadItemIn.sqf @@ -23,7 +23,7 @@ if (speed _vehicle > 1 || (((getPos _vehicle) select 2) > 3)) exitWith {false}; private ["_itemSize", "_validItem"]; _itemSize = [_item] call FUNC(getSizeItem); -if (typeName _item == "STRING") then { +if (_item isEqualType "") then { _validItem = isClass (configFile >> "CfgVehicles" >> _item) && {getNumber (configFile >> "CfgVehicles" >> _item >> QGVAR(canLoad)) == 1}; diff --git a/addons/cargo/functions/fnc_canUnloadItem.sqf b/addons/cargo/functions/fnc_canUnloadItem.sqf index 8c741a5448..5c6acc44cc 100644 --- a/addons/cargo/functions/fnc_canUnloadItem.sqf +++ b/addons/cargo/functions/fnc_canUnloadItem.sqf @@ -22,7 +22,7 @@ private ["_loaded", "_itemClass", "_validVehiclestate", "_emptyPos"]; _loaded = _vehicle getVariable [QGVAR(loaded), []]; if !(_item in _loaded) exitWith {false}; -_itemClass = if (typeName _item == "STRING") then {_item} else {typeOf _item}; +_itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; _validVehiclestate = true; _emptyPos = []; diff --git a/addons/cargo/functions/fnc_getSizeItem.sqf b/addons/cargo/functions/fnc_getSizeItem.sqf index 807251365c..bf5e76dcdb 100644 --- a/addons/cargo/functions/fnc_getSizeItem.sqf +++ b/addons/cargo/functions/fnc_getSizeItem.sqf @@ -19,7 +19,7 @@ params ["_item"]; private ["_isVirtual","_itemClass","_config"]; scopeName "return"; -_isVirtual = (typeName _item == "STRING"); +_isVirtual = (_item isEqualType ""); _itemClass = if (_isVirtual) then {_item} else {typeOf _item}; _config = (configFile >> "CfgVehicles" >> _itemClass >> QGVAR(size)); diff --git a/addons/cargo/functions/fnc_handleDestroyed.sqf b/addons/cargo/functions/fnc_handleDestroyed.sqf index 1022497719..8ddf59b21b 100644 --- a/addons/cargo/functions/fnc_handleDestroyed.sqf +++ b/addons/cargo/functions/fnc_handleDestroyed.sqf @@ -24,7 +24,7 @@ if (_loaded isEqualTo []) exitWith {}; { // TODO Do we want to be able to recover destroyed equipment? - if (typeName _x == "OBJECT") then { + if (_x isEqualType objNull) then { deleteVehicle _x; }; } count _loaded; diff --git a/addons/cargo/functions/fnc_loadItem.sqf b/addons/cargo/functions/fnc_loadItem.sqf index 45746a93fd..fa91f23cce 100644 --- a/addons/cargo/functions/fnc_loadItem.sqf +++ b/addons/cargo/functions/fnc_loadItem.sqf @@ -33,7 +33,7 @@ _space = [_vehicle] call FUNC(getCargoSpaceLeft); _itemSize = [_item] call FUNC(getSizeItem); _vehicle setVariable [QGVAR(space), _space - _itemSize, true]; -if (typeName _item == "OBJECT") then { +if (_item isEqualType objNull) then { detach _item; _item attachTo [_vehicle,[0,0,-100]]; ["hideObjectGlobal", [_item, true]] call EFUNC(common,serverEvent); diff --git a/addons/cargo/functions/fnc_onMenuOpen.sqf b/addons/cargo/functions/fnc_onMenuOpen.sqf index 85557835bf..f2abf79100 100644 --- a/addons/cargo/functions/fnc_onMenuOpen.sqf +++ b/addons/cargo/functions/fnc_onMenuOpen.sqf @@ -40,7 +40,7 @@ uiNamespace setVariable [QGVAR(menuDisplay), _display]; lbClear _ctrl; { - _class = if (typeName _x == "STRING") then {_x} else {typeOf _x}; + _class = if (_x isEqualType "") then {_x} else {typeOf _x}; _ctrl lbAdd (getText(configfile >> "CfgVehicles" >> _class >> "displayName")); true } count _loaded; diff --git a/addons/cargo/functions/fnc_startUnload.sqf b/addons/cargo/functions/fnc_startUnload.sqf index 013de1dc64..dc49e9d34b 100644 --- a/addons/cargo/functions/fnc_startUnload.sqf +++ b/addons/cargo/functions/fnc_startUnload.sqf @@ -41,7 +41,7 @@ if ([_item, GVAR(interactionVehicle)] call FUNC(canUnloadItem)) then { [5 * _size, [_item, GVAR(interactionVehicle)], "UnloadCargo", {}, localize LSTRING(UnloadingItem)] call EFUNC(common,progressBar); } else { - _itemClass = if (typeName _item == "STRING") then {_item} else {typeOf _item}; + _itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; _displayName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName"); ["displayTextStructured", [[LSTRING(UnloadingFailed), _displayName], 3.0]] call EFUNC(common,localEvent); diff --git a/addons/cargo/functions/fnc_unloadItem.sqf b/addons/cargo/functions/fnc_unloadItem.sqf index 81cca7154b..d9e8bf34be 100644 --- a/addons/cargo/functions/fnc_unloadItem.sqf +++ b/addons/cargo/functions/fnc_unloadItem.sqf @@ -23,7 +23,7 @@ if !([_item, _vehicle] call FUNC(canUnloadItem)) exitWith { false }; -_itemClass = if (typeName _item == "STRING") then {_item} else {typeOf _item}; +_itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; _validVehiclestate = true; _emptyPos = []; @@ -57,7 +57,7 @@ _space = [_vehicle] call FUNC(getCargoSpaceLeft); _itemSize = [_item] call FUNC(getSizeItem); _vehicle setVariable [QGVAR(space), (_space + _itemSize), true]; -if (typeName _item == "OBJECT") then { +if (_item isEqualType objNull) then { detach _item; _item setPosASL (_emptyPos call EFUNC(common,PositiontoASL)); ["hideObjectGlobal", [_item, false]] call EFUNC(common,serverEvent); diff --git a/addons/cargo/functions/fnc_validateCargoSpace.sqf b/addons/cargo/functions/fnc_validateCargoSpace.sqf index 7634b131e6..d5781067d1 100644 --- a/addons/cargo/functions/fnc_validateCargoSpace.sqf +++ b/addons/cargo/functions/fnc_validateCargoSpace.sqf @@ -24,7 +24,7 @@ _loaded = _vehicle getVariable [QGVAR(loaded), []]; _newLoaded = []; _totalSpaceOccupied = 0; { - if ((typeName _x == "STRING") || {!isNull _x}) then { + if ((_x isEqualType "") || {!isNull _x}) then { _newLoaded pushback _x; _totalSpaceOccupied = _totalSpaceOccupied + ([_x] call FUNC(getSizeItem)); }; diff --git a/addons/common/functions/fnc_addActionEventHandler.sqf b/addons/common/functions/fnc_addActionEventHandler.sqf index 4d7d96bd44..ae04933cdd 100644 --- a/addons/common/functions/fnc_addActionEventHandler.sqf +++ b/addons/common/functions/fnc_addActionEventHandler.sqf @@ -17,11 +17,11 @@ params ["_unit", "_action", "_condition", "_statement"]; -if (typeName _condition == "STRING") then { +if (_condition isEqualType "") then { _condition = compile _condition; }; -if (typeName _statement == "STRING") then { +if (_statement isEqualType "") then { _statement = compile _statement; }; diff --git a/addons/common/functions/fnc_addActionMenuEventHandler.sqf b/addons/common/functions/fnc_addActionMenuEventHandler.sqf index 279842ae5c..d9beb977f7 100644 --- a/addons/common/functions/fnc_addActionMenuEventHandler.sqf +++ b/addons/common/functions/fnc_addActionMenuEventHandler.sqf @@ -21,19 +21,19 @@ params ["_unit", "_displayName", "_action", "_condition", "_statement", "_condition2", "_statement2", ["_priority", 0]]; -if (typeName _condition == "STRING") then { +if (_condition isEqualType "") then { _condition = compile _condition; }; -if (typeName _statement == "STRING") then { +if (_statement isEqualType "") then { _statement = compile _statement; }; -if (typeName _condition2 == "STRING") then { +if (_condition2 isEqualType "") then { _condition2 = compile _condition2; }; -if (typeName _statement2 == "STRING") then { +if (_statement2 isEqualType "") then { _statement2 = compile _statement2; }; diff --git a/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf b/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf index 1e060f056a..05e23cf099 100644 --- a/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf +++ b/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf @@ -14,7 +14,7 @@ params ["_statement"]; -if (typeName _statement == "STRING") then { +if (_statement isEqualType "") then { _statement = compile _statement; }; diff --git a/addons/common/functions/fnc_addScrollWheelEventHandler.sqf b/addons/common/functions/fnc_addScrollWheelEventHandler.sqf index df1601c95a..45f935812f 100644 --- a/addons/common/functions/fnc_addScrollWheelEventHandler.sqf +++ b/addons/common/functions/fnc_addScrollWheelEventHandler.sqf @@ -15,7 +15,7 @@ params ["_statement"]; -if (typeName _statement == "STRING") then { +if (_statement isEqualType "") then { _statement = compile _statement; }; diff --git a/addons/common/functions/fnc_assignObjectsInList.sqf b/addons/common/functions/fnc_assignObjectsInList.sqf index a09447a43a..edfeb1b709 100644 --- a/addons/common/functions/fnc_assignObjectsInList.sqf +++ b/addons/common/functions/fnc_assignObjectsInList.sqf @@ -22,14 +22,14 @@ params ["_list", "_variable", "_setting", "_global", ["_vehicle", false]]; -if (typeName _list == "STRING") then { +if (_list isEqualType "") then { _list = [_list, true, true] call FUNC(parseList); TRACE_1("Parsed",_list) }; { if (!isNil "_x") then { - if (typeName _x == typeName objNull) then { + if (_x isEqualType objNull) then { if (local _x) then { if (_vehicle) then { (vehicle _x) setVariable [_variable, _setting, _global]; diff --git a/addons/common/functions/fnc_blurScreen.sqf b/addons/common/functions/fnc_blurScreen.sqf index a3394a1fbf..4f8cc0dfcb 100644 --- a/addons/common/functions/fnc_blurScreen.sqf +++ b/addons/common/functions/fnc_blurScreen.sqf @@ -16,7 +16,7 @@ if (!hasInterface) exitWith {}; params ["_id", ["_show", false]]; -if (typeName _show == "SCALAR") then { +if (_show isEqualType 0) then { _show = _show == 1; }; diff --git a/addons/common/functions/fnc_codeToString.sqf b/addons/common/functions/fnc_codeToString.sqf index 4a1b158f21..b2817cd2b8 100644 --- a/addons/common/functions/fnc_codeToString.sqf +++ b/addons/common/functions/fnc_codeToString.sqf @@ -14,7 +14,7 @@ params ["_function"]; -if (typeName _function == "STRING") exitWith {_function}; +if (_function isEqualType "") exitWith {_function}; _function = toArray str _function; _function deleteAt 0; diff --git a/addons/common/functions/fnc_defineVariable.sqf b/addons/common/functions/fnc_defineVariable.sqf index 6ea15adc43..35a1e96d31 100644 --- a/addons/common/functions/fnc_defineVariable.sqf +++ b/addons/common/functions/fnc_defineVariable.sqf @@ -21,7 +21,7 @@ params ["_name", "_value", "_defaultGlobal", "_category", ["_code", 0], ["_persi if (isNil "_defaultGlobal") exitWith {}; -if (typeName _name != "STRING") exitwith { +if (!(_name isEqualType "")) exitwith { [format ["Tried to the deinfe a variable with an invalid name: %1 Arguments: %2", _name, _this]] call FUNC(debug); }; diff --git a/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf b/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf index 681ab946e0..16a80d6e3f 100644 --- a/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf +++ b/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf @@ -22,7 +22,7 @@ private ["_validIndex", "_realIndex"]; _validIndex = -1; -if (typeName _searchOffsetOrName == "STRING") then { +if (_searchOffsetOrName isEqualType "") then { { if (_x select 0 == _searchOffsetOrName) exitWith { _validIndex = _forEachIndex; diff --git a/addons/common/functions/fnc_displayTextPicture.sqf b/addons/common/functions/fnc_displayTextPicture.sqf index 3bdf908d16..a0bcb47e11 100644 --- a/addons/common/functions/fnc_displayTextPicture.sqf +++ b/addons/common/functions/fnc_displayTextPicture.sqf @@ -20,10 +20,10 @@ params ["_text", "_image", ["_imageColor", [1,1,1]], ["_target", ACE_player]]; if (_target != ACE_player) exitWith {}; if (typeName _text != "TEXT") then { - if (typeName _text == "ARRAY") then { + if (_text isEqualType []) then { if (count _text > 0) then { { - if (typeName _x == "STRING" && {isLocalized _x}) then { + if (_x isEqualType "" && {isLocalized _x}) then { _text set [_forEachIndex, localize _x]; }; } forEach _text; @@ -32,7 +32,7 @@ if (typeName _text != "TEXT") then { }; }; - if (typeName _text == "STRING" && {isLocalized _text}) then { + if (_text isEqualType "" && {isLocalized _text}) then { _text = localize _text; }; diff --git a/addons/common/functions/fnc_displayTextStructured.sqf b/addons/common/functions/fnc_displayTextStructured.sqf index 255a014b6f..0bfef3d2f9 100644 --- a/addons/common/functions/fnc_displayTextStructured.sqf +++ b/addons/common/functions/fnc_displayTextStructured.sqf @@ -19,17 +19,17 @@ params ["_text", ["_size", 1.5], ["_target", ACE_player]]; if (_target != ACE_player) exitWith {}; if (typeName _text != "TEXT") then { - if (typeName _text == "ARRAY") then { + if (_text isEqualType []) then { if (count _text > 0) then { { - if (typeName _x == "STRING" && {isLocalized _x}) then { + if (_x isEqualType "" && {isLocalized _x}) then { _text set [_foreachIndex, localize _x]; }; }foreach _text; _text = format _text; }; }; - if (typeName _text == "STRING" && {isLocalized _text}) then { + if (_text isEqualType "" && {isLocalized _text}) then { _text = localize _text; }; _text = composeText [lineBreak, parseText format ["%1", _text]]; diff --git a/addons/common/functions/fnc_errorMessage.sqf b/addons/common/functions/fnc_errorMessage.sqf index f06aa2d30d..9f7738ea80 100644 --- a/addons/common/functions/fnc_errorMessage.sqf +++ b/addons/common/functions/fnc_errorMessage.sqf @@ -31,7 +31,7 @@ if (isNull (call BIS_fnc_displayMission)) exitWith { params ["_textHeader", "_textMessage", ["_onOK", {}], ["_onCancel", {}]]; -if (typeName _textMessage == "STRING") then { +if (_textMessage isEqualType "") then { _textMessage = parseText _textMessage; }; diff --git a/addons/common/functions/fnc_execRemoteFnc.sqf b/addons/common/functions/fnc_execRemoteFnc.sqf index 0dd0653a33..02f957b501 100644 --- a/addons/common/functions/fnc_execRemoteFnc.sqf +++ b/addons/common/functions/fnc_execRemoteFnc.sqf @@ -27,7 +27,7 @@ TRACE_3("params", _arguments, _function, _unit); _function = call compile _function; -if (typeName _unit == "SCALAR") exitWith { +if (_unit isEqualType 0) exitWith { switch (_unit) do { case 0 : { _arguments call _function; diff --git a/addons/common/functions/fnc_executePersistent.sqf b/addons/common/functions/fnc_executePersistent.sqf index 3763d1bb58..d8f54995bd 100644 --- a/addons/common/functions/fnc_executePersistent.sqf +++ b/addons/common/functions/fnc_executePersistent.sqf @@ -18,7 +18,7 @@ params ["_target"]; if (isNil "_x") then { ACE_LOGERROR_1("No arguments and function for remote function. ID: %1",_forEachIndex); } else { - if (typeName _x == "ARRAY") then { + if (_x isEqualType []) then { [_x select 0, _target] call (_x select 1); }; }; diff --git a/addons/common/functions/fnc_exportConfig.sqf b/addons/common/functions/fnc_exportConfig.sqf index 9b28786e43..2a4890c49c 100644 --- a/addons/common/functions/fnc_exportConfig.sqf +++ b/addons/common/functions/fnc_exportConfig.sqf @@ -41,8 +41,8 @@ _fnc_logEntries = { case (isClass _e1): {[_e1, _d + 1] call _fnc_logEntries; false}; }; - if (typeName _e2 != "BOOL") then { - if (typeName _e2 == "ARRAY") then { + if (!(_e2 isEqualType false)) then { + if (_e2 isEqualType []) then { _e2 = toArray str _e2; { if (_x == toArray "[" select 0) then { diff --git a/addons/common/functions/fnc_loadSettingsFromProfile.sqf b/addons/common/functions/fnc_loadSettingsFromProfile.sqf index d4806d0c54..a596583a5c 100644 --- a/addons/common/functions/fnc_loadSettingsFromProfile.sqf +++ b/addons/common/functions/fnc_loadSettingsFromProfile.sqf @@ -27,7 +27,7 @@ // If the setting is stored on the profile if !(isNil "_profileValue") then { // If the profile variable has the correct type - if (typeName _profileValue == typeName (missionNamespace getVariable _name)) then { + if (_profileValue isEqualType (missionNamespace getVariable _name)) then { // Load the setting from the profile missionNamespace setVariable [_name, _profileValue]; }; diff --git a/addons/common/functions/fnc_loadSettingsLocalizedText.sqf b/addons/common/functions/fnc_loadSettingsLocalizedText.sqf index 1e43359379..4cd23fea4d 100644 --- a/addons/common/functions/fnc_loadSettingsLocalizedText.sqf +++ b/addons/common/functions/fnc_loadSettingsLocalizedText.sqf @@ -30,7 +30,7 @@ _fnc_parseConfigForDisplayNames = { private "_text"; _text = _x; - if (typeName _text == "STRING" && {count _text > 1} && {_text select [0, 1] == "$"}) then { + if (_text isEqualType "" && {count _text > 1} && {_text select [0, 1] == "$"}) then { _text = localize (_text select [1]); //chop off the leading $ _values set [_forEachIndex, _text]; }; diff --git a/addons/common/functions/fnc_progressBar.sqf b/addons/common/functions/fnc_progressBar.sqf index d93273a0c3..170d0060c0 100644 --- a/addons/common/functions/fnc_progressBar.sqf +++ b/addons/common/functions/fnc_progressBar.sqf @@ -85,13 +85,13 @@ _fnc_perFrameFunction = { [_this select 1] call CBA_fnc_removePerFrameHandler; if (_errorCode == 0) then { - if (typeName _onFinish == "STRING") then { + if (_onFinish isEqualType "") then { [_onFinish, [_args, _elapsedTime, _totalTime, _errorCode]] call FUNC(localEvent); } else { [_args, _elapsedTime, _totalTime, _errorCode] call _onFinish; }; } else { - if (typeName _onFail == "STRING") then { + if (_onFail isEqualType "") then { [_onFail, [_args, _elapsedTime, _totalTime, _errorCode]] call FUNC(localEvent); } else { [_args, _elapsedTime, _totalTime, _errorCode] call _onFail; diff --git a/addons/common/functions/fnc_setParameter.sqf b/addons/common/functions/fnc_setParameter.sqf index dd946f7bc5..b24e2506b5 100644 --- a/addons/common/functions/fnc_setParameter.sqf +++ b/addons/common/functions/fnc_setParameter.sqf @@ -19,7 +19,7 @@ params ["_name", "_value"]; // Hack to keep backward compatibility for the moment if (typeName (missionNamespace getVariable _name) == "BOOL") then { - if (typeName _value == "SCALAR") then { + if (_value isEqualType 0) then { _value = _value > 0; }; }; diff --git a/addons/common/functions/fnc_setSetting.sqf b/addons/common/functions/fnc_setSetting.sqf index 60b64e31d4..397bece670 100644 --- a/addons/common/functions/fnc_setSetting.sqf +++ b/addons/common/functions/fnc_setSetting.sqf @@ -33,7 +33,7 @@ if (_settingData select 6) exitWith {}; _failed = false; if (typeName _value != _settingData select 1) then { _failed = true; - if (_settingData select 1 == "BOOL" && typeName _value == "SCALAR") then { + if (_settingData select 1 == "BOOL" && _value isEqualType 0) then { // If value is not 0 or 1 consider it invalid and don't set anything if (_value isEqualTo 0) then { _value = false; @@ -44,7 +44,7 @@ if (typeName _value != _settingData select 1) then { _failed = false; }; }; - if (_settingData select 1 == "COLOR" && typeName _value == "ARRAY") then { + if (_settingData select 1 == "COLOR" && _value isEqualType []) then { _failed = false; }; }; diff --git a/addons/common/functions/fnc_syncedEventPFH.sqf b/addons/common/functions/fnc_syncedEventPFH.sqf index 923e445839..1b2f634ace 100644 --- a/addons/common/functions/fnc_syncedEventPFH.sqf +++ b/addons/common/functions/fnc_syncedEventPFH.sqf @@ -35,7 +35,7 @@ if (!isServer) exitWith {false}; _eventEntry = _x; _ttlReturn = true; - if (typeName _globalEventTTL == "CODE") then { + if (_globalEventTTL isEqualType {}) then { _ttlReturn = [_eventTime, _eventEntry] call _globalEventTTL; } else { _ttlReturn = call {_globalEventTTL < 1 || {ACE_diagTime < (_eventEntry select 0) + _globalEventTTL}}; @@ -45,7 +45,7 @@ if (!isServer) exitWith {false}; // Do event based TTL check _eventEntry params ["_time", "", "_eventTTL"]; - if (typeName _eventTTL == "CODE") then { + if (_eventTTL isEqualType {}) then { _ttlReturn = [_eventTime, _eventEntry] call _eventTTL; } else { _ttlReturn = call {_eventTTL < 1 || {ACE_diagTime < _time + _eventTTL}}; diff --git a/addons/common/functions/fnc_toNumber.sqf b/addons/common/functions/fnc_toNumber.sqf index 6b1aacde1e..c375dfb02e 100644 --- a/addons/common/functions/fnc_toNumber.sqf +++ b/addons/common/functions/fnc_toNumber.sqf @@ -17,6 +17,6 @@ params ["_value"]; -if (typeName _value == "SCALAR") exitWith {_value}; +if (_value isEqualType 0) exitWith {_value}; parseNumber _value // return diff --git a/addons/interact_menu/functions/fnc_compileMenu.sqf b/addons/interact_menu/functions/fnc_compileMenu.sqf index 6dd4c5ee74..d84130e21c 100644 --- a/addons/interact_menu/functions/fnc_compileMenu.sqf +++ b/addons/interact_menu/functions/fnc_compileMenu.sqf @@ -17,7 +17,7 @@ params ["_target"]; private ["_objectType","_actionsVarName","_isMan"]; _objectType = _target; _isMan = false; -if (typeName _target == "OBJECT") then { +if (_target isEqualType objNull) then { _objectType = typeOf _target; _isMan = _target isKindOf "CAManBase"; }; diff --git a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf index 2c8cdc279c..123f83110d 100644 --- a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf +++ b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf @@ -17,7 +17,7 @@ params ["_target"]; private ["_objectType","_actionsVarName","_isMan"]; _objectType = _target; _isMan = false; -if (typeName _target == "OBJECT") then { +if (_target isEqualType objNull) then { _objectType = typeOf _target; _isMan = _target isKindOf "CAManBase"; }; diff --git a/addons/interact_menu/functions/fnc_render.sqf b/addons/interact_menu/functions/fnc_render.sqf index 54f197a2a3..131b5b2102 100644 --- a/addons/interact_menu/functions/fnc_render.sqf +++ b/addons/interact_menu/functions/fnc_render.sqf @@ -92,10 +92,10 @@ if (GVAR(openedMenuType) >= 0) then { private "_runOnHover"; _tmp = ((GVAR(selectedAction) select 0) select 9) select 3; _runOnHover = true; - if ((typeName _tmp) == "CODE" ) then { + if (_tmp isEqualType {}) then { _runOnHover = call _tmp; } else { - if ((typeName _tmp) == "BOOL" ) then { + if (_tmp isEqualType false) then { _runOnHover = _tmp; } else { _runOnHover = _tmp > 0; diff --git a/addons/map_gestures/functions/fnc_isValidColorArray.sqf b/addons/map_gestures/functions/fnc_isValidColorArray.sqf index 809bbaf117..fdf89a46d6 100644 --- a/addons/map_gestures/functions/fnc_isValidColorArray.sqf +++ b/addons/map_gestures/functions/fnc_isValidColorArray.sqf @@ -20,11 +20,11 @@ scopeName "main"; params ["_colorArray"]; if (isNil "_colorArray") exitWith {false}; -if ((typeName _colorArray) != "ARRAY") exitWith {false}; +if (!(_colorArray isEqualType [])) exitWith {false}; if (count _colorArray != 4) exitWith {false}; { - if ((typeName _x) != "SCALAR" || _x < 0 || _x > 1) exitWith {false breakOut "main"}; + if ((!(_x isEqualType 0)) || {_x < 0 || _x > 1}) exitWith {false breakOut "main"}; } count _colorArray; true diff --git a/addons/markers/XEH_preInit.sqf b/addons/markers/XEH_preInit.sqf index e47514f4fa..264658aa81 100644 --- a/addons/markers/XEH_preInit.sqf +++ b/addons/markers/XEH_preInit.sqf @@ -42,7 +42,7 @@ if (isNil QGVAR(MarkerColorsCache)) then { _name = getText (_marker >> "name"); _rgba = getArray (_marker >> "color"); { - if (typeName _x != "SCALAR") then { + if (!( _x isEqualType 0)) then { _rgba set [_forEachIndex, call compile _x]; }; } forEach _rgba; diff --git a/addons/markers/functions/fnc_mapDrawEH.sqf b/addons/markers/functions/fnc_mapDrawEH.sqf index babdfbbb44..05ab4f1ed4 100644 --- a/addons/markers/functions/fnc_mapDrawEH.sqf +++ b/addons/markers/functions/fnc_mapDrawEH.sqf @@ -37,7 +37,7 @@ _drawColor = getArray (_colorConfig >> "color"); //Convert possible code into numbers { - if (typeName _x == "STRING") then { + if (_x isEqualType "") then { _drawColor set [_forEachIndex, (call compile _x)]; }; } forEach _drawColor; diff --git a/addons/medical/functions/fnc_addUnconsciousCondition.sqf b/addons/medical/functions/fnc_addUnconsciousCondition.sqf index 6a867088da..195cd557d7 100644 --- a/addons/medical/functions/fnc_addUnconsciousCondition.sqf +++ b/addons/medical/functions/fnc_addUnconsciousCondition.sqf @@ -15,9 +15,9 @@ if (isnil QGVAR(unconsciousConditions)) then { GVAR(unconsciousConditions) = []; }; -if (typeName _this == typeName []) then { +if (_this isEqualType []) then { { - if (typeName _x == typeName {}) then { + if (_x isEqualType {}) then { GVAR(unconsciousConditions) pushback _x; }; } foreach _this; diff --git a/addons/medical/functions/fnc_canTreat.sqf b/addons/medical/functions/fnc_canTreat.sqf index 60685ee20a..a42ff2d0cf 100644 --- a/addons/medical/functions/fnc_canTreat.sqf +++ b/addons/medical/functions/fnc_canTreat.sqf @@ -57,7 +57,7 @@ if (getText (_config >> "condition") != "") then { } else { _condition = missionNamespace getvariable _condition; }; - if (typeName _condition == "BOOL") then { + if (_condition isEqualType false) then { _return = _condition; } else { _return = [_caller, _target, _selectionName, _className] call _condition; @@ -86,7 +86,7 @@ _medVeh = {([_caller] call FUNC(isInMedicalVehicle)) || ([_target] call FUNC(isI if !(isnil _x) exitwith { private "_val"; _val = missionNamespace getvariable _x; - if (typeName _val == "SCALAR") then { + if (_val isEqualType 0) then { _return = switch (_val) do { case 0: {true}; //AdvancedMedicalSettings_anywhere case 1: {call _medVeh}; //AdvancedMedicalSettings_vehicle diff --git a/addons/medical/functions/fnc_createLitter.sqf b/addons/medical/functions/fnc_createLitter.sqf index 54fd6694dd..95486f369d 100644 --- a/addons/medical/functions/fnc_createLitter.sqf +++ b/addons/medical/functions/fnc_createLitter.sqf @@ -59,7 +59,7 @@ _createLitter = { _createdLitter = []; { - if (typeName _x == "ARRAY") then { + if (_x isEqualType []) then { if (count _x < MIN_ENTRIES_LITTER_CONFIG) exitwith {}; _x params ["_selection", "_litterCondition", "_litterOptions"]; @@ -70,17 +70,17 @@ _createdLitter = []; _litterCondition = if (_litterCondition != "") then {compile _litterCondition} else {{true}}; } else { _litterCondition = missionNamespace getvariable _litterCondition; - if (typeName _litterCondition != "CODE") then {_litterCondition = {false}}; + if (!(_litterCondition isEqualType {})) then {_litterCondition = {false}}; }; if !([_caller, _target, _selectionName, _className, _usersOfItems, _previousDamage] call _litterCondition) exitwith {}; - if (typeName _litterOptions == "ARRAY") then { + if (_litterOptions isEqualType []) then { // Loop through through the litter options and place the litter { - if (typeName _x == "ARRAY" && {(count _x > 0)}) then { + if (_x isEqualType [] && {(count _x > 0)}) then { [_target, _x select (floor(random(count _x)))] call _createLitter; }; - if (typeName _x == "STRING") then { + if (_x isEqualType "") then { [_target, _x] call _createLitter; }; } foreach _litterOptions; diff --git a/addons/medical/functions/fnc_displayPatientInformation.sqf b/addons/medical/functions/fnc_displayPatientInformation.sqf index 222de4463f..cd77a8d371 100644 --- a/addons/medical/functions/fnc_displayPatientInformation.sqf +++ b/addons/medical/functions/fnc_displayPatientInformation.sqf @@ -209,7 +209,7 @@ if (_show) then { }; { - if (typeName _x == "STRING" && {isLocalized _x}) then { + if (_x isEqualType "" && {isLocalized _x}) then { _arguments set [_foreachIndex, localize _x]; }; } foreach _arguments; diff --git a/addons/medical/functions/fnc_getUnconsciousCondition.sqf b/addons/medical/functions/fnc_getUnconsciousCondition.sqf index c354dd6ebd..cf8cc86c22 100644 --- a/addons/medical/functions/fnc_getUnconsciousCondition.sqf +++ b/addons/medical/functions/fnc_getUnconsciousCondition.sqf @@ -22,7 +22,7 @@ if (isnil QGVAR(unconsciousConditions)) then { _return = false; { - if (typeName _x == typeName {} && {([_unit] call _x)}) exitwith { + if ((_x isEqualType {}) && {([_unit] call _x)}) exitwith { _return = true; }; } foreach GVAR(unconsciousConditions); diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index 6d955e72fd..1af77c8483 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -28,7 +28,7 @@ if !(local _unit) exitWith { private ["_damageReturn", "_typeOfDamage", "_minLethalDamage", "_newDamage", "_typeIndex", "_preventDeath"]; // bug, assumed fixed, @todo excessive testing, if nothing happens remove -if (typeName _projectile == "OBJECT") then { +if (_projectile isEqualType objNull) then { _projectile = typeOf _projectile; _this set [4, _projectile]; }; diff --git a/addons/medical/functions/fnc_hasItems.sqf b/addons/medical/functions/fnc_hasItems.sqf index dd53cb3337..7937b6a157 100644 --- a/addons/medical/functions/fnc_hasItems.sqf +++ b/addons/medical/functions/fnc_hasItems.sqf @@ -21,10 +21,10 @@ params ["_medic", "_patient", "_items"]; _return = true; { // - if (typeName _x == "ARRAY" && {({[_medic, _patient, _x] call FUNC(hasItem)}count _x == 0)}) exitwith { + if (_x isEqualType [] && {({[_medic, _patient, _x] call FUNC(hasItem)}count _x == 0)}) exitwith { _return = false; }; - if (typeName _x == "STRING" && {!([_medic, _patient, _x] call FUNC(hasItem))}) exitwith { + if (_x isEqualType "" && {!([_medic, _patient, _x] call FUNC(hasItem))}) exitwith { _return = false; }; }foreach _items; diff --git a/addons/medical/functions/fnc_treatment.sqf b/addons/medical/functions/fnc_treatment.sqf index 2d0e44d488..5b561bdf65 100644 --- a/addons/medical/functions/fnc_treatment.sqf +++ b/addons/medical/functions/fnc_treatment.sqf @@ -65,7 +65,7 @@ if (isText (_config >> "Condition")) then { } else { _condition = missionNamespace getvariable _condition; }; - if (typeName _condition == "BOOL") then { + if (_condition isEqualType false) then { _return = _condition; } else { _return = [_caller, _target, _selectionName, _className] call _condition; @@ -98,7 +98,7 @@ if ("All" in _locations) then { if !(isnil _x) exitwith { private "_val"; _val = missionNamespace getvariable _x; - if (typeName _val == "SCALAR") then { + if (_val isEqualType 0) then { _return = switch (_val) do { case 0: {true}; //AdvancedMedicalSettings_anywhere case 1: {call _medVeh}; //AdvancedMedicalSettings_vehicle @@ -205,7 +205,7 @@ _treatmentTime = if (isNumber (_config >> "treatmentTime")) then { } else { _treatmentTimeConfig = missionNamespace getvariable _treatmentTimeConfig; }; - if (typeName _treatmentTimeConfig == "SCALAR") exitwith { + if (_treatmentTimeConfig isEqualType 0) exitwith { _treatmentTimeConfig; }; [_caller, _target, _selectionName, _className] call _treatmentTimeConfig; diff --git a/addons/medical/functions/fnc_useItems.sqf b/addons/medical/functions/fnc_useItems.sqf index 0d937c0938..c2bdd4206d 100644 --- a/addons/medical/functions/fnc_useItems.sqf +++ b/addons/medical/functions/fnc_useItems.sqf @@ -21,7 +21,7 @@ params ["_medic", "_patient", "_items"]; _itemsUsedBy = []; { // handle a one of type use item - if (typeName _x == "ARRAY") then { + if (_x isEqualType []) then { { _itemUsedInfo = [_medic, _patient, _x] call FUNC(useItem); if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; @@ -29,7 +29,7 @@ _itemsUsedBy = []; }; // handle required item - if (typeName _x == "STRING") then { + if (_x isEqualType "") then { _itemUsedInfo = [_medic, _patient, _x] call FUNC(useItem); if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; }; diff --git a/addons/medical_menu/functions/fnc_updateActivityLog.sqf b/addons/medical_menu/functions/fnc_updateActivityLog.sqf index 92e8474b4b..50acb12e94 100644 --- a/addons/medical_menu/functions/fnc_updateActivityLog.sqf +++ b/addons/medical_menu/functions/fnc_updateActivityLog.sqf @@ -31,7 +31,7 @@ lbClear _logCtrl; }; { - if (typeName _x == "STRING" && {isLocalized _x}) then { + if (_x isEqualType "" && {isLocalized _x}) then { _arguments set [_foreachIndex, localize _x]; }; } forEach _arguments; diff --git a/addons/medical_menu/functions/fnc_updateQuickViewLog.sqf b/addons/medical_menu/functions/fnc_updateQuickViewLog.sqf index 49da12e7f4..900e375fb7 100644 --- a/addons/medical_menu/functions/fnc_updateQuickViewLog.sqf +++ b/addons/medical_menu/functions/fnc_updateQuickViewLog.sqf @@ -31,7 +31,7 @@ lbClear _logCtrl; }; { - if (typeName _x == "STRING" && {isLocalized _x}) then { + if (_x isEqualType "" && {isLocalized _x}) then { _arguments set [_foreachIndex, localize _x]; }; } forEach _arguments; diff --git a/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf b/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf index 755982e569..be771f7a3a 100644 --- a/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf +++ b/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf @@ -67,7 +67,7 @@ _text = format [" { _var = missionNamespace getVariable [_x, nil]; - if(!isnil "_var" && {(typeName _var) == "ARRAY"} && {(count _var) > MIN_ARRAY_SIZE}) then { + if(!isnil "_var" && {_var isEqualType []} && {(count _var) > MIN_ARRAY_SIZE}) then { _text = format ["%1 - ARRAY SIZE: %2", _x, (count _var)]; [_text] call _outputText; }; @@ -77,7 +77,7 @@ _text = format [" _unit = _x; { _var = _unit getVariable [_x, nil]; - if(!isnil "_var" && {(typeName _var) == "ARRAY"} && {(count _var) > MIN_ARRAY_SIZE}) then { + if(!isnil "_var" && {_var isEqualType []} && {(count _var) > MIN_ARRAY_SIZE}) then { _text = format ["%1 on [%2] - ARRAY SIZE: %3", _x, _unit, (count _var)]; [_text] call _outputText; }; diff --git a/addons/optionsmenu/functions/fnc_exportSettings.sqf b/addons/optionsmenu/functions/fnc_exportSettings.sqf index 172a95808e..f6c6dc9653 100644 --- a/addons/optionsmenu/functions/fnc_exportSettings.sqf +++ b/addons/optionsmenu/functions/fnc_exportSettings.sqf @@ -48,8 +48,8 @@ private ["_compiledConfig", "_name", "_typeName", "_isClientSetable", "_localize format['value = "%1";', _value]; }; case ("bool"): { - if (typeName _value != "BOOL") then {ERROR("weird bool typename??");}; - _value = if (((typeName _value) == "BOOL") && {_value}) then {1} else {0}; + if (!(_value isEqualType false)) then {ERROR("weird bool typename??");}; + _value = if ((_value isEqualType false) && {_value}) then {1} else {0}; format ['value = %1;', _value]; }; case ("color"): { diff --git a/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateList.sqf b/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateList.sqf index fc745c37be..7d4540a456 100644 --- a/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateList.sqf +++ b/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateList.sqf @@ -81,7 +81,7 @@ switch (GVAR(optionMenu_openTab)) do { (_x select 0); }; _settingsValue = _x select 9; - if (typeName _settingsValue != "STRING") then { + if (!(_settingsValue isEqualType "")) then { _settingsValue = format["%1", _settingsValue]; }; _added = _ctrlList lnbAddRow [_settingName, _settingsValue]; diff --git a/addons/reload/functions/fnc_displayAmmo.sqf b/addons/reload/functions/fnc_displayAmmo.sqf index ce08fbd062..993283ca56 100644 --- a/addons/reload/functions/fnc_displayAmmo.sqf +++ b/addons/reload/functions/fnc_displayAmmo.sqf @@ -43,7 +43,7 @@ if (_target isKindOf "StaticWeapon") then { if (_magazine == "") exitWith {}; if (_weapon == "") exitWith {}; -if (typeName _muzzle != "STRING") then {_muzzle = _weapon}; +if (!( _muzzle isEqualType "")) then {_muzzle = _weapon}; _showNumber = false; _ammo = 0; diff --git a/addons/repair/functions/fnc_addRepairActions.sqf b/addons/repair/functions/fnc_addRepairActions.sqf index 7ebf978088..10a32e914c 100644 --- a/addons/repair/functions/fnc_addRepairActions.sqf +++ b/addons/repair/functions/fnc_addRepairActions.sqf @@ -122,10 +122,10 @@ _hitPointsAddedAmount = []; _x params ["_hitpoint", "_position"]; // Exit with supplied custom position when same hitpoint name found or print RPT error if it's invalid if (_hitpoint == _currentHitpoint) exitWith { - if (typeName _position == "ARRAY") exitWith { + if (_position isEqualType []) exitWith { _selection = _position; // Position in model space }; - if (typeName _position == "STRING") exitWith { + if (_position isEqualType "") exitWith { _selection = _vehicle selectionPosition _position; // Selection name }; ACE_LOGERROR_3("Invalid custom position %1 of hitpoint %2 in vehicle %3.",_position,_hitpoint,_vehicle); @@ -134,7 +134,7 @@ _hitPointsAddedAmount = []; }; // If position still empty (not a position array or selection name) try extracting from model - if (typeName _selection == "STRING" && {_selection == ""}) then { + if (_selection isEqualType "" && {_selection == ""}) then { _selection = _vehicle selectionPosition (_hitPointsSelections select (_hitPoints find _x)); }; diff --git a/addons/repair/functions/fnc_canRepair.sqf b/addons/repair/functions/fnc_canRepair.sqf index 8fb2a4938e..20e40aae38 100644 --- a/addons/repair/functions/fnc_canRepair.sqf +++ b/addons/repair/functions/fnc_canRepair.sqf @@ -59,7 +59,7 @@ if (getText (_config >> "condition") != "") then { } else { _condition = missionNamespace getVariable _condition; }; - if (typeName _condition == "BOOL") then { + if (_condition isEqualType false) then { _return = _condition; } else { _return = [_caller, _target, _hitPoint, _className] call _condition; @@ -89,7 +89,7 @@ _repairVeh = {([_caller] call FUNC(isNearRepairVehicle)) || ([_target] call FUNC if !(isnil _x) exitwith { private "_val"; _val = missionNamespace getVariable _x; - if (typeName _val == "SCALAR") then { + if (_val isEqualType 0) then { _return = switch (_val) do { case 0: {true}; //useAnywhere case 1: {call _repairVeh}; //repairVehicleOnly diff --git a/addons/repair/functions/fnc_canRepairTrack.sqf b/addons/repair/functions/fnc_canRepairTrack.sqf index 0ba01afb87..3c05e44bc3 100644 --- a/addons/repair/functions/fnc_canRepairTrack.sqf +++ b/addons/repair/functions/fnc_canRepairTrack.sqf @@ -23,7 +23,7 @@ TRACE_4("params",_unit,_target,_hitPoint,_wheel); if !([_unit, _target, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith {false}; -if (typeName _wheel == "OBJECT") then { +if (_wheel isEqualType objNull) then { // not near interpret as objNull if !(_wheel in nearestObjects [_unit, ["ACE_Track"], 5]) then { _wheel = objNull; diff --git a/addons/repair/functions/fnc_canReplaceTrack.sqf b/addons/repair/functions/fnc_canReplaceTrack.sqf index aec3a9f062..880a739bfc 100644 --- a/addons/repair/functions/fnc_canReplaceTrack.sqf +++ b/addons/repair/functions/fnc_canReplaceTrack.sqf @@ -24,7 +24,7 @@ TRACE_4("params",_unit,_target,_hitPoint,_track); if !([_unit, _target, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith {false}; -if (typeName _track == "OBJECT") then { +if (_track isEqualType objNull) then { // not near interpret as objNull if !(_track in nearestObjects [_unit, ["ACE_Track"], 5]) then { _track = objNull; diff --git a/addons/repair/functions/fnc_canReplaceWheel.sqf b/addons/repair/functions/fnc_canReplaceWheel.sqf index cf7a047f19..76e1750177 100644 --- a/addons/repair/functions/fnc_canReplaceWheel.sqf +++ b/addons/repair/functions/fnc_canReplaceWheel.sqf @@ -28,7 +28,7 @@ if !([_unit, _target, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call //if !([_unit, GVAR(engineerSetting_Wheel)] call FUNC(isEngineer)) exitWith {false}; // check for a near wheel -if (typeName _wheel == "OBJECT") then { +if (_wheel isEqualType objNull) then { // not near interpret as objNull if !(_wheel in nearestObjects [_unit, ["ACE_Wheel"], 5]) then { _wheel = objNull; diff --git a/addons/repair/functions/fnc_hasItems.sqf b/addons/repair/functions/fnc_hasItems.sqf index 2f070c8bb6..1dd5461175 100644 --- a/addons/repair/functions/fnc_hasItems.sqf +++ b/addons/repair/functions/fnc_hasItems.sqf @@ -23,10 +23,10 @@ private ["_return"]; _return = true; { - if (typeName _x == "ARRAY" && {({[_unit, _x] call EFUNC(common,hasItem)} count _x == 0)}) exitwith { + if (_x isEqualType [] && {({[_unit, _x] call EFUNC(common,hasItem)} count _x == 0)}) exitwith { _return = false; }; - if (typeName _x == "STRING" && {!([_unit, _x] call EFUNC(common,hasItem))}) exitwith { + if (_x isEqualType "" && {!([_unit, _x] call EFUNC(common,hasItem))}) exitwith { _return = false; }; } forEach _items; diff --git a/addons/repair/functions/fnc_isEngineer.sqf b/addons/repair/functions/fnc_isEngineer.sqf index 9d6af3a1ff..f758aa0b69 100644 --- a/addons/repair/functions/fnc_isEngineer.sqf +++ b/addons/repair/functions/fnc_isEngineer.sqf @@ -24,6 +24,6 @@ _class = _unit getVariable ["ACE_IsEngineer", getNumber (configFile >> "CfgVehic // This if statement is here for copmatability with the common variant of isEngineer, which requires a bool. // We cannot move this function to common because we require the GVAR(engineerSetting_Repair), which only makes sense to include in the repair module. -if (typeName _class == "BOOL") then {_class = 1}; +if (_class isEqualType false) then {_class = 1}; _class >= (_engineerN min GVAR(engineerSetting_Repair)); diff --git a/addons/repair/functions/fnc_repair.sqf b/addons/repair/functions/fnc_repair.sqf index fd3b4f032b..c03d070d10 100644 --- a/addons/repair/functions/fnc_repair.sqf +++ b/addons/repair/functions/fnc_repair.sqf @@ -59,7 +59,7 @@ if (getText (_config >> "condition") != "") then { } else { _condition = missionNamespace getVariable _condition; }; - if (typeName _condition == "BOOL") then { + if (_condition isEqualType false) then { _return = _condition; } else { _return = [_caller, _target, _hitPoint, _className] call _condition; @@ -88,7 +88,7 @@ _repairVeh = {([_caller] call FUNC(isNearRepairVehicle)) || ([_target] call FUNC if !(isnil _x) exitwith { private "_val"; _val = missionNamespace getVariable _x; - if (typeName _val == "SCALAR") then { + if (_val isEqualType 0) then { _return = switch (_val) do { case 0: {true}; //useAnywhere case 1: {call _repairVeh}; //repairVehicleOnly @@ -167,7 +167,7 @@ _repairTime = if (isNumber (_config >> "repairingTime")) then { } else { _repairTimeConfig = missionNamespace getVariable _repairTimeConfig; }; - if (typeName _repairTimeConfig == "SCALAR") exitwith { + if (_repairTimeConfig isEqualType 0) exitwith { _repairTimeConfig; }; [_caller, _target, _hitPoint, _className] call _repairTimeConfig; diff --git a/addons/repair/functions/fnc_useItems.sqf b/addons/repair/functions/fnc_useItems.sqf index f8aa176018..82290a4016 100644 --- a/addons/repair/functions/fnc_useItems.sqf +++ b/addons/repair/functions/fnc_useItems.sqf @@ -24,7 +24,7 @@ private ["_itemUsedInfo", "_itemsUsedBy"]; _itemsUsedBy = []; { // handle a one of type use item - if (typeName _x == "ARRAY") then { + if (_x isEqualType []) then { { _itemUsedInfo = [_unit, _x] call FUNC(useItem); if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; @@ -32,7 +32,7 @@ _itemsUsedBy = []; }; // handle required item - if (typeName _x == "STRING") then { + if (_x isEqualType "") then { _itemUsedInfo = [_unit, _x] call FUNC(useItem); if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; }; diff --git a/addons/safemode/functions/fnc_lockSafety.sqf b/addons/safemode/functions/fnc_lockSafety.sqf index 9fe429a49b..4d4b89759a 100644 --- a/addons/safemode/functions/fnc_lockSafety.sqf +++ b/addons/safemode/functions/fnc_lockSafety.sqf @@ -61,7 +61,7 @@ if (_unit getVariable [QGVAR(actionID), -1] == -1) then { ] call EFUNC(common,addActionEventHandler)]; }; -if (typeName _muzzle == "STRING") then { +if (_muzzle isEqualType "") then { _unit selectWeapon _muzzle; }; diff --git a/addons/vector/functions/fnc_convertToTexturesFOS.sqf b/addons/vector/functions/fnc_convertToTexturesFOS.sqf index 3ce09e3c6c..d3b140f7bf 100644 --- a/addons/vector/functions/fnc_convertToTexturesFOS.sqf +++ b/addons/vector/functions/fnc_convertToTexturesFOS.sqf @@ -237,7 +237,7 @@ switch (_coordinate) do { }; // trap errors -if ({typeName _x == "STRING"} count [_digit0, _digit1, _digit2, _digit3, _digit4] < 5) exitWith { +if ({_x isEqualType ""} count [_digit0, _digit1, _digit2, _digit3, _digit4] < 5) exitWith { [QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa))] // return }; diff --git a/addons/vehiclelock/functions/fnc_lockpick.sqf b/addons/vehiclelock/functions/fnc_lockpick.sqf index 5c0e04ee0b..3435af24bf 100644 --- a/addons/vehiclelock/functions/fnc_lockpick.sqf +++ b/addons/vehiclelock/functions/fnc_lockpick.sqf @@ -35,7 +35,7 @@ if ((locked _veh) == 0) exitWith {false}; if (!("ACE_key_lockpick" in (items _unit))) exitWith {false}; _vehLockpickStrenth = _veh getVariable[QGVAR(lockpickStrength), GVAR(DefaultLockpickStrength)]; -if (typeName _vehLockpickStrenth != "SCALAR") exitWith {ERROR("ACE_vehicleLock_LockpickStrength invalid"); false}; +if (!(_vehLockpickStrenth isEqualType 0)) exitWith {ERROR("ACE_vehicleLock_LockpickStrength invalid"); false}; //-1 indicates unpickable lock if (_vehLockpickStrenth < 0) exitWith {false}; From f676e6d9c9f610c892a5640fca0cae2d8f1f8a7b Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 27 Nov 2015 21:23:27 -0600 Subject: [PATCH 2/3] Add some more typeNames replacements --- addons/common/functions/fnc_isEngineer.sqf | 2 +- addons/interact_menu/functions/fnc_createAction.sqf | 4 ++-- addons/interact_menu/functions/fnc_render.sqf | 4 ++-- addons/repair/functions/fnc_addRepairActions.sqf | 4 ++-- addons/repair/functions/fnc_canRepair.sqf | 4 ++-- addons/repair/functions/fnc_repair.sqf | 4 ++-- addons/repair/functions/fnc_setHitPointDamage.sqf | 2 +- addons/vector/functions/fnc_convertToTexturesFOS.sqf | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/addons/common/functions/fnc_isEngineer.sqf b/addons/common/functions/fnc_isEngineer.sqf index a3c9191c4f..01eabfc0b3 100644 --- a/addons/common/functions/fnc_isEngineer.sqf +++ b/addons/common/functions/fnc_isEngineer.sqf @@ -19,6 +19,6 @@ params ["_unit"]; private _isEngineer = _unit getVariable ["ACE_isEngineer", getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "engineer") == 1]; //Handle ace_repair modules setting this to a number -if ((typeName _isEngineer) == "SCALAR") then {_isEngineer = _isEngineer > 0}; +if (_isEngineer isEqualType 0) then {_isEngineer = _isEngineer > 0}; _isEngineer diff --git a/addons/interact_menu/functions/fnc_createAction.sqf b/addons/interact_menu/functions/fnc_createAction.sqf index 256984c104..0edef384d4 100644 --- a/addons/interact_menu/functions/fnc_createAction.sqf +++ b/addons/interact_menu/functions/fnc_createAction.sqf @@ -40,11 +40,11 @@ params [ ["_modifierFunction", {}] ]; -_position = if (typeName (_position) == "STRING") then { +_position = if (_position isEqualType "") then { // If the action is set to a selection, create the suitable code compile format ["_target selectionPosition '%1'", _position]; } else { - if (typeName (_position) == "ARRAY") then { + if (_position isEqualType []) then { // If the action is set to a array position, create the suitable code compile format ["%1", _position]; } else { diff --git a/addons/interact_menu/functions/fnc_render.sqf b/addons/interact_menu/functions/fnc_render.sqf index 1a14acae07..1f7cf8140b 100644 --- a/addons/interact_menu/functions/fnc_render.sqf +++ b/addons/interact_menu/functions/fnc_render.sqf @@ -78,10 +78,10 @@ if (GVAR(openedMenuType) >= 0) then { // Execute the current action if it's run on hover private _tmp = ((GVAR(selectedAction) select 0) select 9) select 3; private _runOnHover = true; - if ((typeName _tmp) == "CODE" ) then { + if (_tmp isEqualType {}) then { _runOnHover = call _tmp; } else { - if ((typeName _tmp) == "BOOL" ) then { + if (_tmp isEqualType false) then { _runOnHover = _tmp; } else { _runOnHover = _tmp > 0; diff --git a/addons/repair/functions/fnc_addRepairActions.sqf b/addons/repair/functions/fnc_addRepairActions.sqf index 3887d9eff7..c46eb66e75 100644 --- a/addons/repair/functions/fnc_addRepairActions.sqf +++ b/addons/repair/functions/fnc_addRepairActions.sqf @@ -109,10 +109,10 @@ _processedHitpoints = []; { _x params ["_hit", "_pos"]; if (_hitpoint == _hit) exitWith { - if (typeName _pos == "ARRAY") exitWith { + if (_pos isEqualType []) exitWith { _position = _pos; // Position in model space }; - if (typeName _pos == "STRING") exitWith { + if (_pos isEqualType "") exitWith { _position = compile format ["_target selectionPosition ['%1', 'HitPoints'];", _pos]; }; ACE_LOGERROR_3("Invalid custom position %1 of hitpoint %2 in vehicle %3.",_position,_hitpoint,_type); diff --git a/addons/repair/functions/fnc_canRepair.sqf b/addons/repair/functions/fnc_canRepair.sqf index 74a4b07dc6..f7c3f60a8a 100644 --- a/addons/repair/functions/fnc_canRepair.sqf +++ b/addons/repair/functions/fnc_canRepair.sqf @@ -59,7 +59,7 @@ if (getText (_config >> "condition") != "") then { } else { _condition = missionNamespace getVariable _condition; }; - if (typeName _condition == "BOOL") then { + if (_condition isEqualType false) then { _return = _condition; } else { _return = [_caller, _target, _hitPoint, _className] call _condition; @@ -85,7 +85,7 @@ if (!("All" in _repairLocations)) then { if (_x == "RepairVehicle" && _repairVeh) exitWith {_return = true;}; if !(isNil _x) exitWith { private _val = missionNamespace getVariable _x; - if (typeName _val == "SCALAR") then { + if (_val isEqualType 0) then { _return = switch (_val) do { case 0: {true}; //useAnywhere case 1: {call _repairVeh}; //repairVehicleOnly diff --git a/addons/repair/functions/fnc_repair.sqf b/addons/repair/functions/fnc_repair.sqf index 2efb4787b6..04dfe523fa 100644 --- a/addons/repair/functions/fnc_repair.sqf +++ b/addons/repair/functions/fnc_repair.sqf @@ -84,7 +84,7 @@ if (!("All" in _repairLocations)) then { if (_x == "RepairVehicle" && _repairVeh) exitWith {_return = true;}; if !(isNil _x) exitWith { private _val = missionNamespace getVariable _x; - if (typeName _val == "SCALAR") then { + if (_val isEqualType 0) then { _return = switch (_val) do { case 0: {true}; //useAnywhere case 1: {call _repairVeh}; //repairVehicleOnly @@ -181,7 +181,7 @@ _repairTime = if (isNumber (_config >> "repairingTime")) then { } else { _repairTimeConfig = missionNamespace getVariable _repairTimeConfig; }; - if (typeName _repairTimeConfig == "SCALAR") exitWith { + if (_repairTimeConfig isEqualType 0) exitWith { _repairTimeConfig; }; [_caller, _target, _hitPoint, _className] call _repairTimeConfig; diff --git a/addons/repair/functions/fnc_setHitPointDamage.sqf b/addons/repair/functions/fnc_setHitPointDamage.sqf index 018a03723b..ba04cdb7eb 100644 --- a/addons/repair/functions/fnc_setHitPointDamage.sqf +++ b/addons/repair/functions/fnc_setHitPointDamage.sqf @@ -27,7 +27,7 @@ private["_damageNew", "_damageOld", "_hitPointDamageRepaired", "_hitPointDamageS if !(local _vehicle) exitWith {ACE_LOGERROR_1("Vehicle Not Local %1", _vehicle);}; //Check for bad typeName (changed from orignal v3.3 that took string) -if ((typeName _hitPointIndex) == "STRING") then { +if (_hitPointIndex isEqualType "") then { ACE_DEPRECATED("repair-setHitPointDamage (hit point name ","3.5.0","hit index "); _hitPointIndex = _allHitPoints find _hitPointIndex; }; diff --git a/addons/vector/functions/fnc_convertToTexturesFOS.sqf b/addons/vector/functions/fnc_convertToTexturesFOS.sqf index d3b140f7bf..d4ef432f66 100644 --- a/addons/vector/functions/fnc_convertToTexturesFOS.sqf +++ b/addons/vector/functions/fnc_convertToTexturesFOS.sqf @@ -237,7 +237,7 @@ switch (_coordinate) do { }; // trap errors -if ({_x isEqualType ""} count [_digit0, _digit1, _digit2, _digit3, _digit4] < 5) exitWith { +if ([_digit0, _digit1, _digit2, _digit3, _digit4] isEqualTypeAll "") exitWith { [QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa))] // return }; From a8cf9c6f48c3314a285f3b8f90374f9e789ab1b9 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Sat, 28 Nov 2015 13:58:56 +0000 Subject: [PATCH 3/3] Fix missing boolean inversion --- addons/vector/functions/fnc_convertToTexturesFOS.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/vector/functions/fnc_convertToTexturesFOS.sqf b/addons/vector/functions/fnc_convertToTexturesFOS.sqf index d4ef432f66..6141e40fa8 100644 --- a/addons/vector/functions/fnc_convertToTexturesFOS.sqf +++ b/addons/vector/functions/fnc_convertToTexturesFOS.sqf @@ -237,7 +237,7 @@ switch (_coordinate) do { }; // trap errors -if ([_digit0, _digit1, _digit2, _digit3, _digit4] isEqualTypeAll "") exitWith { +if !([_digit0, _digit1, _digit2, _digit3, _digit4] isEqualTypeAll "") exitWith { [QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa))] // return };