ID:1133639
 
Resolved
BYOND Version:498
Operating System:Windows 7 Pro 64-bit
Web Browser:Chrome 24.0.1312.52
Applies to:Dream Seeker
Status: Resolved (506.1246)

This issue has been resolved.
Run the verb in this code

world
icon_size = 64
obj/thing/one
icon = 'things.dmi'
icon_state = "one"

obj/thing/two
icon = 'things.dmi'
icon_state = "two"

obj/thing/three
icon = 'things.dmi'
icon_state = "three"

equipment_grid

var/list/slots[3][4]

proc/set_slot(x, y, atom/movable/atom)
slots[x][y] = atom

proc/get_slot(x, y)
return slots[x][y]

proc/empty()
for(var/ix = 1 to 3)
for(var/iy = 1 to 4)
slots[ix][iy] = null

equipment_grid_client_display
var/equipment_grid/equipment_grid = new

var/client/viewer = null

var/list/screen_references = list()

var/tmp/state = 0 //1 == shown

proc/show(screen_x, screen_y)
if(!viewer) CRASH("You tried to show a display without setting client first!")

if(state) return
state = 1

for(var/ix = 1 to 3)
for(var/iy = 1 to 4)
var/atom/movable/a = equipment_grid.get_slot(ix, iy)
if(!a) continue
var/atom/movable/display = new
display.icon = a.icon
display.icon_state = a.icon_state
display.maptext = a.maptext
display.maptext_width = a.maptext_width
display.maptext_height = a.maptext_height

display.screen_loc = "[screen_x + (ix * world.icon_size)],[screen_y]" //the problem is this line

viewer.screen += display
screen_references += display

proc/hide()
if(!state) return
state = 0

for(var/o in screen_references)
viewer.screen -= o
screen_references.Cut()

mob
var/equipment_grid_client_display/grid = new
verb
test_equipment_grid()

if(grid.state) grid.hide()
else

grid.viewer = src.client

grid.equipment_grid.set_slot(2, 4, new /obj/thing/one)
grid.equipment_grid.set_slot(2, 3, new /obj/thing/two)
grid.equipment_grid.set_slot(1, 3, new /obj/thing/two)
grid.equipment_grid.set_slot(3, 3, new /obj/thing/two)
grid.equipment_grid.set_slot(2, 2, new /obj/thing/three)
grid.equipment_grid.set_slot(2, 1, new /obj/thing/three)

grid.show(4, 4)


The code is wrong on purpose to showcase the bug. On my machine, I get this:

http://i.imgur.com/47VdbpZ.png
I just performed the test myself and you are right. It definitely shows up on mine as well.

Edit: From the looks of it, it appears to be related with certain default icon sizes. I reduced the icon size and no bug. Setting of 52 or above seems to trigger it.

Edit 2: Checked the code again and just realized you commented one of the lines of code causing the issue. I am now doing research on it.

Edit 3: It appears you are using way too much video memory or resources according to that line. The way screen_loc works is if you do not use any pixel offsets, it will calculate the position automatically based on default icon size. With the way it is working, it seems to be eating up more memory/resources than there should've been. If you use pixel offsets (using the colon after the whole number), that should correct the problem. You might also be able to get away with no having to use any pixel offsets by removing the formula for x or modifying it by multiplying by ix (with no need to multiply by world.icon_size since calculations are done automatically).
Stephen001 resolved issue with message:
Works now it seems.
Stephen001 resolved issue