From 668f81c329f6ebdadce35fd587d957bed0f179a4 Mon Sep 17 00:00:00 2001 From: SkyMarshal Date: Fri, 22 Jun 2012 12:49:54 -0700 Subject: [PATCH] Some tweaks and fixes for UL and any while loops I find, as well as removing generally bad procs. --- baystation12.dme | 1 - code/WorkInProgress/SkyMarshal/Ultralight.dm | 2 +- code/datums/ai_laws.dm | 5 +++-- code/datums/helper_datums/construction_datum.dm | 6 +++--- code/datums/helper_datums/teleport.dm | 3 ++- code/defines/procs/helpers.dm | 11 ----------- code/game/communications.dm | 5 ++--- code/game/gamemodes/gameticker.dm | 6 +++--- code/game/machinery/newscaster.dm | 16 ++++++++-------- code/game/mecha/equipment/mecha_equipment.dm | 2 +- code/game/mecha/mecha.dm | 2 +- code/game/turf.dm | 3 ++- code/modules/mob/living/carbon/human/death.dm | 2 +- code/modules/mob/living/silicon/robot/death.dm | 2 +- code/modules/mob/mob.dm | 2 +- 15 files changed, 29 insertions(+), 39 deletions(-) diff --git a/baystation12.dme b/baystation12.dme index 677397a248..3d156afe55 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -356,7 +356,6 @@ #include "code\defines\procs\logging.dm" #include "code\defines\procs\religion_name.dm" #include "code\defines\procs\station_name.dm" -#include "code\defines\procs\statistics.dm" #include "code\defines\procs\syndicate_name.dm" #include "code\defines\procs\time_stamp.dm" #include "code\defines\sd_procs\base64.dm" diff --git a/code/WorkInProgress/SkyMarshal/Ultralight.dm b/code/WorkInProgress/SkyMarshal/Ultralight.dm index dadc5c2ec2..1f992cff63 100644 --- a/code/WorkInProgress/SkyMarshal/Ultralight.dm +++ b/code/WorkInProgress/SkyMarshal/Ultralight.dm @@ -214,7 +214,7 @@ atom/proc/ul_BlankLocal() var/TurfAdjust = isturf(src) ? 1 : 0 for(var/atom/Affected in view(ul_TopLuminosity, src)) - if(ul_IsLuminous(Affected) && Affected.ul_Extinguished == UL_I_LIT && (ul_FalloffAmount(Affected) <= Affected.luminosity + TurfAdjust)) + if(ul_IsLuminous(Affected) && Affected.ul_Extinguished == UL_I_LIT && (ul_FalloffAmount(Affected) <= ul_Luminosity(Affected) + TurfAdjust)) Affected.ul_Extinguish() Blanked += Affected diff --git a/code/datums/ai_laws.dm b/code/datums/ai_laws.dm index 5f68402197..abc4125745 100644 --- a/code/datums/ai_laws.dm +++ b/code/datums/ai_laws.dm @@ -93,8 +93,9 @@ src.inherent = list() /datum/ai_laws/proc/add_supplied_law(var/number, var/law) - while (src.supplied.len < number + 1) - src.supplied += "" +// while (src.supplied.len < number + 1) +// src.supplied += "" +//Infinite loop src.supplied[number + 1] = law diff --git a/code/datums/helper_datums/construction_datum.dm b/code/datums/helper_datums/construction_datum.dm index 7c2fabbc9b..e3f6470414 100644 --- a/code/datums/helper_datums/construction_datum.dm +++ b/code/datums/helper_datums/construction_datum.dm @@ -46,11 +46,11 @@ proc/check_all_steps(atom/used_atom,mob/user as mob) //check all steps, remove matching one. for(var/i=1;i<=steps.len;i++) - var/list/L = steps[i]; + var/list/L = steps[i] if(istype(used_atom, L["key"])) if(custom_action(i, used_atom, user)) - steps[i]=null;//stupid byond list from list removal... - listclearnulls(steps); + steps[i]=null//stupid byond list from list removal... + steps.Remove(null) if(!steps.len) spawn_result() return 1 diff --git a/code/datums/helper_datums/teleport.dm b/code/datums/helper_datums/teleport.dm index b6aecf27c8..f157909ff6 100644 --- a/code/datums/helper_datums/teleport.dm +++ b/code/datums/helper_datums/teleport.dm @@ -172,7 +172,8 @@ if(istype(teleatom, /obj/item/weapon/disk/nuclear)) // Don't let nuke disks get teleported --NeoFite teleatom.visible_message("\red The [teleatom] bounces off of the portal!") return 0 - if(!isemptylist(teleatom.search_contents_for(/obj/item/weapon/disk/nuclear))) + var/list/temp = teleatom.search_contents_for(/obj/item/weapon/disk/nuclear) + if(temp.len) if(istype(teleatom, /mob/living)) var/mob/living/MM = teleatom MM.visible_message("\red The [MM] bounces off of the portal!","\red Something you are carrying seems to be unable to pass through the portal. Better drop it if you want to go through.") diff --git a/code/defines/procs/helpers.dm b/code/defines/procs/helpers.dm index 36b2f8e52c..341d5944b5 100644 --- a/code/defines/procs/helpers.dm +++ b/code/defines/procs/helpers.dm @@ -1152,17 +1152,6 @@ proc/islist(list/list) return 1 return 0 -proc/isemptylist(list/list) - if(!list.len) - return 1 - return 0 - -proc/listclearnulls(list/list) - if(istype(list)) - while(null in list) - list -= null - return - /atom/proc/GetAllContents(searchDepth = 5) var/list/toReturn = list() diff --git a/code/game/communications.dm b/code/game/communications.dm index 012fe5419e..015a56d871 100644 --- a/code/game/communications.dm +++ b/code/game/communications.dm @@ -240,9 +240,8 @@ datum/radio_frequency for (var/devices_filter in devices) var/list/devices_line = devices[devices_filter] devices_line-=device - while (null in devices_line) - devices_line -= null - if (devices_line.len==0) + devices_line.Remove(null) + if (!devices_line.len) devices -= devices_filter del(devices_line) diff --git a/code/game/gamemodes/gameticker.dm b/code/game/gamemodes/gameticker.dm index 83281a5894..1711754689 100644 --- a/code/game/gamemodes/gameticker.dm +++ b/code/game/gamemodes/gameticker.dm @@ -136,9 +136,9 @@ var/datum/roundinfo/roundinfo = new() //Start master_controller.process() spawn master_controller.process() - if (config.sql_enabled) - spawn(3000) - statistic_cycle() // Polls population totals regularly and stores them in an SQL DB -- TLE +// if (config.sql_enabled) +// spawn(3000) +// statistic_cycle() // Polls population totals regularly and stores them in an SQL DB -- TLE return 1 /datum/controller/gameticker diff --git a/code/game/machinery/newscaster.dm b/code/game/machinery/newscaster.dm index 0dc206a008..151b75843b 100644 --- a/code/game/machinery/newscaster.dm +++ b/code/game/machinery/newscaster.dm @@ -174,7 +174,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //list that will contain r dat+="

