Some tweaks and fixes for UL and any while loops I find, as well as removing generally bad procs.

This commit is contained in:
SkyMarshal
2012-06-22 12:49:54 -07:00
parent f4ba1a40c3
commit 668f81c329
15 changed files with 29 additions and 39 deletions

View File

@@ -356,7 +356,6 @@
#include "code\defines\procs\logging.dm" #include "code\defines\procs\logging.dm"
#include "code\defines\procs\religion_name.dm" #include "code\defines\procs\religion_name.dm"
#include "code\defines\procs\station_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\syndicate_name.dm"
#include "code\defines\procs\time_stamp.dm" #include "code\defines\procs\time_stamp.dm"
#include "code\defines\sd_procs\base64.dm" #include "code\defines\sd_procs\base64.dm"

View File

@@ -214,7 +214,7 @@ atom/proc/ul_BlankLocal()
var/TurfAdjust = isturf(src) ? 1 : 0 var/TurfAdjust = isturf(src) ? 1 : 0
for(var/atom/Affected in view(ul_TopLuminosity, src)) 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() Affected.ul_Extinguish()
Blanked += Affected Blanked += Affected

View File

@@ -93,8 +93,9 @@
src.inherent = list() src.inherent = list()
/datum/ai_laws/proc/add_supplied_law(var/number, var/law) /datum/ai_laws/proc/add_supplied_law(var/number, var/law)
while (src.supplied.len < number + 1) // while (src.supplied.len < number + 1)
src.supplied += "" // src.supplied += ""
//Infinite loop
src.supplied[number + 1] = law src.supplied[number + 1] = law

View File

@@ -46,11 +46,11 @@
proc/check_all_steps(atom/used_atom,mob/user as mob) //check all steps, remove matching one. 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++) 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(istype(used_atom, L["key"]))
if(custom_action(i, used_atom, user)) if(custom_action(i, used_atom, user))
steps[i]=null;//stupid byond list from list removal... steps[i]=null//stupid byond list from list removal...
listclearnulls(steps); steps.Remove(null)
if(!steps.len) if(!steps.len)
spawn_result() spawn_result()
return 1 return 1

View File

@@ -172,7 +172,8 @@
if(istype(teleatom, /obj/item/weapon/disk/nuclear)) // Don't let nuke disks get teleported --NeoFite if(istype(teleatom, /obj/item/weapon/disk/nuclear)) // Don't let nuke disks get teleported --NeoFite
teleatom.visible_message("\red <B>The [teleatom] bounces off of the portal!</B>") teleatom.visible_message("\red <B>The [teleatom] bounces off of the portal!</B>")
return 0 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)) if(istype(teleatom, /mob/living))
var/mob/living/MM = teleatom var/mob/living/MM = teleatom
MM.visible_message("\red <B>The [MM] bounces off of the portal!</B>","\red Something you are carrying seems to be unable to pass through the portal. Better drop it if you want to go through.") MM.visible_message("\red <B>The [MM] bounces off of the portal!</B>","\red Something you are carrying seems to be unable to pass through the portal. Better drop it if you want to go through.")

View File

@@ -1152,17 +1152,6 @@ proc/islist(list/list)
return 1 return 1
return 0 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) /atom/proc/GetAllContents(searchDepth = 5)
var/list/toReturn = list() var/list/toReturn = list()

View File

@@ -240,9 +240,8 @@ datum/radio_frequency
for (var/devices_filter in devices) for (var/devices_filter in devices)
var/list/devices_line = devices[devices_filter] var/list/devices_line = devices[devices_filter]
devices_line-=device devices_line-=device
while (null in devices_line) devices_line.Remove(null)
devices_line -= null if (!devices_line.len)
if (devices_line.len==0)
devices -= devices_filter devices -= devices_filter
del(devices_line) del(devices_line)

View File

@@ -136,9 +136,9 @@ var/datum/roundinfo/roundinfo = new()
//Start master_controller.process() //Start master_controller.process()
spawn master_controller.process() spawn master_controller.process()
if (config.sql_enabled) // if (config.sql_enabled)
spawn(3000) // spawn(3000)
statistic_cycle() // Polls population totals regularly and stores them in an SQL DB -- TLE // statistic_cycle() // Polls population totals regularly and stores them in an SQL DB -- TLE
return 1 return 1
/datum/controller/gameticker /datum/controller/gameticker

View File

