From f86cea3632071eee626d9e6f3138c77a2bb79fff Mon Sep 17 00:00:00 2001 From: ninjanomnom Date: Fri, 20 Oct 2017 14:44:41 -0400 Subject: [PATCH] cleanup --- code/__DEFINES/misc.dm | 4 +++- code/__HELPERS/unsorted.dm | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index da341c89a30..42a9bc67f03 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -462,4 +462,6 @@ GLOBAL_LIST_INIT(ghost_others_options, list(GHOST_OTHERS_SIMPLE, GHOST_OTHERS_DE #define DUMMY_HUMAN_SLOT_MANIFEST "dummy_manifest_generation" #define PR_ANNOUNCEMENTS_PER_ROUND 5 //The number of unique PR announcements allowed per round - //This makes sure that a single person can only spam 3 reopens and 3 closes before being ignored \ No newline at end of file + //This makes sure that a single person can only spam 3 reopens and 3 closes before being ignored + +#define MAX_PROC_DEPTH 195 // 200 proc calls deep and shit breaks, this is a bit lower to give some safety room \ No newline at end of file diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 47306ca720b..e24fd551df9 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -507,13 +507,14 @@ Turf and target are separate in case you want to teleport some distance from a t Recursively gets all contents of contents and returns them all in a list. recursive_depth is useful if you only want a turf and everything on it (recursive_depth=1) +Do not set recursive depth higher than MAX_PROC_DEPTH as byond breaks when that limit is reached. */ -/atom/proc/GetAllContents(list/output=list(), recursive_depth=199, _current_depth=0) // 200 proc calls in and we break shit +/atom/proc/GetAllContents(list/output=list(), recursive_depth=MAX_PROC_DEPTH, _current_depth=0) . = output output += src if(_current_depth == recursive_depth) - if(_current_depth == 199) - WARNING("Get all contents reached the max recursive depth of 199. One more and we would break shit. Offending atom: [src]") + if(_current_depth == MAX_PROC_DEPTH) + WARNING("Get all contents reached the max recursive depth of [MAX_PROC_DEPTH]. More and we would break shit. Offending atom: [src]") return for(var/i in 1 to contents.len) var/atom/thing = contents[i]