mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
-PDA is now sorted.
-Improved the Message Monitor UI to make it easier to use. -Added a Message Monitor in Tech Storage, hopefully so it will be used more. You will still need the key to use it. -You need the key to turn servers on/off remotely via the Message Monitor. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4099 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -246,6 +246,31 @@
|
||||
/proc/capitalize(var/t as text)
|
||||
return uppertext(copytext(t, 1, 2)) + copytext(t, 2)
|
||||
|
||||
//Sorts Atoms by their name property.
|
||||
//Sorry for the copy+pasta, I doubt quick sorting will change anytime soon though.
|
||||
// Order 1 = Ascending / Order -1 = Descending
|
||||
/proc/sortAtom(var/list/atom/L, var/order = 1)
|
||||
if(isnull(L) || L.len < 2)
|
||||
return L
|
||||
var/middle = L.len / 2 + 1
|
||||
return mergeAtoms(sortAtom(L.Copy(0,middle)), sortAtom(L.Copy(middle)), order)
|
||||
|
||||
/proc/mergeAtoms(var/list/atom/L, var/list/atom/R, var/order = 1)
|
||||
var/Li=1
|
||||
var/Ri=1
|
||||
var/list/result = new()
|
||||
while(Li <= L.len && Ri <= R.len)
|
||||
var/atom/rL = L[Li]
|
||||
var/atom/rR = R[Ri]
|
||||
if(sorttext(rL.name, rR.name) == order)
|
||||
result += L[Li++]
|
||||
else
|
||||
result += R[Ri++]
|
||||
|
||||
if(Li <= L.len)
|
||||
return (result + L.Copy(Li, 0))
|
||||
return (result + R.Copy(Ri, 0))
|
||||
|
||||
/proc/sortRecord(var/list/datum/data/record/L, var/field = "name", var/order = 1)
|
||||
if(isnull(L) || L.len < 2)
|
||||
return L
|
||||
|
||||
Reference in New Issue
Block a user