ID:2600534
 
Resolved
view() and similar procs could include turfs and possibly their contents multiple times when the perspective object (e.g. a player mob) straddled multiple turfs.
BYOND Version:513
Operating System:Windows 10 Home 64-bit
Web Browser:Chrome 84.0.4147.105
Applies to:Dream Daemon
Status: Resolved (513.1529)

This issue has been resolved.
Descriptive Problem Summary:
view() is picking up the same atoms multiple times when the viewer is on multiple turfs
This seems to occur with oview() as well
Numbered Steps to Reproduce Problem:
Stand in the middle of multiple turfs(I drew black lines to define the borders of each turf),
Click count overlays verb
Notice that there are triple the atoms being listed than there should be

Demo: https://gofile.io/d/yDdXZK

Code used for count overlays verb
    set category = "Debug"
set desc = "Display overlays in view"
set name = "Count Overlays"

var/atoms = 0
var/overlays = 0
var/underlays = 0
var/viscontents = 0

for(var/atom/A in view())
atoms++
overlays += A.overlays.len
underlays += A.underlays.len

var/screenobj = screen.len
var/screenobjoverlays = 0
var/screenobjunderlays = 0

for(var/atom/B in screen)
screenobjoverlays += B.overlays.len
screenobjunderlays += B.underlays.len

var/imagesL = images.len
var/imagesunderlays = 0
var/imagesoverlays = 0

for(var/image/I in images)
imagesoverlays += I.overlays.len
imagesunderlays += I.underlays.len

src << "[atoms] atoms in view, these atoms have [overlays] overlays, [underlays] underlays, and [viscontents] vis_contents."
src << "There are [screenobj] screenobjs, There are [screenobjoverlays] screen overlays, [screenobjunderlays] screen underlays."
src << "There are [imagesL] images, [imagesoverlays] of these are image overlays and [imagesunderlays] are underlays."

Expected Results:
Only atoms in view would be counted
Actual Results:
Atoms in view were counted multiple times
Does the problem occur:
Occurs everytime you stand in multiple turfs

When does the problem NOT occur?
When you are centered on a turf

Workarounds:
Standing in the middle of a turf
I think you're wrong about this, since view() and range() don't allow duplicate values in the list.

However your demo isn't displaying the right information. You're only counting objects, not actually checking what they are. What you need to do is output the \ref for each object in the list, which will tell you their full contents.
Shortened map to 2x2 and changed code to output \ref and name of each atom, it's definitely returning duplicate atoms

http://puu.sh/GfXN7/0c817559e3.png

updated demo http://puu.sh/GfXOf/67b1b8bff0.rar

updated code
/client/verb/profile_images()
set category = "Debug"
set desc = "Display overlays in view"
set name = "Count Overlays"

var/atoms = 0
var/overlays = 0
var/underlays = 0
var/viscontents = 0

for(var/atom/A in view())
atoms++
overlays += A.overlays.len
underlays += A.underlays.len
src << "\ref[A], [A]"

var/screenobj = screen.len
var/screenobjoverlays = 0
var/screenobjunderlays = 0

for(var/atom/B in screen)
screenobjoverlays += B.overlays.len
screenobjunderlays += B.underlays.len

var/imagesL = images.len
var/imagesunderlays = 0
var/imagesoverlays = 0

for(var/image/I in images)
imagesoverlays += I.overlays.len
imagesunderlays += I.underlays.len

src << "[atoms] atoms in view, these atoms have [overlays] overlays, [underlays] underlays, and [viscontents] vis_contents."
src << "There are [screenobj] screenobjs, There are [screenobjoverlays] screen overlays, [screenobjunderlays] screen underlays."
src << "There are [imagesL] images, [imagesoverlays] of these are image overlays and [imagesunderlays] are underlays."
Lummox JR resolved issue with message:
view() and similar procs could include turfs and possibly their contents multiple times when the perspective object (e.g. a player mob) straddled multiple turfs.