Make runlevels bitflags

This commit is contained in:
Cyberboss
2017-05-11 10:04:19 -04:00
parent 72f171495a
commit 1c6bd654b7
24 changed files with 35 additions and 35 deletions

View File

@@ -66,8 +66,7 @@
#define RUNLEVEL_INIT 0 #define RUNLEVEL_INIT 0
#define RUNLEVEL_LOBBY 1 #define RUNLEVEL_LOBBY 1
#define RUNLEVEL_SETUP 2 #define RUNLEVEL_SETUP 2
#define RUNLEVEL_GAME 3 #define RUNLEVEL_GAME 4
#define RUNLEVEL_POSTGAME 4 #define RUNLEVEL_POSTGAME 8
#define RUNLEVEL_MIN_DEFAULT RUNLEVEL_SETUP #define RUNLEVELS_DEFAULT (RUNLEVEL_SETUP | RUNLEVEL_GAME | RUNLEVEL_POSTGAME)
#define RUNLEVEL_MAX_DEFAULT RUNLEVEL_POSTGAME

View File

@@ -233,12 +233,17 @@ GLOBAL_VAR_INIT(CURRENT_TICKLIMIT, TICK_LIMIT_RUNNING)
timer += world.tick_lag * rand(1, 5) timer += world.tick_lag * rand(1, 5)
SS.next_fire = timer SS.next_fire = timer
continue continue
var/ss_max_runlevel = SS.runlevel_max
while(runlevel_sorted_subsystems.len < ss_max_runlevel)
runlevel_sorted_subsystems += list(list())
for(var/I in SS.runlevel_min to ss_max_runlevel) var/ss_runlevels = SS.runlevels
runlevel_sorted_subsystems[I] += SS var/added_to_any = FALSE
for(var/I in 1 to GLOB.bitflags.len)
if(ss_runlevels & GLOB.bitflags[I])
while(runlevel_sorted_subsystems.len < I)
runlevel_sorted_subsystems += list(list())
runlevel_sorted_subsystems[I] += SS
added_to_any = TRUE
if(!added_to_any)
WARNING("[SS.name] subsystem is not SS_NO_FIRE but also does not have any runlevels set!")
queue_head = null queue_head = null
queue_tail = null queue_tail = null

View File

@@ -28,8 +28,7 @@
var/datum/controller/subsystem/queue_next var/datum/controller/subsystem/queue_next
var/datum/controller/subsystem/queue_prev var/datum/controller/subsystem/queue_prev
var/runlevel_min = RUNLEVEL_MIN_DEFAULT //the minimum runlevel at which this subsystem will fire var/runlevels = RUNLEVELS_DEFAULT //points of the game at which the SS can fire
var/runlevel_max = RUNLEVEL_MAX_DEFAULT //the maximum runlevel at which this subsystem will fire
var/static/failure_strikes = 0 //How many times we suspect this subsystem has crashed the MC, 3 strikes and you're out! var/static/failure_strikes = 0 //How many times we suspect this subsystem has crashed the MC, 3 strikes and you're out!

View File

@@ -2,7 +2,7 @@ SUBSYSTEM_DEF(acid)
name = "Acid" name = "Acid"
priority = 40 priority = 40
flags = SS_NO_INIT|SS_BACKGROUND flags = SS_NO_INIT|SS_BACKGROUND
runlevel_min = RUNLEVEL_GAME runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
var/list/currentrun = list() var/list/currentrun = list()
var/list/processing = list() var/list/processing = list()

View File

@@ -12,7 +12,7 @@ SUBSYSTEM_DEF(air)
priority = 20 priority = 20
wait = 5 wait = 5
flags = SS_BACKGROUND flags = SS_BACKGROUND
runlevel_min = RUNLEVEL_GAME runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
var/cost_turfs = 0 var/cost_turfs = 0
var/cost_groups = 0 var/cost_groups = 0

View File

@@ -1,7 +1,7 @@
SUBSYSTEM_DEF(augury) SUBSYSTEM_DEF(augury)
name = "Augury" name = "Augury"
flags = SS_NO_INIT flags = SS_NO_INIT
runlevel_min = RUNLEVEL_GAME runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
var/list/watchers = list() var/list/watchers = list()
var/list/doombringers = list() var/list/doombringers = list()

View File

@@ -1,7 +1,7 @@
SUBSYSTEM_DEF(disease) SUBSYSTEM_DEF(disease)
name = "Disease" name = "Disease"
flags = SS_KEEP_TIMING|SS_NO_INIT flags = SS_KEEP_TIMING|SS_NO_INIT
runlevel_min = RUNLEVEL_GAME runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
var/list/currentrun = list() var/list/currentrun = list()
var/list/processing = list() var/list/processing = list()

View File

