Skip to content

Commit

Permalink
some tiny optimizations/shifting things around, removes 2 unused files (
Browse files Browse the repository at this point in the history
#5643)

title

---------

Co-authored-by: silicons <[email protected]>
  • Loading branch information
silicons and silicons authored Jun 25, 2023
1 parent 104bcfd commit d5833cb
Show file tree
Hide file tree
Showing 29 changed files with 66 additions and 888 deletions.
11 changes: 1 addition & 10 deletions citadel.dme
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@
#include "code\controllers\subsystem\dcs.dm"
#include "code\controllers\subsystem\DPC.dm"
#include "code\controllers\subsystem\early_assets.dm"
#include "code\controllers\subsystem\early_init.dm"
#include "code\controllers\subsystem\emergency_shuttle.dm"
#include "code\controllers\subsystem\events.dm"
#include "code\controllers\subsystem\fail2topic.dm"
Expand Down Expand Up @@ -767,14 +768,6 @@
#include "code\datums\holograms\types\species.dm"
#include "code\datums\interfaces\appearance.dm"
#include "code\datums\interfaces\procpath.dm"
#include "code\datums\locations\locations.dm"
#include "code\datums\locations\nyx.dm"
#include "code\datums\locations\qerrvallis.dm"
#include "code\datums\locations\s_randarr.dm"
#include "code\datums\locations\sol.dm"
#include "code\datums\locations\tau_ceti.dm"
#include "code\datums\locations\uueoa_esa.dm"
#include "code\datums\locations\vir.dm"
#include "code\datums\looping_sounds\_looping_sound.dm"
#include "code\datums\looping_sounds\item_sounds.dm"
#include "code\datums\looping_sounds\machinery_sounds.dm"
Expand Down Expand Up @@ -870,12 +863,10 @@
#include "code\game\AStar.dm"
#include "code\game\radio.dm"
#include "code\game\response_team.dm"
#include "code\game\sd_Alert.dm"
#include "code\game\shuttle_engines.dm"
#include "code\game\skincmd.dm"
#include "code\game\sound.dm"
#include "code\game\statistics.dm"
#include "code\game\trader_visit.dm"
#include "code\game\world.dm"
#include "code\game\antagonist\_antagonist_setup.dm"
#include "code\game\antagonist\antagonist.dm"
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/controllers/_subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ DEFINE_BITFIELD(runlevels, list(
#define INIT_ORDER_FAIL2TOPIC 200
#define INIT_ORDER_TIMER 195
#define INIT_ORDER_DBCORE 190
#define INIT_ORDER_EARLY_INIT 185
#define INIT_ORDER_REPOSITORY 180
#define INIT_ORDER_STATPANELS 170
#define INIT_ORDER_INPUT 160
Expand Down
15 changes: 8 additions & 7 deletions code/__HELPERS/icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1127,29 +1127,30 @@ GLOBAL_LIST_INIT(freon_color_matrix, list("#2E5E69", "#60A2A8", "#A1AFB1", rgb(0
color[3] = color[1] * cm[7] + color[2] * cm[8] + color[3] * cm[9] + cm[12] * 255
return rgb(color[1], color[2], color[3])

// citadel edit: use this so we can VV it at a negligible performance hit.
GLOBAL_LIST_EMPTY(icon_exists_cache)
/**
* Checks if the given iconstate exists in the given file, caching the result.
* Setting scream to TRUE will print a stack trace ONCE.
* Written by Kapu1178
*/
/proc/icon_exists(file, state, scream)
var/static/list/icon_states_cache = list()
if(icon_states_cache[file]?[state])
if(GLOB.icon_exists_cache[file]?[state])
return TRUE

if(icon_states_cache[file]?[state] == FALSE)
if(GLOB.icon_exists_cache[file]?[state] == FALSE)
return FALSE

var/list/states = icon_states(file)

if(!icon_states_cache[file])
icon_states_cache[file] = list()
if(!GLOB.icon_exists_cache[file])
GLOB.icon_exists_cache[file] = list()

if(state in states)
icon_states_cache[file][state] = TRUE
GLOB.icon_exists_cache[file][state] = TRUE
return TRUE
else
icon_states_cache[file][state] = FALSE
GLOB.icon_exists_cache[file][state] = FALSE
if(scream)
stack_trace("Icon Lookup for state: [state] in file [file] failed.")
return FALSE
13 changes: 13 additions & 0 deletions code/__HELPERS/lists/types_typecaches.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,16 @@
for(var/T in typesof(P))
L[T] = TRUE
return L

/**
* cached typecache of a given path list
*
* do not mutate the lists returned by this!
*/
/proc/cached_typecacheof(path = list(), ignore_root_path = FALSE, only_root_path = FALSE)
var/key = json_encode(args)
if(GLOB.typecaches[key])
return GLOB.typecaches[key]
return (GLOB.typecaches[key] = typecacheof(path, ignore_root_path, only_root_path))

GLOBAL_LIST_EMPTY(typecaches)
26 changes: 0 additions & 26 deletions code/_globals/lists/names.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,18 @@
//! would include in rsc if ' was used

GLOBAL_LIST_INIT(ai_names, world.file2list("strings/names/ai.txt"))
// GLOBAL_LIST_INIT(carp_names, world.file2list("strings/names/carp.txt"))
GLOBAL_LIST_INIT(clown_names, world.file2list("strings/names/clown.txt"))
// GLOBAL_LIST_INIT(clown_names, world.file2list("strings/names/clown.txt"))
GLOBAL_LIST_INIT(commando_names, world.file2list("strings/names/death_commando.txt"))
// GLOBAL_LIST_INIT(ethereal_names, world.file2list("strings/names/ethereal.txt"))
GLOBAL_LIST_INIT(first_names_female, world.file2list("strings/names/first_female.txt"))
GLOBAL_LIST_INIT(first_names_male, world.file2list("strings/names/first_male.txt"))
// GLOBAL_LIST_INIT(first_names, world.file2list("strings/names/first.txt"))
// GLOBAL_LIST_INIT(golem_names, world.file2list("strings/names/golem.txt"))
GLOBAL_LIST_INIT(last_names, world.file2list("strings/names/last.txt"))
// GLOBAL_LIST_INIT(lizard_names_female, world.file2list("strings/names/lizard_female.txt"))
// GLOBAL_LIST_INIT(lizard_names_female, world.file2list("strings/names/lizard_female.txt"))
// GLOBAL_LIST_INIT(lizard_names_male, world.file2list("strings/names/lizard_male.txt"))
// GLOBAL_LIST_INIT(lizard_names_male, world.file2list("strings/names/lizard_male.txt"))
// GLOBAL_LIST_INIT(megacarp_first_names, world.file2list("strings/names/megacarp1.txt"))
// GLOBAL_LIST_INIT(megacarp_last_names, world.file2list("strings/names/megacarp2.txt"))
// GLOBAL_LIST_INIT(mime_names, world.file2list("strings/names/mime.txt"))
// GLOBAL_LIST_INIT(moth_first, world.file2list("strings/names/moth_first.txt"))
// GLOBAL_LIST_INIT(moth_last, world.file2list("strings/names/moth_last.txt"))
// GLOBAL_LIST_INIT(nightmare_names, world.file2list("strings/names/nightmare.txt"))
GLOBAL_LIST_INIT(ninja_names, world.file2list("strings/names/ninjaname.txt"))
GLOBAL_LIST_INIT(ninja_titles, world.file2list("strings/names/ninjatitle.txt"))
// GLOBAL_LIST_INIT(plasmaman_names, world.file2list("strings/names/plasmaman.txt"))
// GLOBAL_LIST_INIT(posibrain_names, world.file2list("strings/names/posibrain.txt"))
// GLOBAL_LIST_INIT(religion_names, world.file2list("strings/names/religion.txt"))
GLOBAL_LIST_INIT(wizard_first, world.file2list("strings/names/wizardfirst.txt"))
GLOBAL_LIST_INIT(wizard_second, world.file2list("strings/names/wizardsecond.txt"))

GLOBAL_LIST_INIT(skrell_first_names, world.file2list("strings/names/skrell_first.txt"))
GLOBAL_LIST_INIT(skrell_last_names, world.file2list("strings/names/skrell_last.txt"))

GLOBAL_LIST_INIT(adjectives, world.file2list("strings/names/adjectives.txt"))
// GLOBAL_LIST_INIT(adverbs, world.file2list("strings/names/adverbs.txt"))
// GLOBAL_LIST_INIT(dream_strings, world.file2list("strings/dreamstrings.txt"))
// GLOBAL_LIST_INIT(greek_alphabet, world.file2list("strings/greek_alphabet.txt"))
// GLOBAL_LIST_INIT(gross_adjectives, world.file2list("strings/names/gross_adjectives.txt"))
// GLOBAL_LIST_INIT(hive_names, world.file2list("strings/names/hive_names.txt"))
// GLOBAL_LIST_INIT(ing_verbs, world.file2list("strings/names/ing_verbs.txt"))
// GLOBAL_LIST_INIT(martial_prefix, world.file2list("strings/names/martial_prefix.txt"))
// GLOBAL_LIST_INIT(vampire_house_names, world.file2list("strings/names/vampire_house_names.txt"))
GLOBAL_LIST_INIT(verbs, world.file2list("strings/names/verbs.txt"))
1 change: 1 addition & 0 deletions code/_globals/lists/typecache.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

GLOBAL_LIST_INIT(typecache_mob, typecacheof(list(/mob)))
GLOBAL_LIST_INIT(typecache_living, typecacheof(list(/mob/living)))
GLOBAL_LIST_INIT(typecache_machine, typecacheof(list(/obj/machinery)))
GLOBAL_LIST_INIT(typecache_machine_or_structure, typecacheof(list(/obj/machinery))|typecacheof(list(/obj/structure)))
8 changes: 8 additions & 0 deletions code/controllers/subsystem/early_init.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
SUBSYSTEM_DEF(early_init)
name = "Early Init"
init_order = INIT_ORDER_EARLY_INIT
subsystem_flags = SS_NO_FIRE

/datum/controller/subsystem/early_init/Initialize()
init_inventory_slot_meta()
return ..()
76 changes: 0 additions & 76 deletions code/datums/locations/locations.dm

This file was deleted.

102 changes: 0 additions & 102 deletions code/datums/locations/nyx.dm

This file was deleted.

57 changes: 0 additions & 57 deletions code/datums/locations/qerrvallis.dm

This file was deleted.

Loading

0 comments on commit d5833cb

Please sign in to comment.