for(var/obj/card/c in client.screen)
c.layer = OBJ_LAYER
client.screen -= c //remove all cards from screen.
var/hand_length = 1
while(hand_length <= hand.len)
var/obj/card/c = hand[hand_length]
c.layer = MOB_LAYER+1
for(var/obj/hand/h in client.screen)
screen_spot = h
c.icon = c.hand_icon
screen_spot.card = c
c.screen_loc = screen_spot.screen_loc
client.screen += c
Pretty much what I am using seems fine, but I have narrowed it down to what seems to be this block of code. I can't be 100% certain though, as whatever it is is crashing the game so much I can't even read the error messages.
Anyways, the point of this block of code is to add cards to a screen based on the cards in the player's list; "hand". Does anyone see any reason why this code could potentially cause an infinite loop?
Also it might be worth mentioning that I call this procedure everytime I add a new card to the hand, so this means if I were to draw 5 cards at the beginning of a game, it would call this block 5 times (including sleep(10) between each draw card to add to the effect).
EDIT: Also this Update_Hand() procedure actually does work entirely, but when I end a game and start a new one, the issue seems to stem from here. I am not sure why though.