[MIRROR] Replacing more C-style for loops with the faster, traditional ones. [MDB IGNORE] (#9560)

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

* Replacing more C-style for loops with the faster, traditional ones.

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
SkyratBot
2021-11-19 20:37:13 +00:00
committed by GitHub
parent 7c55a7602f
commit a94325afe4
26 changed files with 60 additions and 60 deletions

View File

@@ -357,7 +357,7 @@
return return
inserted_list = inserted_list.Copy() inserted_list = inserted_list.Copy()
for(var/i = 1, i < inserted_list.len, ++i) for(var/i in 1 to inserted_list.len - 1)
inserted_list.Swap(i, rand(i, inserted_list.len)) inserted_list.Swap(i, rand(i, inserted_list.len))
return inserted_list return inserted_list
@@ -367,7 +367,7 @@
if(!inserted_list) if(!inserted_list)
return return
for(var/i = 1, i < inserted_list.len, ++i) for(var/i in 1 to inserted_list.len - 1)
inserted_list.Swap(i, rand(i, inserted_list.len)) inserted_list.Swap(i, rand(i, inserted_list.len))
///Return a list with no duplicate entries ///Return a list with no duplicate entries
@@ -410,7 +410,7 @@
if(islist(wordlist)) if(islist(wordlist))
var/max = min(wordlist.len, 24) var/max = min(wordlist.len, 24)
var/bit = 1 var/bit = 1
for(var/i = 1, i <= max, i++) for(var/i in 1 to max)
if(bitfield & bit) if(bitfield & bit)
return_list += wordlist[i] return_list += wordlist[i]
bit = bit << 1 bit = bit << 1
@@ -471,7 +471,7 @@
return //no need to move return //no need to move
from_index += len //we want to shift left instead of right from_index += len //we want to shift left instead of right
for(var/i = 0, i < distance, ++i) for(var/i in 1 to distance)
inserted_list.Insert(from_index, null) inserted_list.Insert(from_index, null)
inserted_list.Swap(from_index, to_index) inserted_list.Swap(from_index, to_index)
inserted_list.Cut(to_index, to_index + 1) inserted_list.Cut(to_index, to_index + 1)
@@ -479,7 +479,7 @@
if(from_index > to_index) if(from_index > to_index)
from_index += len from_index += len
for(var/i = 0, i < len, ++i) for(var/i in 1 to len)
inserted_list.Insert(to_index, null) inserted_list.Insert(to_index, null)
inserted_list.Swap(from_index, to_index) inserted_list.Swap(from_index, to_index)
inserted_list.Cut(from_index, from_index + 1) inserted_list.Cut(from_index, from_index + 1)
@@ -495,7 +495,7 @@
else else
from_index += len from_index += len
for(var/i = 0, i < distance, ++i) for(var/i in 1 to distance)
inserted_list.Insert(from_index, null) inserted_list.Insert(from_index, null)
inserted_list.Swap(from_index, to_index) inserted_list.Swap(from_index, to_index)
inserted_list.Cut(to_index, to_index + 1) inserted_list.Cut(to_index, to_index + 1)
@@ -505,7 +505,7 @@
to_index = from_index to_index = from_index
from_index = a from_index = a
for(var/i = 0, i < len, ++i) for(var/i in 1 to len)
inserted_list.Swap(from_index++, to_index++) inserted_list.Swap(from_index++, to_index++)
///replaces reverseList ~Carnie ///replaces reverseList ~Carnie

View File

@@ -15,7 +15,7 @@ GLOBAL_VAR_INIT(fileaccess_timer, 0)
root = "[GLOB.log_directory]/" root = "[GLOB.log_directory]/"
var/path = root var/path = root
for(var/i=0, i<max_iterations, i++) for(var/i in 1 to max_iterations)
var/list/choices = flist(path) var/list/choices = flist(path)
if(path != root) if(path != root)
choices.Insert(1,"/") choices.Insert(1,"/")

View File

@@ -860,16 +860,16 @@ world
var/icon/alpha_mask = getIconMask(src)//getFlatIcon(src) is accurate but SLOW. Not designed for running each tick. This is also a little slow since it's blending a bunch of icons together but good enough. var/icon/alpha_mask = getIconMask(src)//getFlatIcon(src) is accurate but SLOW. Not designed for running each tick. This is also a little slow since it's blending a bunch of icons together but good enough.
opacity_icon.AddAlphaMask(alpha_mask)//Likely the main source of lag for this proc. Probably not designed to run each tick. opacity_icon.AddAlphaMask(alpha_mask)//Likely the main source of lag for this proc. Probably not designed to run each tick.
opacity_icon.ChangeOpacity(0.4)//Front end for MapColors so it's fast. 0.5 means half opacity and looks the best in my opinion. opacity_icon.ChangeOpacity(0.4)//Front end for MapColors so it's fast. 0.5 means half opacity and looks the best in my opinion.
for(var/i=0,i<5,i++)//And now we add it as overlays. It's faster than creating an icon and then merging it. for(var/i in 1 to 5)//And now we add it as overlays. It's faster than creating an icon and then merging it.
var/image/I = image("icon" = opacity_icon, "icon_state" = A.icon_state, "layer" = layer+0.8)//So it's above other stuff but below weapons and the like. var/image/I = image("icon" = opacity_icon, "icon_state" = A.icon_state, "layer" = layer+0.8)//So it's above other stuff but below weapons and the like.
switch(i)//Now to determine offset so the result is somewhat blurred. switch(i)//Now to determine offset so the result is somewhat blurred.
if(1)
I.pixel_x--
if(2) if(2)
I.pixel_x++ I.pixel_x--
if(3) if(3)
I.pixel_y-- I.pixel_x++
if(4) if(4)
I.pixel_y--
if(5)
I.pixel_y++ I.pixel_y++
add_overlay(I)//And finally add the overlay. add_overlay(I)//And finally add the overlay.

View File

@@ -374,12 +374,12 @@ GLOBAL_LIST_INIT(space, list(" "))
GLOBAL_LIST_INIT(binary, list("0","1")) GLOBAL_LIST_INIT(binary, list("0","1"))
/proc/random_string(length, list/characters) /proc/random_string(length, list/characters)
. = "" . = ""
for(var/i=1, i<=length, i++) for(var/i in 1 to length)
. += pick(characters) . += pick(characters)
/proc/repeat_string(times, string="") /proc/repeat_string(times, string="")
. = "" . = ""
for(var/i=1, i<=times, i++) for(var/i in 1 to times)
. += string . += string
/proc/random_short_color() /proc/random_short_color()
@@ -481,7 +481,7 @@ GLOBAL_LIST_INIT(binary, list("0","1"))
var/tlistlen = tlist.len var/tlistlen = tlist.len
var/listlevel = -1 var/listlevel = -1
var/singlespace = -1 // if 0, double spaces are used before asterisks, if 1, single are var/singlespace = -1 // if 0, double spaces are used before asterisks, if 1, single are
for(var/i = 1, i <= tlistlen, i++) for(var/i in 1 to tlistlen)
var/line = tlist[i] var/line = tlist[i]
var/count_asterisk = length(replacetext(line, regex("\[^\\*\]+", "g"), "")) var/count_asterisk = length(replacetext(line, regex("\[^\\*\]+", "g"), ""))
if(count_asterisk % 2 == 1 && findtext(line, regex("^\\s*\\*", "g"))) // there is an extra asterisk in the beggining if(count_asterisk % 2 == 1 && findtext(line, regex("^\\s*\\*", "g"))) // there is an extra asterisk in the beggining
@@ -514,7 +514,7 @@ GLOBAL_LIST_INIT(binary, list("0","1"))
// end for // end for
t = tlist[1] t = tlist[1]
for(var/i = 2, i <= tlistlen, i++) for(var/i in 2 to tlistlen)
t += "\n" + tlist[i] t += "\n" + tlist[i]
while(listlevel >= 0) while(listlevel >= 0)
@@ -657,7 +657,7 @@ GLOBAL_LIST_INIT(binary, list("0","1"))
var/punctbuffer = "" var/punctbuffer = ""
var/cutoff = 0 var/cutoff = 0
lentext = length_char(buffer) lentext = length_char(buffer)
for(var/pos = 1, pos <= lentext, pos++) for(var/pos in 1 to lentext)
let = copytext_char(buffer, -pos, -pos + 1) let = copytext_char(buffer, -pos, -pos + 1)
if(!findtext(let, GLOB.is_punctuation)) //This won't handle things like Nyaaaa!~ but that's fine if(!findtext(let, GLOB.is_punctuation)) //This won't handle things like Nyaaaa!~ but that's fine
break break

View File

@@ -788,10 +788,10 @@ so as to remain in compliance with the most up-to-date laws."
return return
var/list/alerts = mymob.alerts var/list/alerts = mymob.alerts
if(!hud_shown) if(!hud_shown)
for(var/i = 1, i <= alerts.len, i++) for(var/i in 1 to alerts.len)
screenmob.client.screen -= alerts[alerts[i]] screenmob.client.screen -= alerts[alerts[i]]
return 1 return 1
for(var/i = 1, i <= alerts.len, i++) for(var/i in 1 to alerts.len)
var/atom/movable/screen/alert/alert = alerts[alerts[i]] var/atom/movable/screen/alert/alert = alerts[alerts[i]]
if(alert.icon_state == "template") if(alert.icon_state == "template")
alert.icon = ui_style alert.icon = ui_style

View File

@@ -17,7 +17,7 @@ SUBSYSTEM_DEF(lag_switch)
var/slowmode_cooldown = 3 SECONDS var/slowmode_cooldown = 3 SECONDS
/datum/controller/subsystem/lag_switch/Initialize(start_timeofday) /datum/controller/subsystem/lag_switch/Initialize(start_timeofday)
for(var/i = 1, i <= measures.len, i++) for(var/i in 1 to measures.len)
measures[i] = FALSE measures[i] = FALSE
var/auto_switch_pop = CONFIG_GET(number/auto_lag_switch_pop) var/auto_switch_pop = CONFIG_GET(number/auto_lag_switch_pop)
if(auto_switch_pop) if(auto_switch_pop)
@@ -124,10 +124,10 @@ SUBSYSTEM_DEF(lag_switch)
message_admins("Lag Switch enabling automatic measures now.") message_admins("Lag Switch enabling automatic measures now.")
log_admin("Lag Switch enabling automatic measures now.") log_admin("Lag Switch enabling automatic measures now.")
veto_timer_id = null veto_timer_id = null
for(var/i = 1, i <= auto_measures.len, i++) for(var/i in 1 to auto_measures.len)
set_measure(auto_measures[i], state) set_measure(auto_measures[i], state)
return TRUE return TRUE
for(var/i = 1, i <= measures.len, i++) for(var/i in 1 to measures.len)
set_measure(i, state) set_measure(i, state)
return TRUE return TRUE

View File

@@ -86,7 +86,7 @@ SUBSYSTEM_DEF(vote)
text += "<b>[question]</b>" text += "<b>[question]</b>"
else else
text += "<b>[capitalize(mode)] Vote</b>" text += "<b>[capitalize(mode)] Vote</b>"
for(var/i=1,i<=choices.len,i++) for(var/i in 1 to choices)
var/votes = choices[choices[i]] var/votes = choices[choices[i]]
if(!votes) if(!votes)
votes = 0 votes = 0
@@ -218,7 +218,7 @@ SUBSYSTEM_DEF(vote)
question = stripped_input(usr,"What is the vote for?") question = stripped_input(usr,"What is the vote for?")
if(!question) if(!question)
return FALSE return FALSE
for(var/i=1,i<=10,i++) for(var/i in 1 to 10)
var/option = capitalize(stripped_input(usr,"Please enter an option or hit cancel to finish")) var/option = capitalize(stripped_input(usr,"Please enter an option or hit cancel to finish"))
if(!option || mode || !usr.client) if(!option || mode || !usr.client)
break break

View File

@@ -285,7 +285,7 @@
if(inherent.len && (LAW_INHERENT in groups)) if(inherent.len && (LAW_INHERENT in groups))
law_amount += inherent.len law_amount += inherent.len
if(supplied.len && (LAW_SUPPLIED in groups)) if(supplied.len && (LAW_SUPPLIED in groups))
for(var/index = 1, index <= supplied.len, index++) for(var/index in 1 to supplied.len)
var/law = supplied[index] var/law = supplied[index]
if(length(law) > 0) if(length(law) > 0)
law_amount++ law_amount++
@@ -364,13 +364,13 @@
laws += law laws += law
if(ion.len && (LAW_ION in groups)) if(ion.len && (LAW_ION in groups))
for(var/i = 1, i <= ion.len, i++) for(var/i in 1 to ion.len)
ion[i] = pick_n_take(laws) ion[i] = pick_n_take(laws)
if(hacked.len && (LAW_HACKED in groups)) if(hacked.len && (LAW_HACKED in groups))
for(var/i = 1, i <= hacked.len, i++) for(var/i in 1 to hacked.len)
hacked[i] = pick_n_take(laws) hacked[i] = pick_n_take(laws)
if(inherent.len && (LAW_INHERENT in groups)) if(inherent.len && (LAW_INHERENT in groups))
for(var/i = 1, i <= inherent.len, i++) for(var/i in 1 to inherent.len)
inherent[i] = pick_n_take(laws) inherent[i] = pick_n_take(laws)
if(supplied.len && (LAW_SUPPLIED in groups)) if(supplied.len && (LAW_SUPPLIED in groups))
var/i = 1 var/i = 1
@@ -389,7 +389,7 @@
inherent -= . inherent -= .
return return
var/list/supplied_laws = list() var/list/supplied_laws = list()
for(var/index = 1, index <= supplied.len, index++) for(var/index in 1 to supplied.len)
var/law = supplied[index] var/law = supplied[index]
if(length(law) > 0) if(length(law) > 0)
supplied_laws += index //storing the law number instead of the law supplied_laws += index //storing the law number instead of the law

View File

@@ -454,7 +454,7 @@
playsound(user, 'sound/effects/Glasshit.ogg', 140, TRUE) playsound(user, 'sound/effects/Glasshit.ogg', 140, TRUE)
if(W.type in list(/obj/structure/window, /obj/structure/window/fulltile, /obj/structure/window/unanchored, /obj/structure/window/fulltile/unanchored)) // boring unreinforced windows if(W.type in list(/obj/structure/window, /obj/structure/window/fulltile, /obj/structure/window/unanchored, /obj/structure/window/fulltile/unanchored)) // boring unreinforced windows
for(var/i = 0, i < speed, i++) for(var/i in 1 to speed)
var/obj/item/shard/shard = new /obj/item/shard(get_turf(user)) var/obj/item/shard/shard = new /obj/item/shard(get_turf(user))
shard.embedding = list(embed_chance = 100, ignore_throwspeed_threshold = TRUE, impact_pain_mult=3, pain_chance=5) shard.embedding = list(embed_chance = 100, ignore_throwspeed_threshold = TRUE, impact_pain_mult=3, pain_chance=5)
shard.updateEmbedding() shard.updateEmbedding()

View File

@@ -142,18 +142,18 @@ If you make a derivative work from this code, you must include this notification
to_chat(A, span_danger("You start spinning around with [D]!")) to_chat(A, span_danger("You start spinning around with [D]!"))
A.emote("scream") A.emote("scream")
for (var/i = 0, i < 20, i++) for (var/i in 1 to 20)
var/delay = 5 var/delay = 5
switch (i) switch (i)
if (17 to INFINITY) if (18 to INFINITY)
delay = 0.25 delay = 0.25
if (14 to 16) if (15 to 17)
delay = 0.5 delay = 0.5
if (9 to 13) if (10 to 14)
delay = 1 delay = 1
if (5 to 8) if (6 to 9)
delay = 2 delay = 2
if (0 to 4) if (1 to 5)
delay = 3 delay = 3
if (A && D) if (A && D)
@@ -227,7 +227,7 @@ If you make a derivative work from this code, you must include this notification
FlipAnimation() FlipAnimation()
for (var/i = 0, i < 3, i++) for (var/i in 1 to 3)
if (A && D) if (A && D)
A.pixel_y += 3 A.pixel_y += 3
D.pixel_y += 3 D.pixel_y += 3
@@ -332,7 +332,7 @@ If you make a derivative work from this code, you must include this notification
return return
var/turf/T = get_turf(A) var/turf/T = get_turf(A)
if (T && isturf(T) && D && isturf(D.loc)) if (T && isturf(T) && D && isturf(D.loc))
for (var/i = 0, i < 4, i++) for (var/i in 1 to 4)
A.setDir(turn(A.dir, 90)) A.setDir(turn(A.dir, 90))
A.forceMove(D.loc) A.forceMove(D.loc)

View File

@@ -605,7 +605,7 @@
. = ..() . = ..()
var/carriers_to_make = max(round(mode.roundstart_pop_ready / players_per_carrier, 1), 1) var/carriers_to_make = max(round(mode.roundstart_pop_ready / players_per_carrier, 1), 1)
for(var/j = 0, j < carriers_to_make, j++) for(var/j in 1 to carriers_to_make)
if (!candidates.len) if (!candidates.len)
break break
var/mob/carrier = pick_n_take(candidates) var/mob/carrier = pick_n_take(candidates)

View File

@@ -314,7 +314,7 @@
N.update_appearance() N.update_appearance()
N.autolathe_crafted(src) N.autolathe_crafted(src)
else else
for(var/i=1, i<=multiplier, i++) for(var/i in 1 to multiplier)
var/obj/item/new_item = new being_built.build_path(A) var/obj/item/new_item = new being_built.build_path(A)
new_item.autolathe_crafted(src) new_item.autolathe_crafted(src)

View File

@@ -89,7 +89,7 @@ GLOBAL_LIST_INIT(arcade_prize_pool, list(
span_notice("You hear a flurry of buttons being pressed.")) span_notice("You hear a flurry of buttons being pressed."))
say("CODE ACTIVATED: EXTRA PRIZES.") say("CODE ACTIVATED: EXTRA PRIZES.")
prizes *= 2 prizes *= 2
for(var/i = 0, i < prizes, i++) for(var/i in 1 to prizes)
SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "arcade", /datum/mood_event/arcade) SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "arcade", /datum/mood_event/arcade)
if(prob(0.0001)) //1 in a million if(prob(0.0001)) //1 in a million
new /obj/item/gun/energy/pulse/prize(src) new /obj/item/gun/energy/pulse/prize(src)

