From 0a6d1f8c815d489bdf28d5a893931497c514688d Mon Sep 17 00:00:00 2001 From: mwerezak Date: Tue, 9 Dec 2014 17:12:26 -0500 Subject: [PATCH 1/2] Prevents infinite loop if a camera takes a picture of an atom with null in either it's overlays or underlays. --- code/__HELPERS/icons.dm | 48 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm index 34fdfdc3ae..7468db758b 100644 --- a/code/__HELPERS/icons.dm +++ b/code/__HELPERS/icons.dm @@ -699,34 +699,32 @@ proc // Creates a single icon from a given /atom or /image. Only the first argu while(TRUE) if(curIndex<=process.len) current = process[curIndex] - if(!current) continue - currentLayer = current:layer - if(currentLayer<0) // Special case for FLY_LAYER - if(currentLayer <= -1000) return flat - if(pSet == 0) // Underlay - currentLayer = A.layer+currentLayer/1000 - else // Overlay - currentLayer = A.layer+(1000+currentLayer)/1000 + if(current) + currentLayer = current:layer + if(currentLayer<0) // Special case for FLY_LAYER + if(currentLayer <= -1000) return flat + if(pSet == 0) // Underlay + currentLayer = A.layer+currentLayer/1000 + else // Overlay + currentLayer = A.layer+(1000+currentLayer)/1000 - // Sort add into layers list - for(cmpIndex=1,cmpIndex<=layers.len,cmpIndex++) - compare = layers[cmpIndex] - if(currentLayer < layers[compare]) // Associated value is the calculated layer - layers.Insert(cmpIndex,current) - layers[current] = currentLayer - break - if(cmpIndex>layers.len) // Reached end of list without inserting - layers[current]=currentLayer // Place at end + // Sort add into layers list + for(cmpIndex=1,cmpIndex<=layers.len,cmpIndex++) + compare = layers[cmpIndex] + if(currentLayer < layers[compare]) // Associated value is the calculated layer + layers.Insert(cmpIndex,current) + layers[current] = currentLayer + break + if(cmpIndex>layers.len) // Reached end of list without inserting + layers[current]=currentLayer // Place at end curIndex++ - - if(curIndex>process.len) - if(pSet == 0) // Switch to overlays - curIndex = 1 - pSet = 1 - process = A.overlays - else // All done - break + else if(pSet == 0) // Switch to overlays + curIndex = 1 + pSet = 1 + process = A.overlays + else // All done + break var/icon/add // Icon of overlay being added From 3414e48cebfa3fecd61dd4d5f4fa46ab9018a596 Mon Sep 17 00:00:00 2001 From: ccomp5950 Date: Tue, 9 Dec 2014 21:25:07 -0500 Subject: [PATCH 2/2] Adds "paranoid" option to remove more powerful debug options from R_DEBUG. The purpose of this is to allow for testers on our test server without them having advance proc call which can do some fun stuff with python, etc. Also removes debug controller so that testers can't just edit the configuration to remove debugparanoid The default config is the status quo, you have to go out of your way and set this option in config to remove proccal from R_DEBUG --- code/controllers/configuration.dm | 5 +++++ code/modules/admin/admin_verbs.dm | 11 ++++++++++- code/modules/admin/verbs/debug.dm | 1 + config/example/config.txt | 5 +++++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 284caa23ac..e9d14642f4 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -81,6 +81,8 @@ var/limitalienplayers = 0 var/alien_to_human_ratio = 0.5 + var/debugparanoid = 0 + var/server var/banappeals var/wikiurl @@ -224,6 +226,9 @@ if ("log_say") config.log_say = 1 + if ("debug_paranoid") + config.debugparanoid = 1 + if ("log_admin") config.log_admin = 1 diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 403dfd4049..b45346f792 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -156,6 +156,12 @@ var/list/admin_verbs_debug = list( /client/proc/SDQL_query, /client/proc/SDQL2_query, ) + +var/list/admin_verbs_paranoid_debug = list( + /client/proc/callproc, + /client/proc/debug_controller + ) + var/list/admin_verbs_possess = list( /proc/possess, /proc/release @@ -275,7 +281,10 @@ var/list/admin_verbs_mentor = list( if(holder.rights & R_BAN) verbs += admin_verbs_ban if(holder.rights & R_FUN) verbs += admin_verbs_fun if(holder.rights & R_SERVER) verbs += admin_verbs_server - if(holder.rights & R_DEBUG) verbs += admin_verbs_debug + if(holder.rights & R_DEBUG) + verbs += admin_verbs_debug + if(config.debugparanoid && !check_rights(R_ADMIN)) + verbs.Remove(admin_verbs_paranoid_debug) //Right now it's just callproc but we can easily add others later on. if(holder.rights & R_POSSESS) verbs += admin_verbs_possess if(holder.rights & R_PERMISSIONS) verbs += admin_verbs_permissions if(holder.rights & R_STEALTH) verbs += /client/proc/stealth diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 8eaf21b99e..e4849eebc9 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -30,6 +30,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that set name = "Advanced ProcCall" if(!check_rights(R_DEBUG)) return + if(config.debugparanoid && !check_rights(R_ADMIN)) return spawn(0) var/target = null diff --git a/config/example/config.txt b/config/example/config.txt index faeebb79bc..e4d931fe13 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -260,3 +260,8 @@ REQ_CULT_GHOSTWRITER 6 ## Uncomment to use overmap system for zlevel travel #USE_OVERMAP + +## Uncomment to make proccall require R_ADMIN instead of R_DEBUG +## designed for environments where you have testers but don't want them +## able to use the more powerful debug options. +#DEBUG_PARANOID