ID:2833804
 
Resolved
New optimizations for for(atom in range()) and similar procs were compiling incorrectly.
BYOND Version:515.1594
Operating System:Windows 10 Pro
Web Browser:Firefox 106.0
Applies to:Dream Maker
Status: Resolved (515.1595)

This issue has been resolved.
Descriptive Problem Summary:
range in for loops does not return all present atoms every time.

Numbered Steps to Reproduce Problem:
1. Surround atom with opaque objects
2. Compare results of for(var/atom/x as anything in range(1,src)) with freestanding range(1,src) results

Code Snippet (if applicable) to Reproduce Problem:
obj/opaque
name = "opaque"
icon = 'icons.dmi'
icon_state = "bread"
opacity = 1

mob/verb/test()
var/list/found = range(1,src)
var/list/in_loop = new
for(var/atom/x as anything in range(1,src))
in_loop += x
found -= in_loop
if(!found.len)
world << "\bold Test successful!"
return
world << "\red Test failed!"
for(var/atom/x in found)
world << "[x]"

mob/verb/spawnblocker()
var/obj/opaque/blocker = new(usr.loc)


Expected Results:
Test successful
Actual Results:
Test failed

Workarounds: Use intermediate variable for range

Lummox JR resolved issue with message:
New optimizations for for(atom in range()) and similar procs were compiling incorrectly.