View File

@@ -524,7 +524,7 @@
if(game.obj_flags & EMAGGED) if(game.obj_flags & EMAGGED)
game.say("WEEWOO! WEEWOO! Spaceport security en route!") game.say("WEEWOO! WEEWOO! Spaceport security en route!")
playsound(game, 'sound/items/weeoo1.ogg', 100, FALSE) playsound(game, 'sound/items/weeoo1.ogg', 100, FALSE)
for(var/i, i<=3, i++) for(var/i in 1 to 3)
var/mob/living/simple_animal/hostile/syndicate/ranged/smg/orion/spaceport_security = new(get_turf(src)) var/mob/living/simple_animal/hostile/syndicate/ranged/smg/orion/spaceport_security = new(get_turf(src))
spaceport_security.GiveTarget(usr) spaceport_security.GiveTarget(usr)
game.fuel += fuel game.fuel += fuel

View File

@@ -1786,7 +1786,7 @@
// No code will ever null this list, we can safely Cut it. // No code will ever null this list, we can safely Cut it.
tgui_genetic_makeup.Cut() tgui_genetic_makeup.Cut()
for(var/i=1, i <= NUMBER_OF_BUFFERS, i++) for(var/i in 1 to NUMBER_OF_BUFFERS)
if(genetic_makeup_buffer[i]) if(genetic_makeup_buffer[i])
tgui_genetic_makeup["[i]"] = genetic_makeup_buffer[i].Copy() tgui_genetic_makeup["[i]"] = genetic_makeup_buffer[i].Copy()
else else

