From df9e76efd684586c849e4ce5f6a54922ab985c20 Mon Sep 17 00:00:00 2001 From: Leshana Date: Wed, 10 May 2017 11:00:04 -0400 Subject: [PATCH] Small ZAS Optimization Minor optimization; eliminates a few proc calls when managing zone connections by turning check() into a macro. --- code/ZAS/ConnectionManager.dm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/code/ZAS/ConnectionManager.dm b/code/ZAS/ConnectionManager.dm index 28ef365830..3890cd85f5 100644 --- a/code/ZAS/ConnectionManager.dm +++ b/code/ZAS/ConnectionManager.dm @@ -24,12 +24,16 @@ Class Procs: erase_all() Called when the turf is changed with ChangeTurf(). Erases all existing connections. +Macros: check(connection/c) Checks for connection validity. It's possible to have a reference to a connection that has been erased. */ +// macro-ized to cut down on proc calls +#define check(c) (c && c.valid()) + /turf/var/tmp/connection_manager/connections /connection_manager/var/connection/N @@ -98,5 +102,4 @@ Class Procs: if(check(D)) D.erase() #endif -/connection_manager/proc/check(connection/c) - return c && c.valid() \ No newline at end of file +#undef check