ID:148751
 
I have a tile_stacks object upon which the active player sees the tile which he/she just received. Whenever the tile is rotated or used (causing a new tile to be drawn), I del(tile_image) and then set tile_image to a new image based on the new tile (or new direction if tile was rotated). The image on the tile_stack is behaving as expected, but I'm having a problem with the MouseDrag() proc. After rotating the tile, the first time I drag the tile_stacks the mouse pointer shows the previous icon (before it was rotated). If I let go and drag it again, I now see the correct icon. Similarly, after the tile is used and replaced, the first time I drag the tile_stacks I see the old tile. After letting go and trying again, I get the correct image. What's going on here? Is there another way I should be programming this?

obj/tile_stack
MouseDrag()
if(usr == trn.cur_player)
mouse_drag_pointer = tile_image

// other code for context:
var/image/tile_image

TakeTurns/BeginTurn()
var/obj/tile/new_tile = pick(tile_stack)
if(tile_image) del(tile_image)
tile_image = image(new_tile.icon,locate(/obj/ tile_stacks),new_tile.icon_state)
I guess it's simply too late to change the mouse_drag_pointer once MouseDrag() is called. I instead change the pointer in the proc where the tile image gets modified (ie. when someone rotates the tile), and it works fine now.