Merge pull request #10113 from Ghommie/Ghommie-cit448

Fixes a long lasting runtime with filter data sorting.
This commit is contained in:
Putnam3145
2019-12-09 13:49:41 -08:00
committed by GitHub
2 changed files with 5 additions and 3 deletions
+3
View File
@@ -23,6 +23,9 @@ GLOBAL_VAR_INIT(cmp_field, "name")
/proc/cmp_records_dsc(datum/data/record/a, datum/data/record/b)
return sorttext(a.fields[GLOB.cmp_field], b.fields[GLOB.cmp_field])
/proc/cmp_filter_data_priority(list/A, list/B)
return A["priority"] - B["priority"]
/proc/cmp_ckey_asc(client/a, client/b)
return sorttext(b.ckey, a.ckey)
+2 -3
View File
@@ -809,8 +809,7 @@ Proc for attack log creation, because really why not
// Filter stuff
/atom/movable/proc/add_filter(name,priority,list/params)
if(!filter_data)
filter_data = list()
LAZYINITLIST(filter_data)
var/list/p = params.Copy()
p["priority"] = priority
filter_data[name] = p
@@ -818,7 +817,7 @@ Proc for attack log creation, because really why not
/atom/movable/proc/update_filters()
filters = null
sortTim(filter_data,associative = TRUE)
filter_data = sortTim(filter_data, /proc/cmp_filter_data_priority, TRUE)
for(var/f in filter_data)
var/list/data = filter_data[f]
var/list/arguments = data.Copy()