View File

@@ -46,7 +46,7 @@
INVOKE_ASYNC(src, .proc/toggle_reel_spin, TRUE)//The reels won't spin unless we activate them INVOKE_ASYNC(src, .proc/toggle_reel_spin, TRUE)//The reels won't spin unless we activate them
var/list/reel = reels[1] var/list/reel = reels[1]
for(var/i = 0, i < reel.len, i++) //Populate the reels. for(var/i in 1 to reel.len) //Populate the reels.
randomize_reels() randomize_reels()
INVOKE_ASYNC(src, .proc/toggle_reel_spin, FALSE) INVOKE_ASYNC(src, .proc/toggle_reel_spin, FALSE)
@@ -269,7 +269,7 @@
if(paymode == HOLOCHIP) if(paymode == HOLOCHIP)
new /obj/item/holochip(loc,JACKPOT) new /obj/item/holochip(loc,JACKPOT)
else else
for(var/i = 0, i < 5, i++) for(var/i in 1 to 5)
cointype = pick(subtypesof(/obj/item/coin)) cointype = pick(subtypesof(/obj/item/coin))
var/obj/item/coin/C = new cointype(loc) var/obj/item/coin/C = new cointype(loc)
random_step(C, 2, 50) random_step(C, 2, 50)
@@ -293,7 +293,7 @@
/obj/machinery/computer/slot_machine/proc/get_lines() /obj/machinery/computer/slot_machine/proc/get_lines()
var/amountthesame var/amountthesame
for(var/i = 1, i <= 3, i++) for(var/i in 1 to 3)
var/inputtext = reels[1][i] + reels[2][i] + reels[3][i] + reels[4][i] + reels[5][i] var/inputtext = reels[1][i] + reels[2][i] + reels[3][i] + reels[4][i] + reels[5][i]
for(var/symbol in symbols) for(var/symbol in symbols)
var/j = 3 //The lowest value we have to check for. var/j = 3 //The lowest value we have to check for.

