From bd7c22dda9ff7fce88fc28e0c9ccbb56a4d8945c Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Sat, 15 Sep 2018 05:34:14 -0400 Subject: [PATCH] Moves TgsInitializationsComplete call to immediately after world/New() (#39771) * Moves TgsInitializationsComplete call to immediately after world/New() * Subsystem PreInit data directory audit * world/New data directory audit * Needful here too * Remove SS_NO_INIT from SStitle * Don't create banlist.bdb for SQL banning * Stop creating legacy notes file * Moves iconCache from data to tmp --- code/__DEFINES/subsystems.dm | 1 + code/controllers/master.dm | 6 ++++-- code/controllers/subsystem/job.dm | 1 + code/controllers/subsystem/mapping.dm | 6 +++--- code/controllers/subsystem/title.dm | 8 ++++++-- code/game/world.dm | 4 ++-- code/modules/admin/NewBan.dm | 2 ++ code/modules/admin/sql_message_system.dm | 3 +++ code/modules/goonchat/browserOutput.dm | 2 +- 9 files changed, 23 insertions(+), 10 deletions(-) diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm index fbb3029b4f0..fdc4523e056 100644 --- a/code/__DEFINES/subsystems.dm +++ b/code/__DEFINES/subsystems.dm @@ -51,6 +51,7 @@ // Subsystems shutdown in the reverse of the order they initialize in // The numbers just define the ordering, they are meaningless otherwise. +#define INIT_ORDER_TITLE 20 #define INIT_ORDER_GARBAGE 19 #define INIT_ORDER_DBCORE 18 #define INIT_ORDER_BLACKBOX 17 diff --git a/code/controllers/master.dm b/code/controllers/master.dm index 0cc0c622d7b..93133985dc8 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -164,12 +164,15 @@ GLOBAL_REAL(Master, /datum/controller/master) = new // Please don't stuff random bullshit here, // Make a subsystem, give it the SS_NO_FIRE flag, and do your work in it's Initialize() -/datum/controller/master/Initialize(delay, init_sss) +/datum/controller/master/Initialize(delay, init_sss, tgs_prime) set waitfor = 0 if(delay) sleep(delay) + if(tgs_prime) + world.TgsInitializationComplete() + if(init_sss) init_subtypes(/datum/controller/subsystem, subsystems) @@ -202,7 +205,6 @@ GLOBAL_REAL(Master, /datum/controller/master) = new world.fps = CONFIG_GET(number/fps) var/initialized_tod = REALTIMEOFDAY - world.TgsInitializationComplete() if(sleep_offline_after_initializations) world.sleep_offline = TRUE sleep(1) diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm index 77c642b70c0..45d8b6500f5 100644 --- a/code/controllers/subsystem/job.dm +++ b/code/controllers/subsystem/job.dm @@ -15,6 +15,7 @@ SUBSYSTEM_DEF(job) var/overflow_role = "Assistant" /datum/controller/subsystem/job/Initialize(timeofday) + SSmapping.HACK_LoadMapConfig() if(!occupations.len) SetupOccupations() if(CONFIG_GET(flag/load_jobs_from_txt)) diff --git a/code/controllers/subsystem/mapping.dm b/code/controllers/subsystem/mapping.dm index 3a25d889e0b..787751502c8 100644 --- a/code/controllers/subsystem/mapping.dm +++ b/code/controllers/subsystem/mapping.dm @@ -34,17 +34,17 @@ SUBSYSTEM_DEF(mapping) var/datum/space_level/transit var/datum/space_level/empty_space -/datum/controller/subsystem/mapping/PreInit() +//dlete dis once #39770 is resolved +/datum/controller/subsystem/mapping/proc/HACK_LoadMapConfig() if(!config) #ifdef FORCE_MAP config = load_map_config(FORCE_MAP) #else config = load_map_config(error_if_missing = FALSE) #endif - return ..() - /datum/controller/subsystem/mapping/Initialize(timeofday) + HACK_LoadMapConfig() if(initialized) return if(config.defaulted) diff --git a/code/controllers/subsystem/title.dm b/code/controllers/subsystem/title.dm index 94dff9b7425..5bbc2b45ea6 100644 --- a/code/controllers/subsystem/title.dm +++ b/code/controllers/subsystem/title.dm @@ -1,13 +1,14 @@ SUBSYSTEM_DEF(title) name = "Title Screen" - flags = SS_NO_FIRE|SS_NO_INIT + flags = SS_NO_FIRE + init_order = INIT_ORDER_TITLE var/file_path var/icon/icon var/icon/previous_icon var/turf/closed/indestructible/splashscreen/splash_turf -/datum/controller/subsystem/title/PreInit() +/datum/controller/subsystem/title/Initialize() if(file_path && icon) return @@ -21,6 +22,7 @@ SUBSYSTEM_DEF(title) var/list/title_screens = list() var/use_rare_screens = prob(1) + SSmapping.HACK_LoadMapConfig() for(var/S in provisional_title_screens) var/list/L = splittext(S,"+") if((L.len == 1 && L[1] != "blank.png")|| (L.len > 1 && ((use_rare_screens && lowertext(L[1]) == "rare") || (lowertext(L[1]) == lowertext(SSmapping.config.map_name))))) @@ -39,6 +41,8 @@ SUBSYSTEM_DEF(title) if(splash_turf) splash_turf.icon = icon + return ..() + /datum/controller/subsystem/title/vv_edit_var(var_name, var_value) . = ..() if(.) diff --git a/code/game/world.dm b/code/game/world.dm index 0c7d256579a..2dfc21b8ca7 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -10,7 +10,7 @@ GLOBAL_VAR(restart_counter) SetupExternalRSC() - GLOB.config_error_log = GLOB.world_manifest_log = GLOB.world_pda_log = GLOB.world_job_debug_log = GLOB.sql_error_log = GLOB.world_href_log = GLOB.world_runtime_log = GLOB.world_attack_log = GLOB.world_game_log = "data/logs/config_error.log" //temporary file used to record errors with loading config, moved to log directory once logging is set bl + GLOB.config_error_log = GLOB.world_manifest_log = GLOB.world_pda_log = GLOB.world_job_debug_log = GLOB.sql_error_log = GLOB.world_href_log = GLOB.world_runtime_log = GLOB.world_attack_log = GLOB.world_game_log = "data/logs/config_error.[GUID()].log" //temporary file used to record errors with loading config, moved to log directory once logging is set bl make_datum_references_lists() //initialises global lists for referencing frequently used datums (so that we only ever do it once) @@ -45,7 +45,7 @@ GLOBAL_VAR(restart_counter) if(NO_INIT_PARAMETER in params) return - Master.Initialize(10, FALSE) + Master.Initialize(10, FALSE, TRUE) if(TEST_RUN_PARAMETER in params) HandleTestRun() diff --git a/code/modules/admin/NewBan.dm b/code/modules/admin/NewBan.dm index 7905a8d155e..6a21b2dbadf 100644 --- a/code/modules/admin/NewBan.dm +++ b/code/modules/admin/NewBan.dm @@ -61,6 +61,8 @@ GLOBAL_PROTECT(Banlist) return 1 /proc/LoadBans() + if(!CONFIG_GET(flag/ban_legacy_system)) + return GLOB.Banlist = new("data/banlist.bdb") log_admin("Loading Banlist") diff --git a/code/modules/admin/sql_message_system.dm b/code/modules/admin/sql_message_system.dm index 45a643dcacd..6e31d42fac1 100644 --- a/code/modules/admin/sql_message_system.dm +++ b/code/modules/admin/sql_message_system.dm @@ -554,6 +554,9 @@ #define NOTESFILE "data/player_notes.sav" //if the AUTOCONVERT_NOTES is turned on, anytime a player connects this will be run to try and add all their notes to the databas /proc/convert_notes_sql(ckey) + if(!fexists(NOTESFILE)) + return + var/savefile/notesfile = new(NOTESFILE) if(!notesfile) log_game("Error: Cannot access [NOTESFILE]") diff --git a/code/modules/goonchat/browserOutput.dm b/code/modules/goonchat/browserOutput.dm index ba50a8396ea..463df71f715 100644 --- a/code/modules/goonchat/browserOutput.dm +++ b/code/modules/goonchat/browserOutput.dm @@ -3,7 +3,7 @@ For the main html chat area *********************************/ //Precaching a bunch of shit -GLOBAL_DATUM_INIT(iconCache, /savefile, new("data/iconCache.sav")) //Cache of icons for the browser output +GLOBAL_DATUM_INIT(iconCache, /savefile, new("tmp/iconCache.sav")) //Cache of icons for the browser output //On client, created on login /datum/chatOutput