From 3a7640d436a3444cb6679ab23f9a1888056d4d7b Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Sun, 17 Sep 2017 12:01:33 -0500 Subject: [PATCH] [MIRROR] Fixes random gamemode instantiation (#2803) * Fixes random gamemode instantiation * Fixes random gamemode instantiation --- code/controllers/configuration.dm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index d19484fd3f..4ba51a9fcb 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -944,11 +944,12 @@ GLOBAL_PROTECT(config_dir) /datum/configuration/proc/pick_mode(mode_name) // I wish I didn't have to instance the game modes in order to look up // their information, but it is the only way (at least that I know of). + // ^ This guy didn't try hard enough for(var/T in gamemode_cache) - var/datum/game_mode/M = new T() - if(M.config_tag && M.config_tag == mode_name) - return M - qdel(M) + var/datum/game_mode/M = T + var/ct = initial(M.config_tag) + if(ct && ct == mode_name) + return new T return new /datum/game_mode/extended() /datum/configuration/proc/get_runnable_modes()