View File

@@ -34,7 +34,7 @@
/obj/effect/decal/cleanable/xenoblood/xgibs/proc/streak(list/directions, mapload=FALSE) /obj/effect/decal/cleanable/xenoblood/xgibs/proc/streak(list/directions, mapload=FALSE)
set waitfor = FALSE set waitfor = FALSE
var/direction = pick(directions) 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) if (!mapload)
sleep(2) sleep(2)
if(i > 0) if(i > 0)

View File

@@ -20,7 +20,7 @@
/obj/effect/decal/cleanable/robot_debris/proc/streak(list/directions, mapload=FALSE) /obj/effect/decal/cleanable/robot_debris/proc/streak(list/directions, mapload=FALSE)
set waitfor = FALSE set waitfor = FALSE
var/direction = pick(directions) 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) if (!mapload)
sleep(2) sleep(2)
if (i > 0) if (i > 0)

View File

@@ -24,7 +24,7 @@
if(frames == 0) if(frames == 0)
frames = 1 //We will just assume that by 0 frames, the coder meant "during one frame". frames = 1 //We will just assume that by 0 frames, the coder meant "during one frame".
var/step = alpha / frames var/step = alpha / frames
for(var/i = 0, i < frames, i++) for(var/i in 1 to frames)
alpha -= step alpha -= step
if(alpha < 160) if(alpha < 160)
set_opacity(0) //if we were blocking view, we aren't now because we're fading out set_opacity(0) //if we were blocking view, we aren't now because we're fading out

