From 0411299a2394092b9f89f81a34023bdbe17afcb9 Mon Sep 17 00:00:00 2001 From: LetterJay Date: Wed, 10 May 2017 21:42:48 -0500 Subject: [PATCH] fixes issue with config loading --- code/_globalvars/logging.dm | 40 ++++++++++++++++--------------- code/controllers/configuration.dm | 28 +++++++++++----------- code/world.dm | 7 +++++- 3 files changed, 41 insertions(+), 34 deletions(-) diff --git a/code/_globalvars/logging.dm b/code/_globalvars/logging.dm index 9e3c46872e..00665bdfe2 100644 --- a/code/_globalvars/logging.dm +++ b/code/_globalvars/logging.dm @@ -10,23 +10,25 @@ GLOBAL_VAR(world_href_log) GLOBAL_PROTECT(world_href_log) GLOBAL_VAR(round_id) GLOBAL_PROTECT(round_id) - -GLOBAL_LIST_EMPTY(bombers) -GLOBAL_PROTECT(bombers) -GLOBAL_LIST_EMPTY(admin_log) -GLOBAL_PROTECT(admin_log) -GLOBAL_LIST_EMPTY(lastsignalers) //keeps last 100 signals here in format: "[src] used \ref[src] @ location [src.loc]: [freq]/[code]" -GLOBAL_PROTECT(lastsignalers) -GLOBAL_LIST_EMPTY(lawchanges) //Stores who uploaded laws to which silicon-based lifeform, and what the law was -GLOBAL_PROTECT(lawchanges) - -GLOBAL_LIST_EMPTY(combatlog) -GLOBAL_PROTECT(combatlog) -GLOBAL_LIST_EMPTY(IClog) -GLOBAL_PROTECT(IClog) -GLOBAL_LIST_EMPTY(OOClog) -GLOBAL_PROTECT(OOClog) -GLOBAL_LIST_EMPTY(adminlog) -GLOBAL_PROTECT(adminlog) - +GLOBAL_VAR(config_error_log) +GLOBAL_PROTECT(config_error_log) + +GLOBAL_LIST_EMPTY(bombers) +GLOBAL_PROTECT(bombers) +GLOBAL_LIST_EMPTY(admin_log) +GLOBAL_PROTECT(admin_log) +GLOBAL_LIST_EMPTY(lastsignalers) //keeps last 100 signals here in format: "[src] used \ref[src] @ location [src.loc]: [freq]/[code]" +GLOBAL_PROTECT(lastsignalers) +GLOBAL_LIST_EMPTY(lawchanges) //Stores who uploaded laws to which silicon-based lifeform, and what the law was +GLOBAL_PROTECT(lawchanges) + +GLOBAL_LIST_EMPTY(combatlog) +GLOBAL_PROTECT(combatlog) +GLOBAL_LIST_EMPTY(IClog) +GLOBAL_PROTECT(IClog) +GLOBAL_LIST_EMPTY(OOClog) +GLOBAL_PROTECT(OOClog) +GLOBAL_LIST_EMPTY(adminlog) +GLOBAL_PROTECT(adminlog) + GLOBAL_LIST_EMPTY(active_turfs_startlist) \ No newline at end of file diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 76e29f8c5c..8c29948405 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -267,7 +267,7 @@ if(M.config_tag) if(!(M.config_tag in modes)) // ensure each mode is added only once - GLOB.world_game_log << "Adding game mode [M.name] ([M.config_tag]) to configuration." + GLOB.config_error_log << "Adding game mode [M.name] ([M.config_tag]) to configuration." modes += M.config_tag mode_names[M.config_tag] = M.name probabilities[M.config_tag] = M.probability @@ -532,7 +532,7 @@ if("error_msg_delay") error_msg_delay = text2num(value) else - GLOB.world_game_log << "Unknown setting in configuration: '[name]'" + GLOB.config_error_log << "Unknown setting in configuration: '[name]'" else if(type == "game_options") switch(name) @@ -595,13 +595,13 @@ if(mode_name in modes) continuous[mode_name] = 1 else - GLOB.world_game_log << "Unknown continuous configuration definition: [mode_name]." + GLOB.config_error_log << "Unknown continuous configuration definition: [mode_name]." if("midround_antag") var/mode_name = lowertext(value) if(mode_name in modes) midround_antag[mode_name] = 1 else - GLOB.world_game_log << "Unknown midround antagonist configuration definition: [mode_name]." + GLOB.config_error_log << "Unknown midround antagonist configuration definition: [mode_name]." if("midround_antag_time_check") midround_antag_time_check = text2num(value) if("midround_antag_life_check") @@ -617,9 +617,9 @@ if(mode_name in modes) min_pop[mode_name] = text2num(mode_value) else - GLOB.world_game_log << "Unknown minimum population configuration definition: [mode_name]." + GLOB.config_error_log << "Unknown minimum population configuration definition: [mode_name]." else - GLOB.world_game_log << "Incorrect minimum population configuration definition: [mode_name] [mode_value]." + GLOB.config_error_log << "Incorrect minimum population configuration definition: [mode_name] [mode_value]." if("max_pop") var/pop_pos = findtext(value, " ") var/mode_name = null @@ -631,9 +631,9 @@ if(mode_name in modes) max_pop[mode_name] = text2num(mode_value) else - GLOB.world_game_log << "Unknown maximum population configuration definition: [mode_name]." + GLOB.config_error_log << "Unknown maximum population configuration definition: [mode_name]." else - GLOB.world_game_log << "Incorrect maximum population configuration definition: [mode_name] [mode_value]." + GLOB.config_error_log << "Incorrect maximum population configuration definition: [mode_name] [mode_value]." if("shuttle_refuel_delay") shuttle_refuel_delay = text2num(value) if("show_game_type_odds") @@ -661,9 +661,9 @@ if(prob_name in modes) probabilities[prob_name] = text2num(prob_value) else - GLOB.world_game_log << "Unknown game mode probability configuration definition: [prob_name]." + GLOB.config_error_log << "Unknown game mode probability configuration definition: [prob_name]." else - GLOB.world_game_log << "Incorrect probability configuration definition: [prob_name] [prob_value]." + GLOB.config_error_log << "Incorrect probability configuration definition: [prob_name] [prob_value]." if("protect_roles_from_antagonist") protect_roles_from_antagonist = 1 @@ -710,7 +710,7 @@ // Value is in the form "LAWID,NUMBER" var/list/L = splittext(value, ",") if(L.len != 2) - GLOB.world_game_log << "Invalid LAW_WEIGHT: " + t + GLOB.config_error_log << "Invalid LAW_WEIGHT: " + t continue var/lawid = L[1] var/weight = text2num(L[2]) @@ -767,7 +767,7 @@ if ("mentor_legacy_system") mentor_legacy_system = 1 // else - // GLOB.world_game_log << "Adding game mode [M.name] ([M.config_tag]) to configuration." + // GLOB.config_error_log << "Adding game mode [M.name] ([M.config_tag]) to configuration." fps = round(fps) if(fps <= 0) @@ -821,7 +821,7 @@ maplist[currentmap.map_name] = currentmap currentmap = null else - GLOB.world_game_log << "Unknown command in map vote config: '[command]'" + GLOB.config_error_log << "Unknown command in map vote config: '[command]'" /datum/configuration/proc/loadsql(filename) @@ -865,7 +865,7 @@ if("feedback_tableprefix") global.sqlfdbktableprefix = value else - GLOB.world_game_log << "Unknown setting in configuration: '[name]'" + GLOB.config_error_log << "Unknown setting in configuration: '[name]'" /datum/configuration/proc/pick_mode(mode_name) // I wish I didn't have to instance the game modes in order to look up diff --git a/code/world.dm b/code/world.dm index 8db80e30dc..e76cd96341 100644 --- a/code/world.dm +++ b/code/world.dm @@ -25,6 +25,8 @@ else external_rsc_urls.Cut(i,i+1) #endif + GLOB.config_error_log = file("data/logs/config_error.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) config = new GLOB.log_directory = "data/logs/[time2text(world.realtime, "YYYY/MM/DD")]/round-" if(config.sql_enabled) @@ -49,8 +51,11 @@ GLOB.world_attack_log << "\n\nStarting up round ID [GLOB.round_id]. [time_stamp()]\n---------------------" GLOB.world_runtime_log << "\n\nStarting up round ID [GLOB.round_id]. [time_stamp()]\n---------------------" GLOB.changelog_hash = md5('html/changelog.html') //used for telling if the changelog has changed recently + if(fexists(GLOB.config_error_log)) + fcopy(GLOB.config_error_log, "[GLOB.log_directory]/config_error.log") + fdel(GLOB.config_error_log) + - make_datum_references_lists() //initialises global lists for referencing frequently used datums (so that we only ever do it once) GLOB.revdata.DownloadPRDetails() load_mode() load_motd()