plugins/include/sorting.inc
changeset 1701 9cf7f48da853
parent 1330 ab94316bb52b
child 1738 cb3be0b31d99
     1.1 --- a/plugins/include/sorting.inc	Tue Nov 20 02:24:10 2007 +0000
     1.2 +++ b/plugins/include/sorting.inc	Tue Nov 20 03:02:11 2007 +0000
     1.3 @@ -46,6 +46,16 @@
     1.4  };
     1.5  
     1.6  /**
     1.7 + * Data types for ADT Array Sorts
     1.8 + */
     1.9 +  enum SortType
    1.10 + {
    1.11 + 	Sort_Integer = 0,
    1.12 + 	Sort_Float,
    1.13 + 	Sort_String,
    1.14 +};
    1.15 +
    1.16 +/**
    1.17   * Sorts an array of integers.
    1.18   *
    1.19   * @param array			Array of integers to sort in-place.
    1.20 @@ -128,3 +138,38 @@
    1.21   * @noreturn
    1.22   */
    1.23  native SortCustom2D(array[][], array_size, SortFunc2D:sortfunc, Handle:hndl=INVALID_HANDLE);
    1.24 +
    1.25 +/**
    1.26 + * Sort an ADT Array. Specify the type as Integer, Float, or String.
    1.27 + *
    1.28 + * @param array			Array Handle to sort
    1.29 + * @param order			Sort order to use, same as other sorts.
    1.30 + * @param type			Data type stored in the ADT Array
    1.31 + * @noreturn
    1.32 + */
    1.33 +native SortADTArray(Handle:array, SortOrder:order = Sort_Ascending, SortType:type = Sort_Integer);
    1.34 +
    1.35 +/**
    1.36 + * Sort comparison function for ADT Array elements. Function provides you with
    1.37 + * indexes currently being sorted, use ADT Array functions to retrieve the
    1.38 + * index values and compare.
    1.39 + *
    1.40 + * @param index1		First index to compare.
    1.41 + * @param index2		Second index to compare.
    1.42 + * @param array			Array that is being sorted (order is undefined).
    1.43 + * @param hndl			Handle optionally passed in while sorting.
    1.44 + * @return				-1 if first should go before second
    1.45 + *					0 if first is equal to second
    1.46 + *					1 if first should go after second
    1.47 + */
    1.48 +functag SortFuncADTArray public(index1, index2, Handle:array, Handle:hndl);
    1.49 +
    1.50 +/**
    1.51 + * Custom sorts an ADT Array. You must pass in a comparison function.
    1.52 + *
    1.53 + * @param array			Array Handle to sort
    1.54 + * @param sortfunc		Sort comparision function to use
    1.55 + * @param hndl			Optional Handle to pass through the comparison calls.
    1.56 + * @noreturn
    1.57 + */
    1.58 +native SortADTArrayCustom(Handle:array, SortFuncADTArray:sortfunc, Handle:hndl=INVALID_HANDLE); 
    1.59 \ No newline at end of file