Changes all .len to length() where applicable (#25174)

* Globals work

* Double access works

* All other things

* Revert "All other things"

This reverts commit 6574442eb6.

* More changes that compile and work

* IT WORKS AAAAAA

* Changes even more .len to length()

* Apply suggestions from code review

* Update code/datums/mind.dm

* Update code/__HELPERS/sorts/InsertSort.dm

Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>

* Update code/__HELPERS/sanitize_values.dm

Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>

---------

Co-authored-by: FunnyMan3595 (Charlie Nolan) <funnyman@google.com>
Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>
This commit is contained in:
DGamerL
2024-04-19 17:32:09 +00:00
committed by GitHub
co-authored by Deniz FunnyMan3595
parent bdd417ada0
commit bad8b31afa
369 changed files with 1162 additions and 1163 deletions
+1 -1
View File
@@ -31,7 +31,7 @@
/obj/item/folder/update_overlays()
. = ..()
if(contents.len)
if(length(contents))
. += "folder_paper"
/obj/item/folder/attackby(obj/item/W as obj, mob/user as mob, params)
+4 -4
View File
@@ -69,8 +69,8 @@
update_icon()
var/obj/item/paper/P
if(papers.len > 0) //If there's any custom paper on the stack, use that instead of creating a new paper.
P = papers[papers.len]
if(length(papers) > 0) //If there's any custom paper on the stack, use that instead of creating a new paper.
P = papers[length(papers)]
papers.Remove(P)
else
if(letterhead_type && alert("Choose a style", null,"Letterhead","Blank")=="Letterhead")
@@ -133,8 +133,8 @@
update_icon()
var/obj/item/paper/carbon/P
if(papers.len > 0) //If there's any custom paper on the stack, use that instead of creating a new paper.
P = papers[papers.len]
if(length(papers) > 0) //If there's any custom paper on the stack, use that instead of creating a new paper.
P = papers[length(papers)]
papers.Remove(P)
else
P = new /obj/item/paper/carbon
+2 -2
View File
@@ -87,8 +87,8 @@
c.offset_y = copy.offset_y
var/list/temp_overlays = copy.stamp_overlays //Iterates through stamps
var/image/img //and puts a matching
for(var/j = 1, j <= temp_overlays.len, j++) //gray overlay onto the copy
if(copy.ico.len)
for(var/j = 1, j <= length(temp_overlays), j++) //gray overlay onto the copy
if(length(copy.ico))
if(findtext(copy.ico[j], "cap") || findtext(copy.ico[j], "cent") || findtext(copy.ico[j], "rep"))
img = image('icons/obj/bureaucracy.dmi', "paper_stamp-circle")
else if(findtext(copy.ico[j], "deny"))
+5 -5
View File
@@ -285,7 +285,7 @@ GLOBAL_LIST_INIT(SpookyGhosts, list("ghost","shade","shade2","ghost-narsie","hor
continue
else//not invisable, not a spookyghost add it.
var/disguised = null
if(user.viewing_alternate_appearances && user.viewing_alternate_appearances.len && ishuman(A) && A.alternate_appearances && A.alternate_appearances.len) //This whole thing and the stuff below just checks if the atom is a Solid Snake cosplayer.
if(user.viewing_alternate_appearances && length(user.viewing_alternate_appearances) && ishuman(A) && A.alternate_appearances && length(A.alternate_appearances)) //This whole thing and the stuff below just checks if the atom is a Solid Snake cosplayer.
for(var/datum/alternate_appearance/alt_appearance in user.viewing_alternate_appearances)
if(alt_appearance.owner == A) //If it turns out they are, don't blow their cover. That'd be rude.
atoms.Add(image(alt_appearance.img, A.loc, layer = 4, dir = A.dir)) //Render their disguise.
@@ -299,7 +299,7 @@ GLOBAL_LIST_INIT(SpookyGhosts, list("ghost","shade","shade2","ghost-narsie","hor
// Sort the atoms into their layers
var/list/sorted = sort_atoms_by_layer(atoms)
var/center_offset = (size-1)/2 * 32 + 1
for(var/i; i <= sorted.len; i++)
for(var/i; i <= length(sorted); i++)
var/atom/A = sorted[i]
if(A)
var/icon/img = getFlatIcon(A)//build_composite_icon(A)
@@ -508,7 +508,7 @@ GLOBAL_LIST_INIT(SpookyGhosts, list("ghost","shade","shade2","ghost-narsie","hor
addtimer(CALLBACK(src, PROC_REF(reset_cooldown)), 6.4 SECONDS) // magic numbers here too
/obj/item/camera/digital/captureimage(atom/target, mob/user, flag)
if(saved_pictures.len >= max_storage)
if(length(saved_pictures) >= max_storage)
to_chat(user, "<span class='notice'>Maximum photo storage capacity reached.</span>")
return
to_chat(user, "Picture saved.")
@@ -664,7 +664,7 @@ GLOBAL_LIST_INIT(SpookyGhosts, list("ghost","shade","shade2","ghost-narsie","hor
/obj/item/camera/proc/sort_atoms_by_layer(list/atoms)
// Comb sort icons based on levels
var/list/result = atoms.Copy()
var/gap = result.len
var/gap = length(result)
var/swapped = 1
while(gap > 1 || swapped)
swapped = 0
@@ -672,7 +672,7 @@ GLOBAL_LIST_INIT(SpookyGhosts, list("ghost","shade","shade2","ghost-narsie","hor
gap = round(gap / 1.3) // 1.3 is the emperic comb sort coefficient
if(gap < 1)
gap = 1
for(var/i = 1; gap + i <= result.len; i++)
for(var/i = 1; gap + i <= length(result); i++)
var/atom/l = result[i] //Fucking hate
var/atom/r = result[gap+i] //how lists work here
if(l.layer > r.layer) //no "result[i].layer" for me
@@ -45,7 +45,7 @@
var/list/nametemp = list()
var/find
if(cam.aipictures.len == 0)
if(length(cam.aipictures) == 0)
to_chat(usr, "<span class='userdanger'>No images saved</span>")
return
for(var/datum/picture/t in cam.aipictures)