Files
fulpstation/code/__HELPERS/sorts/TimSort.dm
nemvar b87f65d95e Converts ALL typepaths to lowercase (#51642)
* Case of lower

* More changes

* Ruins the nice 420 diff, brainfart when doing the second batch of conversions

* More changes

* Next batch. I think

* Converts even more paths

* Restarts bots

* Capital Free Zone

* Come on travis, do something

* Renames areas

* Bots, please stop dying

* Updates CONTRIBUTING.md and updates a few paths I missed.

* APC recgarftzfvas
/obj/item/computer_hardware/recharger/apc to /obj/item/computer_hardware/recharger/apc_recharger
2020-06-17 20:47:57 -03:00

21 lines
451 B
Plaintext

//TimSort interface
/proc/sortTim(list/L, cmp=/proc/cmp_numeric_asc, associative, fromIndex=1, toIndex=0)
if(L && L.len >= 2)
fromIndex = fromIndex % L.len
toIndex = toIndex % (L.len+1)
if(fromIndex <= 0)
fromIndex += L.len
if(toIndex <= 0)
toIndex += L.len + 1
var/datum/sort_instance/SI = GLOB.sortInstance
if(!SI)
SI = new
SI.L = L
SI.cmp = cmp
SI.associative = associative
SI.timSort(fromIndex, toIndex)
return L