From 42bc94e8c7209be3b49beea463487da66941238d Mon Sep 17 00:00:00 2001 From: Valmo Trindade Date: Thu, 8 Aug 2024 16:29:24 -0300 Subject: [PATCH] linted some SQF functions --- addons/main/functions/fn_init.sqf | 12 +++--- .../functions/map/fn_convert_location.sqf | 2 +- .../functions/map/fn_convert_to_altis.sqf | 43 +++++++++---------- 3 files changed, 28 insertions(+), 29 deletions(-) diff --git a/addons/main/functions/fn_init.sqf b/addons/main/functions/fn_init.sqf index 045bbed..1a8fe3a 100644 --- a/addons/main/functions/fn_init.sqf +++ b/addons/main/functions/fn_init.sqf @@ -24,22 +24,22 @@ if (_activated) exitWith { _uid = _x getVariable "_atak_uid"; if (_uid == "") then { - _x call armatak_fnc_postGeoObject; + [_x] call armatak_fnc_postGeoObject; } else { - _x call armatak_fnc_putGeoObject; + [_x] call armatak_fnc_putGeoObject; }; - }, 2, []] call CBA_fnc_addPerFrameHandler; + }, 1, []] call CBA_fnc_addPerFrameHandler; } forEach playableUnits; } else { [{ _uid = player getVariable "_atak_uid"; if (_uid == "") then { - player call armatak_fnc_postGeoObject; + [player] call armatak_fnc_postGeoObject; } else { - player call armatak_fnc_putGeoObject; + [player] call armatak_fnc_putGeoObject; }; - }, 2, []] call CBA_fnc_addPerFrameHandler; + }, 1, []] call CBA_fnc_addPerFrameHandler; }; private _warning = format ["ARMATAK
%1", "Connected!"]; diff --git a/addons/main/functions/map/fn_convert_location.sqf b/addons/main/functions/map/fn_convert_location.sqf index 471b912..6f16c8f 100644 --- a/addons/main/functions/map/fn_convert_location.sqf +++ b/addons/main/functions/map/fn_convert_location.sqf @@ -6,7 +6,7 @@ switch (worldName) do { case "Altis": { _location = [_unit] call armatak_fnc_convert_to_altis; }; - default { }; + default {}; }; _location \ No newline at end of file diff --git a/addons/main/functions/map/fn_convert_to_altis.sqf b/addons/main/functions/map/fn_convert_to_altis.sqf index d697d51..3e649f2 100644 --- a/addons/main/functions/map/fn_convert_to_altis.sqf +++ b/addons/main/functions/map/fn_convert_to_altis.sqf @@ -1,24 +1,23 @@ params["_unit"]; -_playerPosition = getPos _unit; - -_playerLatitude = _playerPosition select 0; -_playerLongitude = _playerPosition select 1; - -_playerMaxLongitude = 30720; -_playerMaxLatitude = 30720; - -_MapMaxLatitude = 25.481608; -_MapMinLatitude = 25.011719; - -_MapMaxLongitude = 40.095572; -_MapMinLongitude = 39.717094; - -_LongitudeDifference = _MapMaxLongitude - _MapMinLongitude; -_LatitudeDifference = _MapMaxLatitude - _MapMinLatitude; - - -_RealLongitude = ( _playerLongitude / _playerMaxLongitude ) * _LongitudeDifference + _MapMinLongitude; -_RealLatitude = ( _playerLatitude / _playerMaxLatitude ) * _LatitudeDifference + _MapMinLatitude; - -[_RealLongitude,_RealLatitude] \ No newline at end of file +_playerPosition = getPos _unit; + +_playerLatitude = _playerPosition select 0; +_playerLongitude = _playerPosition select 1; + +_playerMaxLongitude = 30720; +_playerMaxLatitude = 30720; + +_MapMaxLatitude = 25.481608; +_MapMinLatitude = 25.011719; + +_MapMaxLongitude = 40.095572; +_MapMinLongitude = 39.717094; + +_LongitudeDifference = _MapMaxLongitude - _MapMinLongitude; +_LatitudeDifference = _MapMaxLatitude - _MapMinLatitude; + +_RealLongitude = (_playerLongitude / _playerMaxLongitude) * _LongitudeDifference + _MapMinLongitude; +_RealLatitude = (_playerLatitude / _playerMaxLatitude) * _LatitudeDifference + _MapMinLatitude; + +[_RealLongitude, _RealLatitude] \ No newline at end of file