mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-12 16:37:19 +01:00
Fixes subsystem issues and other timer bugfixes (#13061)
* Debug code to figure out why timer fire isn't yielding * please man * thing 2 * BALLS * BALLS 2 * correction * remove debug shitcode Co-authored-by: Matt Atlas <liermattia@gmail.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
/// Helper for getting the correct bucket for a given timer
|
||||
#define BUCKET_POS(timer) (((round((timer.timeToRun - SStimer.head_offset) / world.tick_lag)+1) % BUCKET_LEN)||BUCKET_LEN)
|
||||
/// Gets the maximum time at which timers will be invoked from buckets, used for deferring to secondary queue
|
||||
#define TIMER_MAX (world.time + TICKS2DS(min(BUCKET_LEN-(SStimer.practical_offset-DS2TICKS(world.time - SStimer.head_offset))-1, BUCKET_LEN-1)))
|
||||
#define TIMER_MAX (SStimer.head_offset + TICKS2DS(BUCKET_LEN + SStimer.practical_offset - 1))
|
||||
/// Max float with integer precision
|
||||
#define TIMER_ID_MAX (2**24)
|
||||
|
||||
@@ -261,6 +261,12 @@ var/datum/controller/subsystem/timer/SStimer
|
||||
// Add all timed events from the secondary queue as well
|
||||
alltimers += second_queue
|
||||
|
||||
for (var/datum/timedevent/t as anything in alltimers)
|
||||
t.bucket_joined = FALSE
|
||||
t.bucket_pos = -1
|
||||
t.prev = null
|
||||
t.next = null
|
||||
|
||||
// If there are no timers being tracked by the subsystem,
|
||||
// there is no need to do any further rebuilding
|
||||
if (!length(alltimers))
|
||||
@@ -304,6 +310,7 @@ var/datum/controller/subsystem/timer/SStimer
|
||||
new_bucket_count++
|
||||
var/bucket_pos = BUCKET_POS(timer)
|
||||
timer.bucket_pos = bucket_pos
|
||||
timer.bucket_joined = TRUE
|
||||
|
||||
var/datum/timedevent/bucket_head = bucket_list[bucket_pos]
|
||||
if (!bucket_head)
|
||||
@@ -452,7 +459,7 @@ var/datum/controller/subsystem/timer/SStimer
|
||||
if(buckethead == src)
|
||||
bucket_list[bucket_pos] = next
|
||||
SStimer.bucket_count--
|
||||
else if(timeToRun < TIMER_MAX)
|
||||
else if(bucket_joined)
|
||||
SStimer.bucket_count--
|
||||
else
|
||||
var/l = length(second_queue)
|
||||
|
||||
Reference in New Issue
Block a user