The newscaster recognises you as: [src.scanned_user]" if(1) dat+= "Station Feed Channels
" - if( isemptylist(src.channel_list) ) + if(channel_list.len) dat+="No active channels found..." else for(var/datum/feed_channel/CHANNEL in src.channel_list) @@ -255,7 +255,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //list that will contain r dat+="ATTENTION: This channel has been deemed as threatening to the welfare of the station, and marked with a Nanotrasen D-Notice.
" dat+="No further feed story additions are allowed while the D-Notice is in effect.

" else - if( isemptylist(src.viewing_channel.messages) ) + if(!viewing_channel.messages.len) dat+="No feed messages found in channel...
" else for(var/datum/feed_message/MESSAGE in src.viewing_channel.messages) @@ -267,7 +267,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //list that will contain r dat+="NOTE: Due to the nature of news Feeds, total deletion of a Feed Story is not possible.
" dat+="Keep in mind that users attempting to view a censored feed will instead see the \[REDACTED\] tag above it.
" dat+="
Select Feed channel to get Stories from:
" - if(isemptylist(src.channel_list)) + if(!channel_list.len) dat+="No feed channels found active...
" else for(var/datum/feed_channel/CHANNEL in src.channel_list) @@ -278,7 +278,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //list that will contain r dat+="A D-Notice is to be bestowed upon the channel if the handling Authority deems it as harmful for the station's" dat+="morale, integrity or disciplinary behaviour. A D-Notice will render a channel unable to be updated by anyone, without deleting any feed" dat+="stories it might contain at the time. You can lift a D-Notice if you have the required access at any time.
" - if(isemptylist(src.channel_list)) + if(channel_list.len) dat+="No feed channels found active...
" else for(var/datum/feed_channel/CHANNEL in src.channel_list) @@ -290,7 +290,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //list that will contain r dat+="[(src.viewing_channel.author=="\[REDACTED\]") ? ("Undo Author censorship") : ("Censor channel Author")]
" - if( isemptylist(src.viewing_channel.messages) ) + if( !viewing_channel.messages.len ) dat+="No feed messages found in channel...
" else for(var/datum/feed_message/MESSAGE in src.viewing_channel.messages) @@ -304,7 +304,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //list that will contain r dat+="ATTENTION: This channel has been deemed as threatening to the welfare of the station, and marked with a Nanotrasen D-Notice.
" dat+="No further feed story additions are allowed while the D-Notice is in effect.

" else - if( isemptylist(src.viewing_channel.messages) ) + if( !viewing_channel.messages.len ) dat+="No feed messages found in channel...
" else for(var/datum/feed_message/MESSAGE in src.viewing_channel.messages) @@ -685,7 +685,7 @@ obj/item/weapon/newspaper/attack_self(mob/user as mob) if(0) //Cover dat+="
The Griffon
" dat+="
Nanotrasen-standard newspaper, for use on Nanotrasen© Space Facilities

" - if(isemptylist(src.news_content)) + if(!news_content.len) if(src.important_message) dat+="Contents:
" else @@ -712,7 +712,7 @@ obj/item/weapon/newspaper/attack_self(mob/user as mob) if(C.censored) dat+="This channel was deemed dangerous to the general welfare of the station and therefore marked with a D-Notice. Its contents were not transferred to the newspaper at the time of printing." else - if(isemptylist(C.messages)) + if(!C.messages.len) dat+="No Feed stories stem from this channel..." else dat+="