SCREEE. fuck this. I'mma just revert at this point, but don't want to lose progress.
This commit is contained in:
@@ -24,4 +24,26 @@ GLOBAL_LIST_EMPTY(whitelisted_species_list)
|
||||
|
||||
/proc/log_mentor(text)
|
||||
GLOB.mentorlog.Add(text)
|
||||
GLOB.world_game_log << "\[[time_stamp()]]MENTOR: [text]"
|
||||
GLOB.world_game_log << "\[[time_stamp()]]MENTOR: [text]"
|
||||
|
||||
|
||||
//Mergesort: any value in a list, preserves key=value structure
|
||||
/proc/sortAssoc(var/list/L)
|
||||
if(L.len < 2)
|
||||
return L
|
||||
var/middle = L.len / 2 + 1 // Copy is first,second-1
|
||||
return mergeAssoc(sortAssoc(L.Copy(0,middle)), sortAssoc(L.Copy(middle))) //second parameter null = to end of list
|
||||
|
||||
/proc/mergeAssoc(var/list/L, var/list/R)
|
||||
var/Li=1
|
||||
var/Ri=1
|
||||
var/list/result = new()
|
||||
while(Li <= L.len && Ri <= R.len)
|
||||
if(sorttext(L[Li], R[Ri]) < 1)
|
||||
result += R&R[Ri++]
|
||||
else
|
||||
result += L&L[Li++]
|
||||
|
||||
if(Li <= L.len)
|
||||
return (result + L.Copy(Li, 0))
|
||||
return (result + R.Copy(Ri, 0))
|
||||
Reference in New Issue
Block a user