@@ -174,7 +174,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //list that will contain r
dat+="<BR><HR>The newscaster recognises you as: <FONT COLOR='green'>[src.scanned_user]</FONT>" dat+="<BR><HR>The newscaster recognises you as: <FONT COLOR='green'>[src.scanned_user]</FONT>"
if(1) if(1)
dat+= "Station Feed Channels<HR>" dat+= "Station Feed Channels<HR>"
if( isemptylist(src.channel_list) ) if(channel_list.len)
dat+="<I>No active channels found...</I>" dat+="<I>No active channels found...</I>"
else else
for(var/datum/feed_channel/CHANNEL in src.channel_list) 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+="<FONT COLOR='red'><B>ATTENTION: </B></FONT>This channel has been deemed as threatening to the welfare of the station, and marked with a Nanotrasen D-Notice.<BR>" dat+="<FONT COLOR='red'><B>ATTENTION: </B></FONT>This channel has been deemed as threatening to the welfare of the station, and marked with a Nanotrasen D-Notice.<BR>"
dat+="No further feed story additions are allowed while the D-Notice is in effect.</FONT><BR><BR>" dat+="No further feed story additions are allowed while the D-Notice is in effect.</FONT><BR><BR>"
else else
if( isemptylist(src.viewing_channel.messages) ) if(!viewing_channel.messages.len)
dat+="<I>No feed messages found in channel...</I><BR>" dat+="<I>No feed messages found in channel...</I><BR>"
else else
for(var/datum/feed_message/MESSAGE in src.viewing_channel.messages) 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+="<FONT SIZE=1>NOTE: Due to the nature of news Feeds, total deletion of a Feed Story is not possible.<BR>" dat+="<FONT SIZE=1>NOTE: Due to the nature of news Feeds, total deletion of a Feed Story is not possible.<BR>"
dat+="Keep in mind that users attempting to view a censored feed will instead see the \[REDACTED\] tag above it.</FONT>" dat+="Keep in mind that users attempting to view a censored feed will instead see the \[REDACTED\] tag above it.</FONT>"
dat+="<HR>Select Feed channel to get Stories from:<BR>" dat+="<HR>Select Feed channel to get Stories from:<BR>"
if(isemptylist(src.channel_list)) if(!channel_list.len)
dat+="<I>No feed channels found active...</I><BR>" dat+="<I>No feed channels found active...</I><BR>"
else else
for(var/datum/feed_channel/CHANNEL in src.channel_list) 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+="<FONT SIZE=1>A D-Notice is to be bestowed upon the channel if the handling Authority deems it as harmful for the station's" dat+="<FONT SIZE=1>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+="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.</FONT><HR>" dat+="stories it might contain at the time. You can lift a D-Notice if you have the required access at any time.</FONT><HR>"
if(isemptylist(src.channel_list)) if(channel_list.len)
dat+="<I>No feed channels found active...</I><BR>" dat+="<I>No feed channels found active...</I><BR>"
else else
for(var/datum/feed_channel/CHANNEL in src.channel_list) 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+="<FONT SIZE=2><A href='?src=\ref[src];censor_channel_author=\ref[src.viewing_channel]'>[(src.viewing_channel.author=="\[REDACTED\]") ? ("Undo Author censorship") : ("Censor channel Author")]</A></FONT><HR>" dat+="<FONT SIZE=2><A href='?src=\ref[src];censor_channel_author=\ref[src.viewing_channel]'>[(src.viewing_channel.author=="\[REDACTED\]") ? ("Undo Author censorship") : ("Censor channel Author")]</A></FONT><HR>"
if( isemptylist(src.viewing_channel.messages) ) if( !viewing_channel.messages.len )
dat+="<I>No feed messages found in channel...</I><BR>" dat+="<I>No feed messages found in channel...</I><BR>"
else else
for(var/datum/feed_message/MESSAGE in src.viewing_channel.messages) 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+="<FONT COLOR='red'><B>ATTENTION: </B></FONT>This channel has been deemed as threatening to the welfare of the station, and marked with a Nanotrasen D-Notice.<BR>" dat+="<FONT COLOR='red'><B>ATTENTION: </B></FONT>This channel has been deemed as threatening to the welfare of the station, and marked with a Nanotrasen D-Notice.<BR>"
dat+="No further feed story additions are allowed while the D-Notice is in effect.</FONT><BR><BR>" dat+="No further feed story additions are allowed while the D-Notice is in effect.</FONT><BR><BR>"
else else
if( isemptylist(src.viewing_channel.messages) ) if( !viewing_channel.messages.len )
dat+="<I>No feed messages found in channel...</I><BR>" dat+="<I>No feed messages found in channel...</I><BR>"
else else
for(var/datum/feed_message/MESSAGE in src.viewing_channel.messages) 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 if(0) //Cover
dat+="<DIV ALIGN='center'><B><FONT SIZE=6>The Griffon</FONT></B></div>" dat+="<DIV ALIGN='center'><B><FONT SIZE=6>The Griffon</FONT></B></div>"
dat+="<DIV ALIGN='center'><FONT SIZE=2>Nanotrasen-standard newspaper, for use on Nanotrasen<65> Space Facilities</FONT></div><HR>" dat+="<DIV ALIGN='center'><FONT SIZE=2>Nanotrasen-standard newspaper, for use on Nanotrasen<65> Space Facilities</FONT></div><HR>"
if(isemptylist(src.news_content)) if(!news_content.len)
if(src.important_message) if(src.important_message)
dat+="Contents:<BR><ul><B><FONT COLOR='red'>**</FONT>Important Security Announcement<FONT COLOR='red'>**</FONT></B> <FONT SIZE=2>\[page [src.pages+2]\]</FONT><BR></ul>" dat+="Contents:<BR><ul><B><FONT COLOR='red'>**</FONT>Important Security Announcement<FONT COLOR='red'>**</FONT></B> <FONT SIZE=2>\[page [src.pages+2]\]</FONT><BR></ul>"
else else
@@ -712,7 +712,7 @@ obj/item/weapon/newspaper/attack_self(mob/user as mob)
if(C.censored) if(C.censored)
dat+="This channel was deemed dangerous to the general welfare of the station and therefore marked with a <B><FONT COLOR='red'>D-Notice</B></FONT>. Its contents were not transferred to the newspaper at the time of printing." dat+="This channel was deemed dangerous to the general welfare of the station and therefore marked with a <B><FONT COLOR='red'>D-Notice</B></FONT>. Its contents were not transferred to the newspaper at the time of printing."
else else
if(isemptylist(C.messages)) if(!C.messages.len)
dat+="No Feed stories stem from this channel..." dat+="No Feed stories stem from this channel..."
else else
dat+="<ul>" dat+="<ul>"