@@ -1,8 +1,7 @@
SUBSYSTEM_DEF(events) SUBSYSTEM_DEF(events)
name = "Events" name = "Events"
init_order = INIT_ORDER_EVENTS init_order = INIT_ORDER_EVENTS
runlevel_min = RUNLEVEL_GAME runlevels = RUNLEVEL_GAME
runlevel_max = RUNLEVEL_GAME
var/list/control = list() //list of all datum/round_event_control. Used for selecting events based on weight and occurrences. var/list/control = list() //list of all datum/round_event_control. Used for selecting events based on weight and occurrences.
var/list/running = list() //list of all existing /datum/round_event var/list/running = list() //list of all existing /datum/round_event

View File

@@ -2,7 +2,7 @@ SUBSYSTEM_DEF(fire_burning)
name = "Fire Burning" name = "Fire Burning"
priority = 40 priority = 40
flags = SS_NO_INIT|SS_BACKGROUND flags = SS_NO_INIT|SS_BACKGROUND
runlevel_min = RUNLEVEL_GAME runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
var/list/currentrun = list() var/list/currentrun = list()
var/list/processing = list() var/list/processing = list()

View File

@@ -3,7 +3,7 @@ SUBSYSTEM_DEF(garbage)
priority = 15 priority = 15
wait = 5 wait = 5
flags = SS_POST_FIRE_TIMING|SS_BACKGROUND|SS_NO_INIT flags = SS_POST_FIRE_TIMING|SS_BACKGROUND|SS_NO_INIT
runlevel_min = RUNLEVEL_LOBBY runlevels = RUNLEVELS_DEFAULT | RUNLEVEL_LOBBY
var/collection_timeout = 3000// deciseconds to wait to let running procs finish before we just say fuck it and force del() the object var/collection_timeout = 3000// deciseconds to wait to let running procs finish before we just say fuck it and force del() the object
var/delslasttick = 0 // number of del()'s we've done this tick var/delslasttick = 0 // number of del()'s we've done this tick

View File

@@ -2,8 +2,7 @@ SUBSYSTEM_DEF(inbounds)
name = "Inbounds" name = "Inbounds"
priority = 40 priority = 40
flags = SS_NO_INIT flags = SS_NO_INIT
runlevel_min = RUNLEVEL_GAME runlevels = RUNLEVEL_GAME
runlevel_max = RUNLEVEL_GAME
var/list/processing = list() var/list/processing = list()
var/list/currentrun = list() var/list/currentrun = list()

View File

@@ -2,7 +2,7 @@ SUBSYSTEM_DEF(mobs)
name = "Mobs" name = "Mobs"
priority = 100 priority = 100
flags = SS_KEEP_TIMING|SS_NO_INIT flags = SS_KEEP_TIMING|SS_NO_INIT
runlevel_min = RUNLEVEL_GAME runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
var/list/currentrun = list() var/list/currentrun = list()

View File

@@ -7,7 +7,7 @@ SUBSYSTEM_DEF(npcpool)
name = "NPC Pool" name = "NPC Pool"
flags = SS_POST_FIRE_TIMING|SS_NO_INIT|SS_BACKGROUND flags = SS_POST_FIRE_TIMING|SS_NO_INIT|SS_BACKGROUND
priority = 20 priority = 20
runlevel_min = RUNLEVEL_GAME runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
var/list/canBeUsed = list() var/list/canBeUsed = list()
var/list/needsDelegate = list() var/list/needsDelegate = list()

View File

@@ -3,7 +3,7 @@ SUBSYSTEM_DEF(parallax)
wait = 2 wait = 2
flags = SS_POST_FIRE_TIMING | SS_BACKGROUND | SS_NO_INIT flags = SS_POST_FIRE_TIMING | SS_BACKGROUND | SS_NO_INIT
priority = 65 priority = 65
runlevel_min = RUNLEVEL_LOBBY runlevels = RUNLEVEL_LOBBY | RUNLEVELS_DEFAULT
var/list/currentrun var/list/currentrun
/datum/controller/subsystem/parallax/fire(resumed = 0) /datum/controller/subsystem/parallax/fire(resumed = 0)

View File

@@ -4,7 +4,7 @@ PROCESSING_SUBSYSTEM_DEF(overlays)
wait = 1 wait = 1
priority = 500 priority = 500
init_order = INIT_ORDER_OVERLAY init_order = INIT_ORDER_OVERLAY
runlevel_min = RUNLEVEL_LOBBY runlevels = RUNLEVELS_DEFAULT | RUNLEVEL_SETUP
stat_tag = "Ov" stat_tag = "Ov"
currentrun = null currentrun = null

View File

