mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 07:38:05 +01:00
valid_subtypes proc (#93541)
## About The Pull Request discussed in #93439, a generic proc for getting a list of all types minus abstract types. applies this to most instances of a for loop that currently filters out abstract types it SHOULD be a nothing burger for performance, however I have not bench marked the difference. (also testing, there is a total of 7 calls in init to it)
This commit is contained in:
@@ -50,17 +50,13 @@ GLOBAL_LIST_INIT(preference_entries_by_key, init_preference_entries_by_key())
|
||||
|
||||
/proc/init_preference_entries()
|
||||
var/list/output = list()
|
||||
for (var/datum/preference/preference_type as anything in subtypesof(/datum/preference))
|
||||
if (initial(preference_type.abstract_type) == preference_type)
|
||||
continue
|
||||
for (var/datum/preference/preference_type as anything in valid_subtypesof(/datum/preference))
|
||||
output[preference_type] = new preference_type
|
||||
return output
|
||||
|
||||
/proc/init_preference_entries_by_key()
|
||||
var/list/output = list()
|
||||
for (var/datum/preference/preference_type as anything in subtypesof(/datum/preference))
|
||||
if (initial(preference_type.abstract_type) == preference_type)
|
||||
continue
|
||||
for (var/datum/preference/preference_type as anything in valid_subtypesof(/datum/preference))
|
||||
output[initial(preference_type.savefile_key)] = GLOB.preference_entries[preference_type]
|
||||
return output
|
||||
|
||||
|
||||
Reference in New Issue
Block a user