View File

@@ -47,7 +47,7 @@
/obj/item/mecha_parts/mecha_equipment/proc/destroy()//missiles detonating, teleporter creating singularity? /obj/item/mecha_parts/mecha_equipment/proc/destroy()//missiles detonating, teleporter creating singularity?
if(chassis) if(chassis)
chassis.equipment -= src chassis.equipment -= src
listclearnulls(chassis.equipment) chassis.equipment.Remove(null)
if(chassis.selected == src) if(chassis.selected == src)
chassis.selected = null chassis.selected = null
src.update_chassis_page() src.update_chassis_page()

View File

@@ -350,7 +350,7 @@
/////////////////////////////////// ///////////////////////////////////
/obj/mecha/proc/check_for_internal_damage(var/list/possible_int_damage,var/ignore_threshold=null) /obj/mecha/proc/check_for_internal_damage(var/list/possible_int_damage,var/ignore_threshold=null)
if(!islist(possible_int_damage) || isemptylist(possible_int_damage)) return if(!islist(possible_int_damage) || !possible_int_damage.len) return
if(prob(20)) if(prob(20))
if(ignore_threshold || src.health*100/initial(src.health)<src.internal_damage_threshold) if(ignore_threshold || src.health*100/initial(src.health)<src.internal_damage_threshold)
for(var/T in possible_int_damage) for(var/T in possible_int_damage)

View File

@@ -1660,7 +1660,8 @@ turf/simulated/floor/return_siding_icon_state()
del(A) //The disk's Del() proc ensures a new one is created del(A) //The disk's Del() proc ensures a new one is created
return return
if(!isemptylist(A.search_contents_for(/obj/item/weapon/disk/nuclear))) var/list/temp = A.search_contents_for(/obj/item/weapon/disk/nuclear)
if(temp.len)
if(istype(A, /mob/living)) if(istype(A, /mob/living))
var/mob/living/MM = A var/mob/living/MM = A
if(MM.client) if(MM.client)

View File

@@ -88,7 +88,7 @@
var/tod = time2text(world.realtime,"hh:mm:ss") //weasellos time of death patch var/tod = time2text(world.realtime,"hh:mm:ss") //weasellos time of death patch
if(mind) if(mind)
mind.store_memory("Time of death: [tod]", 0) mind.store_memory("Time of death: [tod]", 0)
sql_report_death(src) // sql_report_death(src)
//Calls the rounds wincheck, mainly for wizard, malf, and changeling now //Calls the rounds wincheck, mainly for wizard, malf, and changeling now
ticker.mode.check_win() ticker.mode.check_win()

View File

@@ -67,7 +67,7 @@
var/tod = time2text(world.realtime,"hh:mm:ss") //weasellos time of death patch var/tod = time2text(world.realtime,"hh:mm:ss") //weasellos time of death patch
store_memory("Time of death: [tod]", 0) store_memory("Time of death: [tod]", 0)
sql_report_cyborg_death(src) // sql_report_cyborg_death(src)
if (src.key) if (src.key)
spawn(50) spawn(50)

View File

@@ -1081,7 +1081,7 @@ note dizziness decrements automatically in the mob's Life() proc.
* Sends resource files to client cache * Sends resource files to client cache
*/ */
/mob/proc/getFiles() /mob/proc/getFiles()
if(!isemptylist(args)) if(args && args.len)
for(var/file in args) for(var/file in args)
src << browse_rsc(file) src << browse_rsc(file)
return 1 return 1