From e33e44357be6bc9b1480e43ff6fbe735dae8b3e7 Mon Sep 17 00:00:00 2001 From: Joan Lung Date: Mon, 4 Jul 2016 08:08:47 -0400 Subject: [PATCH] Faster get_turf() courtesy /vg/ (#19093) Uses a single get_step call instead, works via byond black magic --- code/__DEFINES/misc.dm | 3 +++ code/__HELPERS/unsorted.dm | 10 ---------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index 68272acd4ea..eead73d666b 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -319,6 +319,9 @@ var/list/bloody_footprints_cache = list() //subtypesof(), typesof() without the parent path #define subtypesof(typepath) ( typesof(typepath) - typepath ) +//Gets the turf this atom inhabits +#define get_turf(A) (get_step(A, 0)) + //Bot types #define SEC_BOT 1 // Secutritrons (Beepsky) and ED-209s #define MULE_BOT 2 // MULEbots diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 55af7096324..f553539156f 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -720,16 +720,6 @@ Turf and target are seperate in case you want to teleport some distance from a t else return zone - -//Gets the turf this atom inhabits - -/proc/get_turf(atom/A) - if (!istype(A)) - return - for(A, A && !isturf(A), A=A.loc); //semicolon is for the empty statement - return A - - /* Gets the turf this atom's *ICON* appears to inhabit