View File

@@ -42,9 +42,9 @@
dna_to_add = list("Non-human DNA" = random_blood_type()) //else, generate a random bloodtype for it. 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]) if(gibamounts[i])
for(var/j = 1, j<= gibamounts[i], j++) for(var/j in 1 to gibamounts[i])
var/gibType = gibtypes[i] var/gibType = gibtypes[i]
gib = new gibType(loc, diseases) gib = new gibType(loc, diseases)

View File

@@ -188,7 +188,7 @@
var/icon/mob_snapshot = getFlatIcon(target) var/icon/mob_snapshot = getFlatIcon(target)
var/icon/cached_icon = new() 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/removing_frame = icon('icons/obj/chronos.dmi', "erasing", SOUTH, i)
var/icon/mob_icon = icon(mob_snapshot) var/icon/mob_icon = icon(mob_snapshot)
mob_icon.Blend(removing_frame, ICON_MULTIPLY) mob_icon.Blend(removing_frame, ICON_MULTIPLY)

View File

@@ -299,7 +299,7 @@
playsound(src, 'sound/items/taperecorder/taperecorder_print.ogg', 50, FALSE) playsound(src, 'sound/items/taperecorder/taperecorder_print.ogg', 50, FALSE)
var/obj/item/paper/P = new /obj/item/paper(get_turf(src)) var/obj/item/paper/P = new /obj/item/paper(get_turf(src))
var/t1 = "<B>Transcript:</B><BR><BR>" 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>" t1 += "[mytape.storedinfo[i]]<BR>"
P.info = t1 P.info = t1
var/tapename = mytape.name var/tapename = mytape.name

