From 5fe5a8f93958d5689d2abd19b395b5f47b649c86 Mon Sep 17 00:00:00 2001 From: spookerton Date: Sun, 9 Oct 2022 11:54:05 +0100 Subject: [PATCH] fix || in type2parent switch, gentle refactor --- code/_helpers/type2type.dm | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/code/_helpers/type2type.dm b/code/_helpers/type2type.dm index 34237faad1..0cc3327b68 100644 --- a/code/_helpers/type2type.dm +++ b/code/_helpers/type2type.dm @@ -349,21 +349,22 @@ last_found = found + delim_len while (found) + /proc/type2parent(child) var/string_type = "[child]" var/last_slash = findlasttext(string_type, "/") - if(last_slash == 1) - switch(child) - if(/datum) - return null - if(/obj || /mob) - return /atom/movable - if(/area || /turf) - return /atom - else - return /datum + if (last_slash != 1) + return text2path(copytext(string_type, 1, last_slash)) + switch (child) + if (/datum) + return null + if (/obj, /mob) + return /atom/movable + if (/area, /turf) + return /atom + else + return /datum - return text2path(copytext(string_type, 1, last_slash)) //checks if a file exists and contains text //returns text as a string if these conditions are met