2015-09-19 22:55:58 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
2015-09-20 13:52:40 +00:00
|
|
|
* ?
|
2015-01-16 23:21:47 +00:00
|
|
|
*
|
2015-09-19 22:55:58 +00:00
|
|
|
* Arguments:
|
|
|
|
* ?
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* ?
|
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*
|
|
|
|
* Deprecated
|
2015-01-16 23:21:47 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-09-21 20:09:54 +00:00
|
|
|
ACE_DEPRECATED("ace_common_fnc_sortAlphabeticallyBy","3.5.0","sort");
|
2015-09-21 19:25:18 +00:00
|
|
|
|
2015-09-19 22:55:58 +00:00
|
|
|
params ["_array", "_elementN"];
|
2015-05-14 18:06:06 +00:00
|
|
|
|
2015-12-14 12:08:19 +00:00
|
|
|
private _indices = [];
|
|
|
|
private _elements = [];
|
2015-01-16 23:21:47 +00:00
|
|
|
|
|
|
|
{
|
2015-12-14 12:08:19 +00:00
|
|
|
private _theElement = toArray (_x select _elementN);
|
|
|
|
_indices pushBack _forEachIndex;
|
2015-11-30 16:21:28 +00:00
|
|
|
_elements pushBack _theElement;
|
2015-05-14 18:06:06 +00:00
|
|
|
} forEach _array;
|
2015-01-16 23:21:47 +00:00
|
|
|
|
|
|
|
for "_i" from 1 to (count _elements) - 1 do {
|
2015-12-14 12:08:19 +00:00
|
|
|
private _tmp = _elements select _i;
|
|
|
|
private _tempIndex = _indices select _i;
|
2015-01-18 19:09:19 +00:00
|
|
|
_j = _i;
|
|
|
|
while {_j >= 1 && {_tmp < _elements select (_j - 1)}} do {
|
|
|
|
_elements set [_j, _elements select (_j - 1)];
|
2015-12-14 12:08:19 +00:00
|
|
|
_indices set [_j, _indices select (_j - 1)];
|
2015-01-18 19:09:19 +00:00
|
|
|
_j = _j - 1;
|
|
|
|
};
|
|
|
|
_elements set[_j, _tmp];
|
2015-12-14 12:08:19 +00:00
|
|
|
_indices set [_j, _tempIndex];
|
2015-01-16 23:21:47 +00:00
|
|
|
};
|
|
|
|
|
2015-12-14 12:08:19 +00:00
|
|
|
private _returnArray = [];
|
2015-09-19 22:55:58 +00:00
|
|
|
|
2015-01-16 23:21:47 +00:00
|
|
|
{
|
2015-11-30 16:21:28 +00:00
|
|
|
_returnArray pushBack (_array select _x);
|
2015-12-14 12:08:19 +00:00
|
|
|
} forEach _indices;
|
2015-01-16 23:21:47 +00:00
|
|
|
|
2015-09-19 22:55:58 +00:00
|
|
|
_returnArray
|