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 19:32:09 +02:00
committed by GitHub
parent bdd417ada0
commit bad8b31afa
369 changed files with 1162 additions and 1163 deletions
+4 -4
View File
@@ -52,10 +52,10 @@ GLOBAL_REAL(GLOB, /datum/controller/global_vars)
gvars_datum_init_order = list()
gvars_datum_protected_varlist = list("gvars_datum_protected_varlist" = TRUE)
var/list/global_procs = typesof(/datum/controller/global_vars/proc)
var/expected_len = vars.len - gvars_datum_in_built_vars.len
if(global_procs.len != expected_len)
warning("Unable to detect all global initialization procs! Expected [expected_len] got [global_procs.len]!")
if(global_procs.len)
var/expected_len = length(vars) - length(gvars_datum_in_built_vars)
if(length(global_procs) != expected_len)
warning("Unable to detect all global initialization procs! Expected [expected_len] got [length(global_procs)]!")
if(length(global_procs))
var/list/expected_global_procs = vars - gvars_datum_in_built_vars
for(var/I in global_procs)
expected_global_procs -= replacetext("[I]", "InitGlobal", "")
+2 -2
View File
@@ -332,9 +332,9 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
var/ss_runlevels = SS.runlevels
var/added_to_any = FALSE
for(var/I in 1 to GLOB.bitflags.len)
for(var/I in 1 to length(GLOB.bitflags))
if(ss_runlevels & GLOB.bitflags[I])
while(runlevel_sorted_subsystems.len < I)
while(length(runlevel_sorted_subsystems) < I)
runlevel_sorted_subsystems += list(list())
runlevel_sorted_subsystems[I] += SS
added_to_any = TRUE
+2 -2
View File
@@ -25,8 +25,8 @@ SUBSYSTEM_DEF(acid)
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/obj/O = currentrun[currentrun.len]
while(length(currentrun))
var/obj/O = currentrun[length(currentrun)]
currentrun.len--
if(!O || QDELETED(O))
processing -= O
+1 -1
View File
@@ -86,7 +86,7 @@ SUBSYSTEM_DEF(afk)
/datum/controller/subsystem/afk/proc/removeFromWatchList(list/toRemove)
for(var/C in toRemove)
for(var/i in 1 to afk_players.len)
for(var/i in 1 to length(afk_players))
if(afk_players[i] == C)
afk_players.Cut(i, i + 1)
break
+23 -23
View File
@@ -59,13 +59,13 @@ SUBSYSTEM_DEF(air)
msg += "DPN:[round(cost_deferred_pipenets,1)]|"
msg += "AM:[round(cost_atmos_machinery,1)]"
msg += "} "
msg += "AT:[active_turfs.len]|"
msg += "EG:[excited_groups.len]|"
msg += "HS:[hotspots.len]|"
msg += "PN:[networks.len]|"
msg += "HP:[high_pressure_delta.len]|"
msg += "AS:[active_super_conductivity.len]|"
msg += "AT/MS:[round((cost ? active_turfs.len/cost : 0),0.1)]"
msg += "AT:[length(active_turfs)]|"
msg += "EG:[length(excited_groups)]|"
msg += "HS:[length(hotspots)]|"
msg += "PN:[length(networks)]|"
msg += "HP:[length(high_pressure_delta)]|"
msg += "AS:[length(active_super_conductivity)]|"
msg += "AT/MS:[round((cost ? length(active_turfs)/cost : 0),0.1)]"
return msg.Join("")
/datum/controller/subsystem/air/get_metrics()
@@ -179,8 +179,8 @@ SUBSYSTEM_DEF(air)
src.currentrun = deferred_pipenet_rebuilds.Copy()
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/obj/machinery/atmospherics/A = currentrun[currentrun.len]
while(length(currentrun))
var/obj/machinery/atmospherics/A = currentrun[length(currentrun)]
currentrun.len--
if(A)
A.build_network(remove_deferral = TRUE)
@@ -194,8 +194,8 @@ SUBSYSTEM_DEF(air)
src.currentrun = networks.Copy()
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/datum/pipeline/thing = currentrun[currentrun.len]
while(length(currentrun))
var/datum/pipeline/thing = currentrun[length(currentrun)]
currentrun.len--
if(thing)
thing.process()
@@ -210,8 +210,8 @@ SUBSYSTEM_DEF(air)
src.currentrun = atmos_machinery.Copy()
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/obj/machinery/atmospherics/M = currentrun[currentrun.len]
while(length(currentrun))
var/obj/machinery/atmospherics/M = currentrun[length(currentrun)]
currentrun.len--
if(!M || (M.process_atmos(seconds) == PROCESS_KILL))
atmos_machinery.Remove(M)
@@ -223,8 +223,8 @@ SUBSYSTEM_DEF(air)
src.currentrun = active_super_conductivity.Copy()
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/turf/simulated/T = currentrun[currentrun.len]
while(length(currentrun))
var/turf/simulated/T = currentrun[length(currentrun)]
currentrun.len--
T.super_conduct()
if(MC_TICK_CHECK)
@@ -235,8 +235,8 @@ SUBSYSTEM_DEF(air)
src.currentrun = hotspots.Copy()
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/obj/effect/hotspot/H = currentrun[currentrun.len]
while(length(currentrun))
var/obj/effect/hotspot/H = currentrun[length(currentrun)]
currentrun.len--
if(H)
H.process()
@@ -246,8 +246,8 @@ SUBSYSTEM_DEF(air)
return
/datum/controller/subsystem/air/proc/process_high_pressure_delta(resumed = 0)
while(high_pressure_delta.len)
var/turf/simulated/T = high_pressure_delta[high_pressure_delta.len]
while(length(high_pressure_delta))
var/turf/simulated/T = high_pressure_delta[length(high_pressure_delta)]
high_pressure_delta.len--
T.high_pressure_movements()
T.pressure_difference = 0
@@ -261,8 +261,8 @@ SUBSYSTEM_DEF(air)
src.currentrun = active_turfs.Copy()
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/turf/simulated/T = currentrun[currentrun.len]
while(length(currentrun))
var/turf/simulated/T = currentrun[length(currentrun)]
currentrun.len--
if(T)
T.process_cell(fire_count)
@@ -274,8 +274,8 @@ SUBSYSTEM_DEF(air)
src.currentrun = excited_groups.Copy()
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/datum/excited_group/EG = currentrun[currentrun.len]
while(length(currentrun))
var/datum/excited_group/EG = currentrun[length(currentrun)]
currentrun.len--
EG.breakdown_cooldown++
if(EG.breakdown_cooldown == 10)
+5 -5
View File
@@ -68,10 +68,10 @@ SUBSYSTEM_DEF(blackbox)
/datum/controller/subsystem/blackbox/Shutdown()
sealed = FALSE
for(var/obj/machinery/message_server/MS in GLOB.message_servers)
if(MS.pda_msgs.len)
record_feedback("tally", "radio_usage", MS.pda_msgs.len, "PDA")
if(MS.rc_msgs.len)
record_feedback("tally", "radio_usage", MS.rc_msgs.len, "request console")
if(length(MS.pda_msgs))
record_feedback("tally", "radio_usage", length(MS.pda_msgs), "PDA")
if(length(MS.rc_msgs))
record_feedback("tally", "radio_usage", length(MS.rc_msgs), "request console")
if(length(research_levels))
record_feedback("associative", "high_research_level", 1, research_levels)
@@ -248,7 +248,7 @@ SUBSYSTEM_DEF(blackbox)
* * depth - Depth to use
*/
/datum/controller/subsystem/blackbox/proc/record_feedback_recurse_list(list/L, list/key_list, increment, depth = 1)
if(depth == key_list.len)
if(depth == length(key_list))
if(L.Find(key_list[depth]))
L["[key_list[depth]]"] += increment
else
+2 -2
View File
@@ -26,8 +26,8 @@ SUBSYSTEM_DEF(fires)
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/obj/O = currentrun[currentrun.len]
while(length(currentrun))
var/obj/O = currentrun[length(currentrun)]
currentrun.len--
if(!O || QDELETED(O))
processing -= O
+1 -1
View File
@@ -275,7 +275,7 @@ SUBSYSTEM_DEF(garbage)
/datum/controller/subsystem/garbage/Recover()
InitQueues() //We first need to create the queues before recovering data
if(istype(SSgarbage.queues))
for(var/i in 1 to SSgarbage.queues.len)
for(var/i in 1 to length(SSgarbage.queues))
queues[i] |= SSgarbage.queues[i]
+3 -3
View File
@@ -10,13 +10,13 @@ SUBSYSTEM_DEF(icon_smooth)
var/list/smooth_queue = list()
/datum/controller/subsystem/icon_smooth/fire()
while(smooth_queue.len)
var/atom/A = smooth_queue[smooth_queue.len]
while(length(smooth_queue))
var/atom/A = smooth_queue[length(smooth_queue)]
smooth_queue.len--
A.smooth_icon()
if(MC_TICK_CHECK)
return
if(!smooth_queue.len)
if(!length(smooth_queue))
can_fire = 0
/datum/controller/subsystem/icon_smooth/Initialize()
+2 -2
View File
@@ -24,8 +24,8 @@ SUBSYSTEM_DEF(idlenpcpool)
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/mob/living/simple_animal/SA = currentrun[currentrun.len]
while(length(currentrun))
var/mob/living/simple_animal/SA = currentrun[length(currentrun)]
--currentrun.len
if(!SA)
log_debug("idlenpcpool encountered an invalid entry, resumed: [resumed], SA [SA], type of SA [SA?.type], null [SA == null], qdelled [QDELETED(SA)], SA in AI_IDLE list: [SA in GLOB.simple_animals[AI_IDLE]]")
+9 -9
View File
@@ -44,7 +44,7 @@ SUBSYSTEM_DEF(jobs)
/datum/controller/subsystem/jobs/proc/SetupOccupations(list/faction = list("Station"))
occupations = list()
var/list/all_jobs = subtypesof(/datum/job)
if(!all_jobs.len)
if(!length(all_jobs))
to_chat(world, "<span class='warning'>Error setting up jobs, no job datums found.</span>")
return 0
@@ -63,12 +63,12 @@ SUBSYSTEM_DEF(jobs)
job_debug.Add(text)
/datum/controller/subsystem/jobs/proc/GetJob(rank)
if(!occupations.len)
if(!length(occupations))
SetupOccupations()
return name_occupations[rank]
/datum/controller/subsystem/jobs/proc/GetJobType(jobtype)
if(!occupations.len)
if(!length(occupations))
SetupOccupations()
return type_occupations[jobtype]
@@ -235,7 +235,7 @@ SUBSYSTEM_DEF(jobs)
if(!job)
continue
var/list/candidates = FindOccupationCandidates(job, level)
if(!candidates.len)
if(!length(candidates))
continue
var/list/filteredCandidates = list()
@@ -246,7 +246,7 @@ SUBSYSTEM_DEF(jobs)
continue
filteredCandidates += V
if(!filteredCandidates.len)
if(!length(filteredCandidates))
continue
var/mob/new_player/candidate = pick(filteredCandidates)
@@ -263,7 +263,7 @@ SUBSYSTEM_DEF(jobs)
if(!job)
continue
var/list/candidates = FindOccupationCandidates(job, level)
if(!candidates.len)
if(!length(candidates))
continue
var/mob/new_player/candidate = pick(candidates)
AssignRole(candidate, command_position)
@@ -282,7 +282,7 @@ SUBSYSTEM_DEF(jobs)
for(var/level = 1 to 3)
var/list/candidates = list()
candidates = FindOccupationCandidates(job, level)
if(candidates.len)
if(length(candidates))
var/mob/new_player/candidate = pick(candidates)
if(AssignRole(candidate, "AI"))
ai_selected++
@@ -317,7 +317,7 @@ SUBSYSTEM_DEF(jobs)
if(player.ready && player.mind && !player.mind.assigned_role)
unassigned += player
Debug("DO, Len: [unassigned.len]")
Debug("DO, Len: [length(unassigned)]")
if(!length(unassigned))
return FALSE
@@ -330,7 +330,7 @@ SUBSYSTEM_DEF(jobs)
Debug("DO, Running Assistant Check 1")
var/datum/job/ast = new /datum/job/assistant()
var/list/assistant_candidates = FindOccupationCandidates(ast, 3)
Debug("AC1, Candidates: [assistant_candidates.len]")
Debug("AC1, Candidates: [length(assistant_candidates)]")
for(var/mob/new_player/player in assistant_candidates)
Debug("AC1 pass, Player: [player]")
AssignRole(player, "Assistant")
+7 -7
View File
@@ -39,15 +39,15 @@ SUBSYSTEM_DEF(machines)
propagate_network(PC, PC.powernet)
/datum/controller/subsystem/machines/get_stat_details()
return "Machines: [processing.len] | Powernets: [powernets.len] | Deferred: [deferred_powernet_rebuilds.len]"
return "Machines: [length(processing)] | Powernets: [length(powernets)] | Deferred: [length(deferred_powernet_rebuilds)]"
/datum/controller/subsystem/machines/proc/process_defered_powernets(resumed = 0)
if(!resumed)
src.currentrun = deferred_powernet_rebuilds.Copy()
//cache for sanid speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/obj/O = currentrun[currentrun.len]
while(length(currentrun))
var/obj/O = currentrun[length(currentrun)]
currentrun.len--
if(O && !QDELETED(O))
var/datum/regional_powernet/newPN = new() // create a new powernet...
@@ -62,8 +62,8 @@ SUBSYSTEM_DEF(machines)
src.currentrun = powernets.Copy()
//cache for sanid speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/datum/regional_powernet/P = currentrun[currentrun.len]
while(length(currentrun))
var/datum/regional_powernet/P = currentrun[length(currentrun)]
currentrun.len--
if(P)
P.process_power() // reset the power state
@@ -78,8 +78,8 @@ SUBSYSTEM_DEF(machines)
src.currentrun = processing.Copy()
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/obj/machinery/thing = currentrun[currentrun.len]
while(length(currentrun))
var/obj/machinery/thing = currentrun[length(currentrun)]
currentrun.len--
if(!QDELETED(thing) && thing.process(seconds) != PROCESS_KILL)
if(prob(MACHINE_FLICKER_CHANCE))
+2 -2
View File
@@ -35,8 +35,8 @@ SUBSYSTEM_DEF(mobs)
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
var/times_fired = src.times_fired
while(currentrun.len)
var/mob/living/L = currentrun[currentrun.len]
while(length(currentrun))
var/mob/living/L = currentrun[length(currentrun)]
currentrun.len--
if(L)
L.Life(seconds, times_fired)
@@ -21,7 +21,7 @@ SUBSYSTEM_DEF(mob_hunt)
if(!server_status)
return
client_mob_update()
if(normal_spawns.len < max_normal_spawns)
if(length(normal_spawns) < max_normal_spawns)
spawn_mob()
//leaving this here in case admins want to use it for a random mini-event or something
@@ -51,7 +51,7 @@ SUBSYSTEM_DEF(mob_hunt)
if(!H || H != connected_clients[client])
ex_players |= connected_clients[client]
connected_clients[client] = H
if(ex_players.len) //to make sure we don't do this if we didn't lose any player since the last update
if(length(ex_players)) //to make sure we don't do this if we didn't lose any player since the last update
for(var/obj/effect/nanomob/N in (normal_spawns + trap_spawns))
N.conceal(ex_players)
@@ -59,7 +59,7 @@ SUBSYSTEM_DEF(mob_hunt)
if(server_status != 0)
return
server_status = 1
while(normal_spawns.len < max_normal_spawns) //repopulate the server's spawns completely if we auto-recover from crash
while(length(normal_spawns) < max_normal_spawns) //repopulate the server's spawns completely if we auto-recover from crash
spawn_mob()
/datum/controller/subsystem/mob_hunt/proc/manual_reboot()
@@ -94,7 +94,7 @@ SUBSYSTEM_DEF(mob_hunt)
var/obj/effect/nanomob/new_mob = new /obj/effect/nanomob(mob_info.spawn_point, mob_info)
trap_spawns += new_mob
new_mob.reveal()
if(trap_spawns.len > max_trap_spawns)
if(length(trap_spawns) > max_trap_spawns)
var/obj/effect/nanomob/old_trap = trap_spawns[1]
old_trap.despawn()
return 1
+2 -2
View File
@@ -18,8 +18,8 @@ SUBSYSTEM_DEF(npcpool)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/mob/living/simple_animal/SA = currentrun[currentrun.len]
while(length(currentrun))
var/mob/living/simple_animal/SA = currentrun[length(currentrun)]
--currentrun.len
if(!SA)
log_debug("npcpool encountered an invalid entry, resumed: [resumed], SA [SA], type of SA [SA?.type], null [SA == null], qdelled [QDELETED(SA)], SA in AI_ON list: [SA in GLOB.simple_animals[AI_ON]]")
+12 -12
View File
@@ -113,7 +113,7 @@ SUBSYSTEM_DEF(overlays)
priority_overlays.Cut()
//If not already queued for work and there are overlays to remove
if(NOT_QUEUED_ALREADY && remove_overlays.len)
if(NOT_QUEUED_ALREADY && length(remove_overlays))
QUEUE_FOR_COMPILE
/atom/proc/cut_overlay(list/overlays, priority)
@@ -123,9 +123,9 @@ SUBSYSTEM_DEF(overlays)
LAZYINITLIST(add_overlays) //always initialized after this point
LAZYINITLIST(priority_overlays)
LAZYINITLIST(remove_overlays)
var/a_len = add_overlays.len
var/r_len = remove_overlays.len
var/p_len = priority_overlays.len
var/a_len = length(add_overlays)
var/r_len = length(remove_overlays)
var/p_len = length(priority_overlays)
remove_overlays += overlays
add_overlays -= overlays
@@ -133,9 +133,9 @@ SUBSYSTEM_DEF(overlays)
var/list/cached_priority = priority_overlays
LAZYREMOVE(cached_priority, overlays)
var/fa_len = add_overlays.len
var/fr_len = remove_overlays.len
var/fp_len = priority_overlays.len
var/fa_len = length(add_overlays)
var/fr_len = length(remove_overlays)
var/fp_len = length(priority_overlays)
//If not already queued and there is work to be done
if(NOT_QUEUED_ALREADY && (fa_len != a_len || fr_len != r_len || fp_len != p_len))
@@ -149,17 +149,17 @@ SUBSYSTEM_DEF(overlays)
LAZYINITLIST(add_overlays) //always initialized after this point
LAZYINITLIST(priority_overlays)
var/a_len = add_overlays.len
var/p_len = priority_overlays.len
var/a_len = length(add_overlays)
var/p_len = length(priority_overlays)
if(priority)
priority_overlays += overlays //or in the image. Can we use [image] = image?
var/fp_len = priority_overlays.len
var/fp_len = length(priority_overlays)
if(NOT_QUEUED_ALREADY && fp_len != p_len)
QUEUE_FOR_COMPILE
else
add_overlays += overlays
var/fa_len = add_overlays.len
var/fa_len = length(add_overlays)
if(NOT_QUEUED_ALREADY && fa_len != a_len)
QUEUE_FOR_COMPILE
@@ -200,7 +200,7 @@ SUBSYSTEM_DEF(overlays)
var/list/cached_other = other.overlays.Copy()
if(cached_other)
if(cut_old || !overlays.len)
if(cut_old || !length(overlays))
overlays = cached_other
else
overlays |= cached_other
+1 -1
View File
@@ -31,7 +31,7 @@ SUBSYSTEM_DEF(parallax)
var/list/currentrun = src.currentrun
while(length(currentrun))
var/client/C = currentrun[currentrun.len]
var/client/C = currentrun[length(currentrun)]
currentrun.len--
if(!C || !C.eye)
if(MC_TICK_CHECK)
+1 -1
View File
@@ -27,7 +27,7 @@ SUBSYSTEM_DEF(ping)
var/list/current_run = src.current_run
while(length(current_run))
var/client/client = current_run[current_run.len]
var/client/client = current_run[length(current_run)]
current_run.len--
if(client?.tgui_panel?.is_ready())
+3 -3
View File
@@ -246,7 +246,7 @@ SUBSYSTEM_DEF(shuttle)
/datum/controller/subsystem/shuttle/proc/get_dock_overlap(x0, y0, x1, y1, z)
. = list()
var/list/stationary_cache = stationary
for(var/i in 1 to stationary_cache.len)
for(var/i in 1 to length(stationary_cache))
var/obj/docking_port/port = stationary_cache[i]
if(!port || port.z != z)
continue
@@ -254,7 +254,7 @@ SUBSYSTEM_DEF(shuttle)
var/list/overlap = get_overlap(x0, y0, x1, y1, bounds[1], bounds[2], bounds[3], bounds[4])
var/list/xs = overlap[1]
var/list/ys = overlap[2]
if(xs.len && ys.len)
if(length(xs) && length(ys))
.[port] = overlap
/datum/controller/subsystem/shuttle/proc/update_hidden_docking_ports(list/remove_turfs, list/add_turfs)
@@ -272,7 +272,7 @@ SUBSYSTEM_DEF(shuttle)
for(var/V in add_turfs)
var/turf/T = V
var/image/I
if(remove_images.len)
if(length(remove_images))
//we can just reuse any images we are about to delete instead of making new ones
I = remove_images[1]
remove_images.Cut(1, 2)
+2 -2
View File
@@ -26,8 +26,8 @@ SUBSYSTEM_DEF(spacedrift)
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/atom/movable/AM = currentrun[currentrun.len]
while(length(currentrun))
var/atom/movable/AM = currentrun[length(currentrun)]
currentrun.len--
if(!AM)
processing -= AM
+2 -2
View File
@@ -42,8 +42,8 @@ SUBSYSTEM_DEF(tgui)
src.current_run = open_uis.Copy()
// Cache for sanic speed (lists are references anyways)
var/list/current_run = src.current_run
while(current_run.len)
var/datum/tgui/ui = current_run[current_run.len]
while(length(current_run))
var/datum/tgui/ui = current_run[length(current_run)]
current_run.len--
// TODO: Move user/src_object check to process()
if(ui && ui.user && ui.src_object)
+1 -1
View File
@@ -30,7 +30,7 @@ SUBSYSTEM_DEF(throwing)
var/list/currentrun = src.currentrun
while(length(currentrun))
var/atom/movable/AM = currentrun[currentrun.len]
var/atom/movable/AM = currentrun[length(currentrun)]
var/datum/thrownthing/TT = currentrun[AM]
currentrun.len--
if(!AM || !TT)
+4 -4
View File
@@ -529,9 +529,9 @@ SUBSYSTEM_DEF(ticker)
else
var/list/randomtips = file2list("strings/tips.txt")
var/list/memetips = file2list("strings/sillytips.txt")
if(randomtips.len && prob(95))
if(length(randomtips) && prob(95))
m = pick(randomtips)
else if(memetips.len)
else if(length(memetips))
m = pick(memetips)
if(m)
@@ -706,8 +706,8 @@ SUBSYSTEM_DEF(ticker)
for(var/loc_type in subtypesof(/datum/trade_destination))
var/datum/trade_destination/D = new loc_type
GLOB.weighted_randomevent_locations[D] = D.viable_random_events.len
GLOB.weighted_mundaneevent_locations[D] = D.viable_mundane_events.len
GLOB.weighted_randomevent_locations[D] = length(D.viable_random_events)
GLOB.weighted_mundaneevent_locations[D] = length(D.viable_mundane_events)
// Easy handler to make rebooting the world not a massive sleep in world/Reboot()
/datum/controller/subsystem/ticker/proc/reboot_helper(reason, end_string, delay)
@@ -36,7 +36,7 @@ SUBSYSTEM_DEF(atoms)
var/count
var/list/mapload_arg = list(TRUE)
if(atoms)
count = atoms.len
count = length(atoms)
for(var/I in atoms)
var/atom/A = I
if(A && !A.initialized)
@@ -58,7 +58,7 @@ SUBSYSTEM_DEF(atoms)
initialized = INITIALIZATION_INNEW_REGULAR
if(late_loaders.len)
if(length(late_loaders))
watch = start_watch()
if(noisy)
log_startup_progress("Late-initializing atoms...")
@@ -203,7 +203,7 @@ SUBSYSTEM_DEF(mapping)
log_startup_progress("Loaded Lavaland in [stop_watch(watch)]s")
/datum/controller/subsystem/mapping/proc/seedRuins(list/z_levels = null, budget = 0, whitelist = /area/space, list/potentialRuins)
if(!z_levels || !z_levels.len)
if(!z_levels || !length(z_levels))
WARNING("No Z levels provided - Not generating ruins")
return
@@ -230,10 +230,10 @@ SUBSYSTEM_DEF(mapping)
continue
ruins_availible[R] = R.placement_weight
while(budget > 0 && (ruins_availible.len || forced_ruins.len))
while(budget > 0 && (length(ruins_availible) || length(forced_ruins)))
var/datum/map_template/ruin/current_pick
var/forced = FALSE
if(forced_ruins.len) //We have something we need to load right now, so just pick it
if(length(forced_ruins)) //We have something we need to load right now, so just pick it
for(var/ruin in forced_ruins)
current_pick = ruin
if(forced_ruins[ruin] > 0) //Load into designated z
@@ -85,7 +85,7 @@ SUBSYSTEM_DEF(radio)
if(frequency)
frequency.remove_listener(device)
if(frequency.devices.len == 0)
if(length(frequency.devices) == 0)
qdel(frequency)
frequencies -= f_text
@@ -10,10 +10,10 @@ SUBSYSTEM_DEF(title)
for(var/S in provisional_title_screens)
var/list/L = splittext(S,"+")
if(L.len == 1 && L[1] != "blank.png")
if(length(L) == 1 && L[1] != "blank.png")
title_screens += S
else if(L.len > 1)
else if(length(L) > 1)
if(use_rare_screens && lowertext(L[1]) == "rare")
title_screens += S
@@ -21,7 +21,7 @@ SUBSYSTEM_DEF(title)
if(length(title_screens) > 1)
for(var/S in title_screens)
var/list/L = splittext(S,".")
if(L.len != 2 || L[1] != "default")
if(length(L) != 2 || L[1] != "default")
continue
title_screens -= S
break
@@ -26,8 +26,8 @@ SUBSYSTEM_DEF(processing)
//cache for sanic speed (lists are references anyways)
var/list/current_run = currentrun
while(current_run.len)
var/datum/thing = current_run[current_run.len]
while(length(current_run))
var/datum/thing = current_run[length(current_run)]
current_run.len--
if(QDELETED(thing))
processing -= thing
@@ -334,7 +334,7 @@ SUBSYSTEM_DEF(tickets)
for(var/datum/ticket/T in allTickets)
if(T.client_ckey == C.ckey && (T.ticketState == TICKET_OPEN || T.ticketState == TICKET_STALE))
tickets += T
if(tickets.len)
if(length(tickets))
return tickets
return FALSE