From de6d2a4a313120df2cd23f1c765fe63eda62c24b Mon Sep 17 00:00:00 2001 From: PsiOmegaDelta Date: Sun, 31 Jul 2016 18:05:19 +0200 Subject: [PATCH] Fixes check_rights runtiming for non-holders. Fixes all kinds of errors. --- code/modules/admin/holder2.dm | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/code/modules/admin/holder2.dm b/code/modules/admin/holder2.dm index 6fe8f0c6f0..9ee3d10b6b 100644 --- a/code/modules/admin/holder2.dm +++ b/code/modules/admin/holder2.dm @@ -62,21 +62,22 @@ NOTE: It checks usr by default. Supply the "user" argument if you wish to check if(ismob(C)) var/mob/M = C C = M.client + if(!C) + return FALSE + if(!C.holder) + if(show_msg) + C << "Error: You are not an admin." + return FALSE - if(C) - if(rights_required) - if(rights_required & C.holder.rights) - return 1 - else - if(show_msg) - C << "Error: You do not have sufficient rights to do that. You require one of the following flags:[rights2text(rights_required," ")]." + if(rights_required) + if(rights_required & C.holder.rights) + return TRUE else - if(C.holder) - return 1 - else - if(show_msg) - C << "Error: You are not an admin." - return 0 + if(show_msg) + C << "Error: You do not have sufficient rights to do that. You require one of the following flags:[rights2text(rights_required," ")]." + return FALSE + else + return TRUE //probably a bit iffy - will hopefully figure out a better solution /proc/check_if_greater_rights_than(client/other)