Skip to content

Commit

Permalink
tweak(think): _think_ctxs lazy initialization
Browse files Browse the repository at this point in the history
PR #11298
- Перевод думанья на ленивые листы.
  • Loading branch information
igorsaux authored Dec 27, 2023
1 parent 5c42e28 commit 46f043c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion code/datums/datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
var/list/signal_procs = list()

// Thinking
var/list/_think_ctxs = list()
var/list/_think_ctxs
var/datum/think_context/_main_think_ctx

#ifdef TESTING
Expand Down Expand Up @@ -137,6 +137,8 @@
/// * `clbk` - a proc which should be called.
/// * `time` - when to call the context.
/datum/proc/add_think_ctx(name, datum/callback/clbk, time)
LAZYINITLIST(_think_ctxs)

if(!QDELETED(_think_ctxs[name]))
CRASH("Thinking context [name] is exists")

Expand Down

0 comments on commit 46f043c

Please sign in to comment.