Merge pull request #25143 from Cyberboss/ControllerRestart

Fixes some badness with controller restarting
This commit is contained in:
Cheridan
2017-03-17 15:12:34 -05:00
committed by GitHub
2 changed files with 6 additions and 4 deletions
+1 -2
View File
@@ -42,8 +42,7 @@
return
switch(controller)
if("Master")
new/datum/controller/master()
Master.process()
Recreate_MC()
feedback_add_details("admin_verb","RMC")
if("Failsafe")
new /datum/controller/failsafe()
+5 -2
View File
@@ -20,6 +20,7 @@ var/datum/controller/failsafe/Failsafe
// Track the MC iteration to make sure its still on track.
var/master_iteration = 0
var/running = TRUE
/datum/controller/failsafe/New()
// Highlander-style: there can only be one! Kill off the old and replace it with the new.
@@ -32,14 +33,16 @@ var/datum/controller/failsafe/Failsafe
/datum/controller/failsafe/Initialize()
set waitfor = 0
Failsafe.Loop()
qdel(Failsafe) //when Loop() returns, we delete ourselves and let the mc recreate us
if(!QDELETED(src))
qdel(src) //when Loop() returns, we delete ourselves and let the mc recreate us
/datum/controller/failsafe/Destroy()
running = FALSE
..()
return QDEL_HINT_HARDDEL_NOW
/datum/controller/failsafe/proc/Loop()
while(1)
while(running)
lasttick = world.time
if(!Master)
// Replace the missing Master! This should never, ever happen.