Merge pull request #28469 from Cyberboss/TimerWarnings

Adds warning for misuse of deltimer
This commit is contained in:
Leo
2017-06-15 22:47:58 -03:00
committed by GitHub
2 changed files with 5 additions and 0 deletions

View File

@@ -16,6 +16,8 @@
#define TIMER_NO_INVOKE_WARNING 600 //number of byond ticks that are allowed to pass before the timer subsystem thinks it hung on something #define TIMER_NO_INVOKE_WARNING 600 //number of byond ticks that are allowed to pass before the timer subsystem thinks it hung on something
#define TIMER_ID_NULL -1
//For servers that can't do with any additional lag, set this to none in flightpacks.dm in subsystem/processing. //For servers that can't do with any additional lag, set this to none in flightpacks.dm in subsystem/processing.
#define FLIGHTSUIT_PROCESSING_NONE 0 #define FLIGHTSUIT_PROCESSING_NONE 0
#define FLIGHTSUIT_PROCESSING_FULL 1 #define FLIGHTSUIT_PROCESSING_FULL 1

View File

@@ -365,10 +365,13 @@ SUBSYSTEM_DEF(timer)
var/datum/timedevent/timer = new(callback, timeToRun, flags, hash) var/datum/timedevent/timer = new(callback, timeToRun, flags, hash)
if (flags & TIMER_STOPPABLE) if (flags & TIMER_STOPPABLE)
return timer.id return timer.id
return TIMER_ID_NULL
/proc/deltimer(id) /proc/deltimer(id)
if (!id) if (!id)
return FALSE return FALSE
if (id == TIMER_ID_NULL)
CRASH("Tried to delete a null timerid. Use TIMER_STOPPABLE flag")
if (!istext(id)) if (!istext(id))
if (istype(id, /datum/timedevent)) if (istype(id, /datum/timedevent))
qdel(id) qdel(id)