mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-20 19:44:09 +01:00
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:
@@ -32,12 +32,12 @@
|
||||
|
||||
var/list/query_list = SDQL2_tokenize(query_text)
|
||||
|
||||
if(!query_list || query_list.len < 1)
|
||||
if(!query_list || length(query_list) < 1)
|
||||
return
|
||||
|
||||
var/list/querys = SDQL_parse(query_list)
|
||||
|
||||
if(!querys || querys.len < 1)
|
||||
if(!querys || length(querys) < 1)
|
||||
return
|
||||
|
||||
var/query_log = "executed SDQL query: \"[query_text]\"."
|
||||
@@ -129,7 +129,7 @@
|
||||
var/datum/temp = d
|
||||
var/i = 0
|
||||
for(var/v in sets)
|
||||
if(++i == sets.len)
|
||||
if(++i == length(sets))
|
||||
if(isturf(temp) && (v == "x" || v == "y" || v == "z"))
|
||||
continue
|
||||
if(!temp.vv_edit_var(v, SDQL_expression(d, set_list[sets])))
|
||||
@@ -156,7 +156,7 @@
|
||||
for(var/val in query_list)
|
||||
if(val == ";")
|
||||
do_parse = 1
|
||||
else if(pos >= query_list.len)
|
||||
else if(pos >= length(query_list))
|
||||
query_tree += val
|
||||
do_parse = 1
|
||||
|
||||
@@ -164,7 +164,7 @@
|
||||
parser.query = query_tree
|
||||
var/list/parsed_tree
|
||||
parsed_tree = parser.parse()
|
||||
if(parsed_tree.len > 0)
|
||||
if(length(parsed_tree) > 0)
|
||||
querys.len = querys_pos
|
||||
querys[querys_pos] = parsed_tree
|
||||
querys_pos++
|
||||
@@ -282,7 +282,7 @@
|
||||
var/result = 0
|
||||
var/val
|
||||
|
||||
for(var/i = start, i <= expression.len, i++)
|
||||
for(var/i = start, i <= length(expression), i++)
|
||||
var/op = ""
|
||||
|
||||
if(i > start)
|
||||
@@ -337,7 +337,7 @@
|
||||
var/i = start
|
||||
var/val = null
|
||||
|
||||
if(i > expression.len)
|
||||
if(i > length(expression))
|
||||
return list("val" = null, "i" = i)
|
||||
|
||||
if(istype(expression[i], /list))
|
||||
@@ -375,14 +375,14 @@
|
||||
|
||||
else
|
||||
val = SDQL_var(object, expression, i, object)
|
||||
i = expression.len
|
||||
i = length(expression)
|
||||
|
||||
return list("val" = val, "i" = i)
|
||||
|
||||
/proc/SDQL_var(datum/object, list/expression, start = 1, source)
|
||||
var/v
|
||||
|
||||
var/long = start < expression.len
|
||||
var/long = start < length(expression)
|
||||
|
||||
if(object == world && long && expression[start + 1] == ".")
|
||||
to_chat(usr, "Sorry, but global variables are not supported at the moment.")
|
||||
@@ -431,7 +431,7 @@
|
||||
else if(expression[start + 1] == "\[" && islist(v))
|
||||
var/list/L = v
|
||||
var/index = SDQL_expression(source, expression[start + 2])
|
||||
if(isnum(index) && (!ISINTEGER(index) || L.len < index))
|
||||
if(isnum(index) && (!ISINTEGER(index) || length(L) < index))
|
||||
to_chat(world, "<span class='danger'>Invalid list index: [index]</span>")
|
||||
return null
|
||||
return L[index]
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
/datum/SDQL_parser/proc/parse_error(error_message)
|
||||
error = 1
|
||||
to_chat(usr, "<span class='danger'>SDQL2 Parsing Error: [error_message]</span>")
|
||||
return query.len + 1
|
||||
return length(query) + 1
|
||||
|
||||
/datum/SDQL_parser/proc/parse()
|
||||
tree = list()
|
||||
@@ -73,14 +73,14 @@
|
||||
return tree
|
||||
|
||||
/datum/SDQL_parser/proc/token(i)
|
||||
if(i <= query.len)
|
||||
if(i <= length(query))
|
||||
return query[i]
|
||||
|
||||
else
|
||||
return null
|
||||
|
||||
/datum/SDQL_parser/proc/tokens(i, num)
|
||||
if(i + num <= query.len)
|
||||
if(i + num <= length(query))
|
||||
return query.Copy(i, i + num)
|
||||
|
||||
else
|
||||
|
||||
@@ -47,12 +47,12 @@
|
||||
SSblackbox.record_feedback("tally", "admin_verb", 1, "Check Power") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
for(var/datum/regional_powernet/PN in SSmachines.powernets)
|
||||
if(!PN.nodes || !PN.nodes.len)
|
||||
if(PN.cables && (PN.cables.len > 1))
|
||||
if(!PN.nodes || !length(PN.nodes))
|
||||
if(PN.cables && (length(PN.cables) > 1))
|
||||
var/obj/structure/cable/C = PN.cables[1]
|
||||
to_chat(usr, "Powernet with no nodes! (number [PN.number]) - example cable at [C.x], [C.y], [C.z] in area [get_area(C.loc)]")
|
||||
|
||||
if(!PN.cables || (PN.cables.len < 10))
|
||||
if(PN.cables && (PN.cables.len > 1))
|
||||
if(!PN.cables || (length(PN.cables) < 10))
|
||||
if(PN.cables && (length(PN.cables) > 1))
|
||||
var/obj/structure/cable/C = PN.cables[1]
|
||||
to_chat(usr, "Powernet with fewer than 10 cables! (number [PN.number]) - example cable at [C.x], [C.y], [C.z] in area [get_area(C.loc)]")
|
||||
|
||||
@@ -64,13 +64,13 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
|
||||
if(!target)
|
||||
to_chat(usr, "<font color='red'>Error: callproc(): owner of proc no longer exists.</font>")
|
||||
return
|
||||
message_admins("[key_name_admin(src)] called [target]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].")
|
||||
log_admin("[key_name(src)] called [target]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].")
|
||||
message_admins("[key_name_admin(src)] called [target]'s [procname]() with [length(lst) ? "the arguments [list2params(lst)]":"no arguments"].")
|
||||
log_admin("[key_name(src)] called [target]'s [procname]() with [length(lst) ? "the arguments [list2params(lst)]":"no arguments"].")
|
||||
returnval = WrapAdminProcCall(target, procname, lst) // Pass the lst as an argument list to the proc
|
||||
else
|
||||
//this currently has no hascall protection. wasn't able to get it working.
|
||||
message_admins("[key_name_admin(src)] called [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"]")
|
||||
log_admin("[key_name(src)] called [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"]")
|
||||
message_admins("[key_name_admin(src)] called [procname]() with [length(lst) ? "the arguments [list2params(lst)]":"no arguments"]")
|
||||
log_admin("[key_name(src)] called [procname]() with [length(lst) ? "the arguments [list2params(lst)]":"no arguments"]")
|
||||
returnval = WrapAdminProcCall(GLOBAL_PROC, procname, lst) // Pass the lst as an argument list to the proc
|
||||
|
||||
to_chat(usr, "<font color='#EB4E00'>[procname] returned: [!isnull(returnval) ? returnval : "null"]</font>")
|
||||
@@ -173,8 +173,8 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
|
||||
if(!A || !IsValidSrc(A))
|
||||
to_chat(src, "<span class='warning'>Error: callproc_datum(): owner of proc no longer exists.</span>")
|
||||
return
|
||||
message_admins("[key_name_admin(src)] called [A]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"]")
|
||||
log_admin("[key_name(src)] called [A]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"]")
|
||||
message_admins("[key_name_admin(src)] called [A]'s [procname]() with [length(lst) ? "the arguments [list2params(lst)]":"no arguments"]")
|
||||
log_admin("[key_name(src)] called [A]'s [procname]() with [length(lst) ? "the arguments [list2params(lst)]":"no arguments"]")
|
||||
|
||||
spawn()
|
||||
var/returnval = WrapAdminProcCall(A, procname, lst) // Pass the lst as an argument list to the proc
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
if(!f)
|
||||
output += " [filters[filter]]: ERROR<br>"
|
||||
continue
|
||||
output += " [filters[filter]]: [f.len]<br>"
|
||||
output += " [filters[filter]]: [length(f)]<br>"
|
||||
for(var/device in f)
|
||||
if(isobj(device))
|
||||
output += " [device] ([device:x],[device:y],[device:z] in area [get_area(device:loc)])<br>"
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
if(!G.client.is_afk())
|
||||
if(!(G.mind && G.mind.current && G.mind.current.stat != DEAD))
|
||||
possible_ghosts += G
|
||||
for(var/i=teamsize,(i>0&&possible_ghosts.len),i--) //Decrease with every member selected.
|
||||
for(var/i=teamsize,(i>0&&length(possible_ghosts)),i--) //Decrease with every member selected.
|
||||
var/candidate = input("Pick characters to spawn. This will go on until there either no more ghosts to pick from, or the slots are full.", "Active Players") as null|anything in possible_ghosts // auto-picks if only one candidate
|
||||
possible_ghosts -= candidate
|
||||
players_to_spawn += candidate
|
||||
@@ -55,7 +55,7 @@
|
||||
to_chat(src, "Polling candidates...")
|
||||
players_to_spawn = SSghost_spawns.poll_candidates("Do you want to play as \a [initial(O.name)]?")
|
||||
|
||||
if(!players_to_spawn.len)
|
||||
if(!length(players_to_spawn))
|
||||
to_chat(src, "Nobody volunteered.")
|
||||
return 0
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ GLOBAL_VAR_INIT(sent_syndicate_infiltration_team, 0)
|
||||
if(!G.client.is_afk())
|
||||
if(!(G.mind && G.mind.current && G.mind.current.stat != DEAD))
|
||||
possible_ghosts += G
|
||||
for(var/i=teamsize,(i>0&&possible_ghosts.len),i--) //Decrease with every SIT member selected.
|
||||
for(var/i=teamsize,(i>0&&length(possible_ghosts)),i--) //Decrease with every SIT member selected.
|
||||
var/candidate = input("Pick characters to spawn as a SIT member. This will go on until there either no more ghosts to pick from, or the slots are full.", "Active Players") as null|anything in possible_ghosts // auto-picks if only one candidate
|
||||
possible_ghosts -= candidate
|
||||
infiltrators += candidate
|
||||
@@ -58,7 +58,7 @@ GLOBAL_VAR_INIT(sent_syndicate_infiltration_team, 0)
|
||||
var/image/I = new('icons/obj/cardboard_cutout.dmi', "cutout_sit")
|
||||
infiltrators = SSghost_spawns.poll_candidates("Do you want to play as a Syndicate infiltrator?", ROLE_TRAITOR, TRUE, source = I, role_cleanname = "Syndicate infiltrator")
|
||||
|
||||
if(!infiltrators.len)
|
||||
if(!length(infiltrators))
|
||||
to_chat(src, "Nobody volunteered.")
|
||||
return 0
|
||||
|
||||
@@ -76,10 +76,10 @@ GLOBAL_VAR_INIT(sent_syndicate_infiltration_team, 0)
|
||||
var/num_spawned = 1
|
||||
var/team_leader = null
|
||||
for(var/obj/effect/landmark/L in sit_spawns)
|
||||
if(!infiltrators.len && !spawn_dummies) break
|
||||
if(!length(infiltrators) && !spawn_dummies) break
|
||||
syndicate_leader_selected = num_spawned == 1?1:0
|
||||
var/mob/living/carbon/human/new_syndicate_infiltrator = create_syndicate_infiltrator(L, syndicate_leader_selected, tcamount, 0)
|
||||
if(infiltrators.len)
|
||||
if(length(infiltrators))
|
||||
var/mob/theguy = pick(infiltrators)
|
||||
if(theguy.key != key)
|
||||
new_syndicate_infiltrator.key = theguy.key
|
||||
|
||||
@@ -14,7 +14,7 @@ GLOBAL_LIST_EMPTY(open_logging_views)
|
||||
else if(clear_view)
|
||||
cur_view.clear_all()
|
||||
|
||||
if(mobs_to_add?.len)
|
||||
if(length(mobs_to_add))
|
||||
cur_view.add_mobs(mobs_to_add)
|
||||
|
||||
cur_view.show_ui(usr)
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
if(VV_RESTORE_DEFAULT)
|
||||
to_chat(src, "Finding items...")
|
||||
var/list/items = get_all_of_type(O.type, method)
|
||||
to_chat(src, "Changing [items.len] items...")
|
||||
to_chat(src, "Changing [length(items)] items...")
|
||||
for(var/thing in items)
|
||||
if(!thing)
|
||||
continue
|
||||
@@ -126,7 +126,7 @@
|
||||
var/list/varsvars = vv_parse_text(O, new_value)
|
||||
var/pre_processing = new_value
|
||||
var/unique
|
||||
if(varsvars && varsvars.len)
|
||||
if(varsvars && length(varsvars))
|
||||
unique = alert(usr, "Process vars unique to each instance, or same for all?", "Variable Association", "Unique", "Same")
|
||||
if(unique == "Unique")
|
||||
unique = TRUE
|
||||
@@ -137,7 +137,7 @@
|
||||
|
||||
to_chat(src, "Finding items...")
|
||||
var/list/items = get_all_of_type(O.type, method)
|
||||
to_chat(src, "Changing [items.len] items...")
|
||||
to_chat(src, "Changing [length(items)] items...")
|
||||
for(var/thing in items)
|
||||
if(!thing)
|
||||
continue
|
||||
@@ -165,7 +165,7 @@
|
||||
var/type = value["type"]
|
||||
to_chat(src, "Finding items...")
|
||||
var/list/items = get_all_of_type(O.type, method)
|
||||
to_chat(src, "Changing [items.len] items...")
|
||||
to_chat(src, "Changing [length(items)] items...")
|
||||
for(var/thing in items)
|
||||
if(!thing)
|
||||
continue
|
||||
@@ -183,7 +183,7 @@
|
||||
else
|
||||
to_chat(src, "Finding items...")
|
||||
var/list/items = get_all_of_type(O.type, method)
|
||||
to_chat(src, "Changing [items.len] items...")
|
||||
to_chat(src, "Changing [length(items)] items...")
|
||||
for(var/thing in items)
|
||||
if(!thing)
|
||||
continue
|
||||
|
||||
@@ -282,9 +282,9 @@ GLOBAL_PROTECT(VVmaint_only)
|
||||
if(!ispath(type))
|
||||
return
|
||||
var/list/subtypes = subtypesof(type)
|
||||
if(!subtypes || !subtypes.len)
|
||||
if(!subtypes || !length(subtypes))
|
||||
return FALSE
|
||||
if(subtypes && subtypes.len)
|
||||
if(subtypes && length(subtypes))
|
||||
switch(alert("Strict object type detection?", "Type detection", "Strictly this type","This type and subtypes", "Cancel"))
|
||||
if("Strictly this type")
|
||||
return FALSE
|
||||
@@ -374,7 +374,7 @@ GLOBAL_PROTECT(VVmaint_only)
|
||||
to_chat(src, "Not a List.")
|
||||
return
|
||||
|
||||
if(L.len > 1000)
|
||||
if(length(L) > 1000)
|
||||
var/confirm = alert(src, "The list you're trying to edit is very long, continuing may crash the server.", "Warning", "Continue", "Abort")
|
||||
if(confirm != "Continue")
|
||||
return
|
||||
@@ -382,7 +382,7 @@ GLOBAL_PROTECT(VVmaint_only)
|
||||
|
||||
|
||||
var/list/names = list()
|
||||
for(var/i in 1 to L.len)
|
||||
for(var/i in 1 to length(L))
|
||||
var/key = L[i]
|
||||
var/value
|
||||
if(IS_NORMAL_LIST(L) && !isnum(key))
|
||||
|
||||
@@ -60,8 +60,8 @@
|
||||
if(CandCheck(ROLE_TRAITOR, applicant, temp))
|
||||
candidates += applicant
|
||||
|
||||
if(candidates.len)
|
||||
var/numTraitors = min(candidates.len, antnum)
|
||||
if(length(candidates))
|
||||
var/numTraitors = min(length(candidates), antnum)
|
||||
|
||||
for(var/i = 0, i<numTraitors, i++)
|
||||
H = pick(candidates)
|
||||
@@ -91,8 +91,8 @@
|
||||
if(CandCheck(ROLE_CHANGELING, applicant, temp))
|
||||
candidates += applicant
|
||||
|
||||
if(candidates.len)
|
||||
var/numChangelings = min(candidates.len, antnum)
|
||||
if(length(candidates))
|
||||
var/numChangelings = min(length(candidates), antnum)
|
||||
|
||||
for(var/i = 0, i<numChangelings, i++)
|
||||
H = pick(candidates)
|
||||
@@ -121,8 +121,8 @@
|
||||
if(CandCheck(ROLE_REV, applicant, temp))
|
||||
candidates += applicant
|
||||
|
||||
if(candidates.len)
|
||||
var/numRevs = min(candidates.len, antnum)
|
||||
if(length(candidates))
|
||||
var/numRevs = min(length(candidates), antnum)
|
||||
|
||||
for(var/i = 0, i<numRevs, i++)
|
||||
H = pick(candidates)
|
||||
@@ -142,7 +142,7 @@
|
||||
log_admin("[key_name(owner)] tried making a Wizard with One-Click-Antag")
|
||||
message_admins("[key_name_admin(owner)] tried making a Wizard with One-Click-Antag")
|
||||
|
||||
if(candidates.len)
|
||||
if(length(candidates))
|
||||
var/mob/dead/observer/selected = pick(candidates)
|
||||
candidates -= selected
|
||||
|
||||
@@ -276,8 +276,8 @@
|
||||
if(CandCheck(ROLE_VAMPIRE, applicant, temp))
|
||||
candidates += applicant
|
||||
|
||||
if(candidates.len)
|
||||
var/numVampires = min(candidates.len, antnum)
|
||||
if(length(candidates))
|
||||
var/numVampires = min(length(candidates), antnum)
|
||||
|
||||
for(var/i = 0, i<numVampires, i++)
|
||||
H = pick(candidates)
|
||||
|
||||
@@ -368,7 +368,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
|
||||
if(G_found.mind.assigned_role=="Alien")
|
||||
if(alert("This character appears to have been an alien. Would you like to respawn them as such?", null,"Yes","No")=="Yes")
|
||||
var/turf/T
|
||||
if(GLOB.xeno_spawn.len) T = pick(GLOB.xeno_spawn)
|
||||
if(length(GLOB.xeno_spawn)) T = pick(GLOB.xeno_spawn)
|
||||
else T = pick(GLOB.latejoin)
|
||||
|
||||
var/mob/living/carbon/alien/new_xeno
|
||||
@@ -519,14 +519,14 @@ Traitors and the like can also be revived with the previous role mostly intact.
|
||||
if(M.mind && M.mind.current && M.mind.current.stat != DEAD)
|
||||
continue //we have a live body we are tied to
|
||||
candidates += M.ckey
|
||||
if(candidates.len)
|
||||
if(length(candidates))
|
||||
ckey = input("Pick the player you want to respawn as a xeno.", "Suitable Candidates") as null|anything in candidates
|
||||
else
|
||||
to_chat(usr, "<font color='red'>Error: create_xeno(): no suitable candidates.</font>")
|
||||
if(!istext(ckey)) return 0
|
||||
|
||||
var/alien_caste = input(usr, "Please choose which caste to spawn.","Pick a caste",null) as null|anything in list("Queen","Hunter","Sentinel","Drone","Larva")
|
||||
var/obj/effect/landmark/spawn_here = GLOB.xeno_spawn.len ? pick(GLOB.xeno_spawn) : pick(GLOB.latejoin)
|
||||
var/obj/effect/landmark/spawn_here = length(GLOB.xeno_spawn) ? pick(GLOB.xeno_spawn) : pick(GLOB.latejoin)
|
||||
var/mob/living/carbon/alien/new_xeno
|
||||
switch(alien_caste)
|
||||
if("Queen") new_xeno = new /mob/living/carbon/alien/humanoid/queen/large(spawn_here)
|
||||
|
||||
Reference in New Issue
Block a user