From 37d4a4a0c30a6ce5b4f58069be4ded2a18ac4f0a Mon Sep 17 00:00:00 2001 From: commy2 Date: Mon, 25 Jul 2016 20:00:41 +0200 Subject: [PATCH] deprecate sort function --- addons/common/functions/fnc_insertionSort.sqf | 24 ++++--------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/addons/common/functions/fnc_insertionSort.sqf b/addons/common/functions/fnc_insertionSort.sqf index d2f89a039e..1b664e1fd6 100644 --- a/addons/common/functions/fnc_insertionSort.sqf +++ b/addons/common/functions/fnc_insertionSort.sqf @@ -9,28 +9,14 @@ * Return Value: * sortedArray (ARRAY) * - * Public: Yes + * Public: No */ #include "script_component.hpp" -params ["_list", ["_ascending", true]]; +ACE_DEPRECATED(QFUNC(insertionSort),"3.8.0","sort"); + +params [["_list", [], [[]]], ["_ascending", true, [false]]]; _list = + _list; // copy array to not alter the original one - -for "_i" from 1 to (count _list - 1) do { - private _tmp = _list select _i; - _j = _i; - - while {_j >= 1 && {_tmp < _list select (_j - 1)}} do { - _list set [_j, _list select (_j - 1)]; - _j = _j - 1; - }; - - _list set [_j, _tmp]; -}; - -if (!_ascending) then { - reverse _list; -}; - +_list sort _ascending; _list