@@ -5,7 +5,7 @@ SUBSYSTEM_DEF(server_maint)
wait = 6 wait = 6
flags = SS_POST_FIRE_TIMING flags = SS_POST_FIRE_TIMING
priority = 10 priority = 10
runlevel_min = RUNLEVEL_LOBBY runlevels = RUNLEVEL_LOBBY | RUNLEVELS_DEFAULT
var/list/currentrun var/list/currentrun
/datum/controller/subsystem/server_maint/Initialize(timeofday) /datum/controller/subsystem/server_maint/Initialize(timeofday)

View File

@@ -5,7 +5,7 @@ SUBSYSTEM_DEF(shuttle)
wait = 10 wait = 10
init_order = INIT_ORDER_SHUTTLE init_order = INIT_ORDER_SHUTTLE
flags = SS_KEEP_TIMING|SS_NO_TICK_CHECK flags = SS_KEEP_TIMING|SS_NO_TICK_CHECK
runlevel_max = RUNLEVEL_GAME runlevels = RUNLEVEL_SETUP | RUNLEVEL_GAME
var/list/mobile = list() var/list/mobile = list()
var/list/stationary = list() var/list/stationary = list()

View File

@@ -3,7 +3,7 @@ SUBSYSTEM_DEF(spacedrift)
priority = 30 priority = 30
wait = 5 wait = 5
flags = SS_NO_INIT|SS_KEEP_TIMING flags = SS_NO_INIT|SS_KEEP_TIMING
runlevel_min = RUNLEVEL_GAME runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
var/list/currentrun = list() var/list/currentrun = list()
var/list/processing = list() var/list/processing = list()

View File

@@ -3,7 +3,7 @@ SUBSYSTEM_DEF(tgui)
wait = 9 wait = 9
flags = SS_NO_INIT flags = SS_NO_INIT
priority = 110 priority = 110
runlevel_min = RUNLEVEL_LOBBY runlevels = RUNLEVEL_LOBBY | RUNLEVELS_DEFAULT
var/list/currentrun = list() var/list/currentrun = list()
var/list/open_uis = list() // A list of open UIs, grouped by src_object and ui_key. var/list/open_uis = list() // A list of open UIs, grouped by src_object and ui_key.

View File

@@ -6,6 +6,7 @@ SUBSYSTEM_DEF(throwing)
priority = 25 priority = 25
wait = 1 wait = 1
flags = SS_NO_INIT|SS_KEEP_TIMING|SS_TICKER flags = SS_NO_INIT|SS_KEEP_TIMING|SS_TICKER
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
var/list/currentrun var/list/currentrun
var/list/processing = list() var/list/processing = list()

View File

@@ -6,8 +6,7 @@ SUBSYSTEM_DEF(ticker)
priority = 200 priority = 200
flags = SS_KEEP_TIMING flags = SS_KEEP_TIMING
runlevel_min = RUNLEVEL_LOBBY runlevels = RUNLEVEL_LOBBY | RUNLEVEL_SETUP | RUNLEVEL_GAME
runlevel_max = RUNLEVEL_GAME
var/current_state = GAME_STATE_STARTUP //state of current round (used by process()) Use the defines GAME_STATE_* ! var/current_state = GAME_STATE_STARTUP //state of current round (used by process()) Use the defines GAME_STATE_* !
var/force_ending = 0 //Round was ended by admin intervention var/force_ending = 0 //Round was ended by admin intervention

View File

@@ -2,7 +2,7 @@ SUBSYSTEM_DEF(time_track)
name = "Time Tracking" name = "Time Tracking"
wait = 600 wait = 600
flags = SS_NO_INIT|SS_NO_TICK_CHECK flags = SS_NO_INIT|SS_NO_TICK_CHECK
runlevel_min = RUNLEVEL_LOBBY runlevels = RUNLEVEL_LOBBY | RUNLEVELS_DEFAULT
var/time_dilation_current = 0 var/time_dilation_current = 0

View File

@@ -4,7 +4,7 @@ SUBSYSTEM_DEF(vote)
flags = SS_KEEP_TIMING|SS_NO_INIT flags = SS_KEEP_TIMING|SS_NO_INIT
runlevel_min = RUNLEVEL_LOBBY runlevels = RUNLEVEL_LOBBY | RUNLEVELS_DEFAULT
var/initiator = null var/initiator = null
var/started_time = null var/started_time = null

View File

@@ -3,8 +3,7 @@ SUBSYSTEM_DEF(weather)
name = "Weather" name = "Weather"
flags = SS_BACKGROUND flags = SS_BACKGROUND
wait = 10 wait = 10
runlevel_min = RUNLEVEL_GAME runlevels = RUNLEVEL_GAME
runlevel_max = RUNLEVEL_GAME
var/list/processing = list() var/list/processing = list()
var/list/existing_weather = list() var/list/existing_weather = list()
var/list/eligible_zlevels = list(ZLEVEL_LAVALAND) var/list/eligible_zlevels = list(ZLEVEL_LAVALAND)