View File

@@ -197,7 +197,7 @@
the_targets.Add(T3,T4) the_targets.Add(T3,T4)
var/list/water_particles=list() 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/obj/effect/particle_effect/water/W = new /obj/effect/particle_effect/water(get_turf(src))
var/my_target = pick(the_targets) var/my_target = pick(the_targets)
water_particles[W] = my_target water_particles[W] = my_target

View File

@@ -52,7 +52,7 @@
return FALSE return FALSE
on_reading_start(user) on_reading_start(user)
reading = TRUE reading = TRUE
for(var/i=1, i<=pages_to_mastery, i++) for(var/i in 1 to pages_to_mastery)
if(!turn_page(user)) if(!turn_page(user))
on_reading_stopped() on_reading_stopped()
reading = FALSE reading = FALSE

View File

@@ -71,7 +71,7 @@
// Add some random stamps. // Add some random stamps.
if(stamped == TRUE) if(stamped == TRUE)
var/stamp_count = rand(1, stamp_max) 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)]") stamps += list("stamp_[rand(2, 6)]")
update_icon() update_icon()
@@ -159,7 +159,7 @@
else else
goodies += job_goodies 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/target_good = pick_weight(goodies)
var/atom/movable/target_atom = new target_good(src) 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) body.log_message("[key_name(body)] received [target_atom.name] in the mail ([target_good])", LOG_GAME)

View File

@@ -38,8 +38,8 @@
for(var/i = 1, i <= length_input, i += length(char)) //put the guess into a list for(var/i = 1, i <= length_input, i += length(char)) //put the guess into a list
char = input[i] char = input[i]
sanitised += text2num(char) sanitised += text2num(char)
for(var/i = 1, i <= length(sanitised) - 1, i++) //compare each digit in the guess to all those following it for(var/i in 1 to length(sanitised) - 1) //compare each digit in the guess to all those following it
for(var/j = i + 1, j <= length(sanitised), j++) for(var/j in i + 1 to length(sanitised))
if(sanitised[i] == sanitised[j]) if(sanitised[i] == sanitised[j])
sanitycheck = FALSE //if a digit is repeated, reject the input sanitycheck = FALSE //if a digit is repeated, reject the input
if(input == code) if(input == code)