mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 05:30:05 +01:00
Fixes a long lasting runtime with filter data priority sorting.
This commit is contained in:
@@ -35,7 +35,7 @@ GLOBAL_VAR_INIT(cmp_field, "name")
|
||||
|
||||
/proc/cmp_datum_text_dsc(datum/a, datum/b, variable)
|
||||
return sorttext(a.vars[variable], b.vars[variable])
|
||||
|
||||
|
||||
/proc/cmp_ckey_asc(client/a, client/b)
|
||||
return sorttext(b.ckey, a.ckey)
|
||||
|
||||
@@ -51,6 +51,9 @@ GLOBAL_VAR_INIT(cmp_field, "name")
|
||||
/proc/cmp_subsystem_priority(datum/controller/subsystem/a, datum/controller/subsystem/b)
|
||||
return a.priority - b.priority
|
||||
|
||||
/proc/cmp_filter_data_priority(list/A, list/B)
|
||||
return A["priority"] - B["priority"]
|
||||
|
||||
/proc/cmp_timer(datum/timedevent/a, datum/timedevent/b)
|
||||
return a.timeToRun - b.timeToRun
|
||||
|
||||
|
||||
+2
-3
@@ -1158,8 +1158,7 @@
|
||||
target.log_message(reverse_message, LOG_ATTACK, color="orange", log_globally=FALSE)
|
||||
|
||||
/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
|
||||
@@ -1167,7 +1166,7 @@
|
||||
|
||||
/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()
|
||||
|
||||
Reference in New Issue
Block a user