Replacing more C-style for loops with the faster, traditional ones. (#62908)

This commit is contained in:
Ghom
2021-11-19 02:39:05 +01:00
committed by GitHub
parent d4f4e05a37
commit 243cd2bfa5
26 changed files with 60 additions and 60 deletions
@@ -34,7 +34,7 @@
/obj/effect/decal/cleanable/xenoblood/xgibs/proc/streak(list/directions, mapload=FALSE)
set waitfor = FALSE
var/direction = pick(directions)
for(var/i = 0, i < pick(1, 200; 2, 150; 3, 50; 4, 17; 50), i++) //the 3% chance of 50 steps is intentional and played for laughs.
for(var/i in 1 to pick(1, 200; 2, 150; 3, 50; 4, 17; 50)) //the 3% chance of 50 steps is intentional and played for laughs.
if (!mapload)
sleep(2)
if(i > 0)
@@ -20,7 +20,7 @@
/obj/effect/decal/cleanable/robot_debris/proc/streak(list/directions, mapload=FALSE)
set waitfor = FALSE
var/direction = pick(directions)
for (var/i = 0, i < pick(1, 200; 2, 150; 3, 50; 4, 17; 50), i++) //the 3% chance of 50 steps is intentional and played for laughs.
for (var/i in 1 to pick(1, 200; 2, 150; 3, 50; 4, 17; 50)) //the 3% chance of 50 steps is intentional and played for laughs.
if (!mapload)
sleep(2)
if (i > 0)
@@ -24,7 +24,7 @@
if(frames == 0)
frames = 1 //We will just assume that by 0 frames, the coder meant "during one frame".
var/step = alpha / frames
for(var/i = 0, i < frames, i++)
for(var/i in 1 to frames)
alpha -= step
if(alpha < 160)
set_opacity(0) //if we were blocking view, we aren't now because we're fading out
@@ -42,9 +42,9 @@
dna_to_add = list("Non-human DNA" = random_blood_type()) //else, generate a random bloodtype for it.
for(var/i = 1, i<= gibtypes.len, i++)
for(var/i in 1 to gibtypes.len)
if(gibamounts[i])
for(var/j = 1, j<= gibamounts[i], j++)
for(var/j in 1 to gibamounts[i])
var/gibType = gibtypes[i]
gib = new gibType(loc, diseases)
+1 -1
View File
@@ -188,7 +188,7 @@
var/icon/mob_snapshot = getFlatIcon(target)
var/icon/cached_icon = new()
for(var/i=1, i<=CHRONO_FRAME_COUNT, i++)
for(var/i in 1 to CHRONO_FRAME_COUNT)
var/icon/removing_frame = icon('icons/obj/chronos.dmi', "erasing", SOUTH, i)
var/icon/mob_icon = icon(mob_snapshot)
mob_icon.Blend(removing_frame, ICON_MULTIPLY)
@@ -299,7 +299,7 @@
playsound(src, 'sound/items/taperecorder/taperecorder_print.ogg', 50, FALSE)
var/obj/item/paper/P = new /obj/item/paper(get_turf(src))
var/t1 = "<B>Transcript:</B><BR><BR>"
for(var/i = 1, mytape.storedinfo.len >= i, i++)
for(var/i in 1 to mytape.storedinfo.len)
t1 += "[mytape.storedinfo[i]]<BR>"
P.info = t1
var/tapename = mytape.name
+1 -1
View File
@@ -197,7 +197,7 @@
the_targets.Add(T3,T4)
var/list/water_particles=list()
for(var/a=0, a<5, a++)
for(var/a in 1 to 5)
var/obj/effect/particle_effect/water/W = new /obj/effect/particle_effect/water(get_turf(src))
var/my_target = pick(the_targets)
water_particles[W] = my_target
+1 -1
View File
@@ -52,7 +52,7 @@
return FALSE
on_reading_start(user)
reading = TRUE
for(var/i=1, i<=pages_to_mastery, i++)
for(var/i in 1 to pages_to_mastery)
if(!turn_page(user))
on_reading_stopped()
reading = FALSE
+2 -2
View File
@@ -69,7 +69,7 @@
// Add some random stamps.
if(stamped == TRUE)
var/stamp_count = rand(1, stamp_max)
for(var/i = 1, i <= stamp_count, i++)
for(var/i in 1 to stamp_count)
stamps += list("stamp_[rand(2, 6)]")
update_icon()
@@ -157,7 +157,7 @@
else
goodies += job_goodies
for(var/iterator = 0, iterator < goodie_count, iterator++)
for(var/iterator in 1 to goodie_count)
var/target_good = pick_weight(goodies)
var/atom/movable/target_atom = new target_good(src)
body.log_message("[key_name(body)] received [target_atom.name] in the mail ([target_good])", LOG_GAME)